z/OS Using REXX and z/OS UNIX System Services
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


setrlimit

z/OS Using REXX and z/OS UNIX System Services
SA23-2283-00

Read syntax diagramSkip visual syntax diagram
>>-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

  1. 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.
  2. The maximum limit may be lowered to any value that is greater than or equal to the current limit.
  3. The maximum limit can only be raised by a process that has superuser authority.
  4. Both the current limit and maximum limit can be changed via a single call to setrlimit.
  5. If the setrlimit service is called with a current limit that is greater than the maximum limit, setrlimit returns an EINVAL errno.
  6. 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.
  7. 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.
  8. 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.
  9. 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.
  10. Limits may have an infinite value of RLIM_INFINITY.
  11. 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.
  12. 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.
  13. 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.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014