getjlimit(2)

getjlimit, setjlimit - control a job's maximum system resource consumption

As shipped in IRIX 6.5.7. Added in IRIX 6.5.7.

NAME
     getjlimit, setjlimit - control a job's maximum system resource
     consumption

SYNOPSIS
     #include <sys/resource.h>

     int getjlimit(jid_t jid, int resource, struct rlimit *rlp)

     int setjlimit(jid_t jid, int resource, struct rlimit *rlp)

DESCRIPTION
     Limits on the consumption of a variety of system resources by a job may
     be obtained with the getjlimit function and set by the setjlimit
     function.

     The getjlimit function gets the current and maximum job limits values for
     the specified job ID.  If the jid value is 0, getjlimit returns the
     values for the current job.  If the jid value is not 0, values are
     returned for the specified job.  The CAP_MAC_Read capability is needed to
     retrieve values from jobs belonging to other users.  The resource value
     is one of the JLIMIT values in the resource.h file.  Values are returned
     in the rlp structure.

     The setjlimit function sets the current and maximum job limits values for
     the specified job ID.  If the current job is different from the job being
     requested, the setjlimit function checks for the CAP_MAC_WRITE
     capability.  If the maximum (hard) limits are being raised, the setjlimit
     function checks for the CAP_PROC_MGT capability.  See the capability(4)
     and capabilities(4) man pages for more information on the capability
     mechanism that provides fine grained control over the privileges of a
     process.

     The possible resources, their descriptions, and the actions taken when
     current limit is exceeded, are summarized below:

     JLIMIT_CPU       The maximum amount of CPU time in seconds used by all
                      processes in the job.  SIGXCPU is sent to any process in
                      the job which exceeds this limit.  If the job is holding
                      or ignoring SIGXCPU, the behavior is scheduling class
                      defined.  Unless the SVR4_SIGNALS variable in
                      /etc/default/login is set to NO, this signal will be
                      ignored by default.  The system administrator can set a
                      grace period using the systune(1M) command to set the
                      cpulimit_gracetime parameter.  If the grace period is
                      set, each process will be allowed to continue executing
                      for "grace period" seconds after the SIGXCPU signal is
                      received.  If a process is still executing after the
                      grace period has expired, it is terminated using a
                      SIGKILL signal.
     JLIMIT_DATA      The maximum size of a job's heap in bytes.  A brk(2)
                      which attempts to exceed this limit will fail with errno
                      set to ENOMEM.

     JLIMIT_NOFILE    The maximum number of open file descriptors that the all
                      processes in the job can have.  Functions that attempt
                      to create new file descriptors beyond this limit will
                      fail with errno set to EMFILE.

     JLIMIT_NUMPROC   The maximum number of processes that can be created
                      within the job.  The fork function will fail with the
                      errno set to EAGAIN.

     JLIMIT_VMEM      The maximum size of all processes in the job's mapped
                      address space in bytes.  brk(2) and mmap(2) functions
                      which attempt to exceed this limit will fail with errno
                      set to ENOMEM.

     JLIMIT_RSS       The maximum size, in bytes to which a job's resident set
                      size may grow.  This imposes a limit on the amount of
                      physical memory to be given to a job; if memory is
                      tight, the system will prefer to take memory from jobs
                      that are exceeding their declared resident set size.

     The value of the current limit of the following resources affect these
     implementation defined constants:
                    Limit   Implementation Defined Constant
                    __________________________________________
                    JLIMIT_NOFILE   OPEN_MAX

ERRORS
     Under the following conditions, the functions getjlimit and setjlimit
     fail and set errno to:

     [ENOPKG]       The job limits software is not installed.

     [ENOJOB]       A job with the specified job ID cannot be found.

SEE ALSO
     jlimit(1), jstat(1), getjusage(2), getrlimit(2).

DIAGNOSTICS
     Upon successful completion, getjlimit and setjlimit return a value of 0.
     Otherwise, a value of -1 is returned and errno is set to indicate the
     error.