Standards / Extensions | C or C++ | Dependencies |
---|---|---|
XPG4.2 |
both |
#define _XOPEN_SOURCE_EXTENDED 1
#include <sys/resource.h>
int getrlimit(int resource, struct rlimit *rlp);
The getrlimit() function gets resource limits for the calling process. A resource limit is a pair of values; one specifying the current (soft) limit, the other a maximum (hard) limit.
The value RLIM_INFINITY defined in sys/resource.h, is considered to be larger than any other limit value. If a call to getrlimit() returns RLIM_INFINITY for a resource, it means the implementation does not enforce limits on that resource.
The resource limit values are propagated across exec and fork.
Special behavior for z/OS UNIX System Services: An exception exists for exec processing in conjunction with daemon support. If a daemon process invokes exec and it had previously invoked setuid() before exec, the RLIMIT_CPU, RLIMIT_AS, RLIMIT_CORE, RLIMIT_FSIZE, and RLIMIT_NOFILE limit values are set based on the limit values specified in the kernel parmlib member BPXPRMxx.
For processes which are 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 soft limit is exceeded, action will be taken on the first process within the address space. If the action is termination, all processes within the address space will be terminated.
In addition to the RLIMIT_CORE limit values, the dump file defaults are set by SYSMDUMP defaults. Refer to z/OS MVS Initialization and Tuning Reference for information on setting up SYSMDUMP defaults using the IEADMR00 parmlib member.
Dumps of memory are taken in 4160 byte increments. Therefore, RLIMIT_CORE values affect the size of memory dumps in 4160 byte increments. For example, if the RLIMIT_CORE soft limit value is 4000, the dump will contain no data. If the RLIMIT_CORE soft limit value is 8000, the maximum size of a memory dump is 4160 bytes.
Large file support for z/OS UNIX files: Large z/OS UNIX files are supported automatically for AMODE 64 C/C++ applications. AMODE 31 C/C++ applications must be compiled with the option LANGLVL(LONGLONG) and define the _LARGE_FILES feature test macro before any headers are included to enable this function to operate on z/OS UNIX files that are larger than 2 GB in size. File size and offset fields are enlarged to 63 bits in width. Therefore, any other function operating on the file is required to define the _LARGE_FILES feature test macro as well.
If successful, getrlimit() returns 0.