setrlimit(2)
_________________________________________________________________
setrlimit System Call
Set system resource consumption limits.
_________________________________________________________________
SYNTAX
#include <sys/time.h>
#include <sys/resource.h>
int setrlimit (resource, rlp)
int resource;
struct rlimit * rlp;
PARAMETERS
resource Identifies the resource for which the limits are
to be set.
rlp A pointer to a structure into which the limit
values are to be placed.
DESCRIPTION
The current setting of the limits on consumption of system
resources by the calling process may be changed with this system
call.
The <resource> parameter is one of the following:
RLIMIT_CPU
The maximum amount of cpu time (in seconds) used by the
process.
RLIMIT_FSIZE
The largest offset, in bytes, at which the process may write
to a file.
RLIMIT_DATA
The maximum size, in bytes, of the data segment for a
process; the limit is the sum of the virtual address spaces
occupied by the initial data area, data area allocated using
sbrk, and data area occupied by attached shared memory
segments.
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
setrlimit(2)
RLIMIT_STACK
The maximum size, in bytes, of the stack segment for a
process; this defines how far a program's stack segment may
be extended, either automatically by the system, or
explicitly by a user with the sbrk system call.
RLIMIT_CORE
The largest size, in bytes, of a core file which may be
created.
RLIMIT_RSS
The maximum size, in bytes, a process's resident set size
may grow to. This is an advisory limit on the amount of
physical memory to be given to a process; if memory is
tight, the system will prefer to take memory from processes
which are exceeding their declared resident set size.
A resource limit is specified as a soft limit and a hard limit.
When a soft limit is exceeded a process may receive a signal (for
example, if the cpu time is exceeded), but it will be allowed to
continue execution until it reaches the hard limit (or modifies
its resource limit). Both the hard and soft limit are set by
this system call, subject to the access restrictions described
below.
ACCESS CONTROL
The argument <rlp> must address an area of the calling process's
address space that is valid and has read access.
The calling process may, without restriction, change the soft
limit to any value between 0 and the hard limit, inclusive, and
irreversibly lower the hard limit. The calling process may
increase the hard limit only if its effective-user-id is 0.
RETURN VALUE
0 Successful completion.
-1 An error occurred. Errno is set to indicate the
error.
EXCEPTIONS
Errno may be set to one of the following error codes:
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)
setrlimit(2)
EFAULT The address specified for <rlp> is illegal.
EINVAL The value of <resource> is not one of the allowed
values.
SEE ALSO
The related system call: getrlimit, ulimit.
DG/UX 4.00 Page 3
Licensed material--property of copyright holder(s)