Fixed incorrect JSON output of catalog server.
Merge branch 'master' of github.com:cooperative-computing-lab/cctools

* 'master' of github.com:cooperative-computing-lab/cctools:
  Remove references to "auto" and "classic" mode, replace -m foreman with --foreman, have --cores default to 1.
  stupid mistake with arithmetic
  fixed problem with bandwidth limit and unsigned integer math
  Converted bandwidth limit mechanism from seconds to microseconds
Modified catalog_server to send Access-Control-Allow-Origin,
which enables other sites to pull json/xml/etc into dynamic web pages.
Fix if/then in configure for debian.
F_CLOEXEC should be set with F_SETFD, not F_SETFL.
Fixes http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=696249
Merge branch 'master' of github.com:cooperative-computing-lab/cctools

* 'master' of github.com:cooperative-computing-lab/cctools:
  Fix if/then in configure for debian.
Reduced most calls to get_canonical_path to getcwd instead.
The fork() in get_canonical_path was interacting badly with gprof.
Simplify code by keeping memory/disk in megabytes.

Memory was kept in kilobytes, and disk in megabytes, but as a double.
Read cores/memory/disk resources from environment.

The environment variable CORES, MEMORY, and DISK, are read from the
environment and set for the default resource category in Makeflow.
Monitor reads memory/disk/cores limits from env.

If the environment has the variables CORES, MEMORY, or DISK, the monitor
uses their values as resource limits.
Makeflow reads cores/disk/resources from file.

Tasks in makeflow can be group with the variable RESOURCES_CATEGORY as
follows:

RESOURCE_CATEGORY=category_one
DISK=100
CORES=3

output1: ...
output2: ...
output3: ...

RESOURCE_CATEGORY=some_other_category
DISK=100
CORES=3
MEMORY=3

output4: ...

The value of the resources apply to the name of the category last
assigned to RESOURCES_CATEGORY, therefore, the following is equivalent
to the above:

RESOURCE_CATEGORY=category_one
DISK=100
CORES=3

RESOURCE_CATEGORY=some_other_category
DISK=100
CORES=3
MEMORY=3

RESOURCE_CATEGORY=category_one
output1: ...
output2: ...
output3: ...

RESOURCE_CATEGORY=some_other_category
output4: ...

One thing to consider, for now, is that resources are applied to the
category when submitting to the queue, and that a category uniquely
identifies a set of resources. Therefore, for:

RESOURCE_CATEGORY=some_category
CORES=3

output: ...

RESOURCE_CATEGORY=some_category
CORES=1

The rule will get CORES=1, rather than CORES=3, which might be somewhat
confusing, and should be changed in the future (or at least produce a
visible warning).
Task categories as wq batch options.

Converts a category definition to:

--cores CORES --memory MEMORY --disk DISK

if the resources were defined for such category and if the batch system
is work queue, and then prepends BATCH_OPTIONS with this string.
This is prepended, rather than appended  to allow an explicit value
to BATCH_OPTIONS to override the values.