>>-setrlimit--resource--stem-----------------------------------><
Function
setrlimit invokes
the setrlimit callable service to set resource limits for the calling
process. A resource limit is a pair of values; one specifies the
current limit and the other a maximum limit.
Parameters
- resource
- The resource whose limit is being set. The maximum resource limit
is RLIM_INFINITY.
You
can use the predefined variables beginning with RLIMIT_, or their
equivalent numeric values, to specify the resource. (See
REXX predefined variables for the numeric values.)
Variable |
Description |
Allowable Range |
---|
RLIMIT_AS |
Maximum address space size for a process. |
10 485 760—2 147 483 647 |
RLIMIT_CORE |
Maximum size (in bytes) of a core dump created by a process. |
0—2 147 483 647 |
RLIMIT_CPU |
Maximum amount of CPU time (in seconds) used by a process. |
7—2 147 483 647 |
RLIMIT_FSIZE |
Maximum files size (in bytes) created by a process. |
0—2 147 483 647 |
RLIMIT_NOFILE |
Maximum number of open file descriptors for a process. |
5—131 072 |
- stem
- The name of the stem variable used to set the limit. stem.1 is
the first word, which sets the current limit, and stem.2 is
the second word, which sets the maximum limit. The values for each
word depend on the resource specified.
To specify no limit, use RLIM_INFINITY.
Usage notes
- The current limit may be modified to any value that is less than
or equal to the maximum limit. For the RLIMIT_CPU, RLIMIT_NOFILE,
and RLIMIT_AS resources, if the setrlimit service is called with a
current limit that is lower than the current usage, the setrlimit
service fails with an EINVAL errno.
- The maximum limit may be lowered to any value that is greater
than or equal to the current limit.
- The maximum limit can only be raised by a process that has superuser
authority.
- Both the current limit and maximum limit can be changed via a
single call to setrlimit.
- If the setrlimit service is called with a current limit that is
greater than the maximum limit, setrlimit returns an EINVAL errno.
- The resource limit values are propagated across exec and fork.
An exception exists for exec. If a daemon process invokes exec and
it invoked setuid before invoking exec, the limit values are set based
on the limit values specified in parmlib member BPXPRMxx.
- For a process that is not the only process within an address space,
the RLIMIT_CPU and RLIMIT_AS limits are shared with all the processes
within the address space. For RLIMIT_CPU, when the current limit
is exceeded, action is taken on the first process within the address
space. If the action is termination, all the processes within the
address space are terminated.
- In addition to the RLIMIT_CORE limit values, CORE dump defaults
are set by SYSMDUMP defaults. See z/OS MVS Initialization and Tuning Guide for
information on setting up SYSMDUMP defaults via the IEADMR00 parmlib
member.
- Core dumps are taken in 4160-byte increments. Therefore, RLIMIT_CORE
values affect the size of core dumps in 4160-byte increments. For
example, if the RLIMIT_CORE current limit value is 4000, core dumps
will contain no data. If the RLIMIT_CORE current limit value is 8000,
the maximum size of a core dump is 4160 bytes.
- Limits may have an infinite value of RLIM_INFINITY.
- If the limit that is specified for RLIMIT_NOFILE is higher than
that currently supported by the system, the limit will be reduced
to the system maximum when it is used.
- When setting RLIMIT_NOFILE, the current limit must be set higher
than the value of the highest open file descriptor. Attempting to
lower the current limit to a value less than or equal to the highest
open file descriptor results in an error of EINVAL.
- When setting RLIMIT_FSIZE, a limit of 0 prevents the creation
of new files and the expansion of existing files.
Example
To reduce the maximum number of
open files to 100 and the current limit to 50:
r.2=100
r.1=50
"setrlimit" rlimit_nofile r.