getjlimit(2)getjlimit(2)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 retrieves the current and maximum job limit values
for the specified job ID. If the jid value is 0, getjlimit returns the
values for the job of the calling process. If the jid value is not 0,
values are returned for the specified job. In this case, the caller must
be root, or the real or effective user ID of the caller must match the
user ID of the user associated with the job. User association is
established by the user parameter for makenewjob. Otherwise, getjlimit
checks for the CAP_MAC_READ 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 setjlimit function sets the current and maximum job limits values for
the specified job ID. If the jid value is 0, setjlimit sets the limit
values for the job of the calling process. If the jid value is not 0,
setjlimit sets the limit values for the job specified by jid. In this
case, the caller must be root, or the real or effective user ID of the
caller must match the user ID of the user associated with the job. User
association is established by the user parameter for makenewjob.
Otherwise, setjlimit checks for the CAP_MAC_WRITE 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.
Note: Job limit values (rlim_t) are 64-bit in both n32 and n64 binaries.
Consequently, n32 binaries can set 64-bit limits. o32 binaries cannot
set 64-bit limits because rlim_t is 32-bits in o32 binaries. IRIX
supports three Application Binary Interfaces: o32, n64, and n32 (for more
information on ABIs, see the abi(5) man page).
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. The SIGXCPU signal is sent to
each process of a job when it completes consumption of a
Page 1
getjlimit(2)getjlimit(2)
whole second of CPU time after the limit has been
exceeded. As a result, processes which are less active
in regard to CPU time consumption will experience a
"delay" in receiving the SIGXCPU signal.
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 of CPU time 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.
If the processes is holding or ignoring the SIGXCPU
signal, 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.
JLIMIT_DATA The maximum size of a job's heap in bytes. A brk(2)
call which attempts to exceed this limit will fail with
errno set to ENOMEM.
JLIMIT_NOFILE The maximum number of open file descriptors that 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. If the brk(2) or mmap(2)
functions attempt to exceed this limit, they will fail
with errno set to ENOMEM.
JLIMIT_PMEM The maximum amount of physical memory a job may consume.
If a job exceeds this limit, all processes associated
with the job which continue to consume resources are
killed. Also see the JLIMIT_RSS limit.
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
__________________________________________
Page 2
getjlimit(2)getjlimit(2)
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.
[EINVAL] The limit denoted by the resource argument is invalid, or
in the case of setjlimit, a limit value denoted by the rlp
argument is invalid.
[EPERM] The caller does not have permission to access or change
the limit information.
[EFAULT] The address of the rlp argument is invalid.
SEE ALSOjlimit(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.
Page 3