getrlimit (BPX1GRL, BPX4GRL) — Get resource limits

Function

The getrlimit callable service gets hard and soft resource limits for the calling process.

Requirements

Operation Environment
Authorization: Supervisor or problem state, any PSW key
Dispatchable unit mode: Task
Cross memory mode: PASN = HASN
AMODE (BPX1GRL): 31-bit
AMODE (BPX41GRL): 64-bit
ASC mode: Primary mode
Interrupt status: Enabled for interrupts
Locks: Unlocked
Control parameters: All parameters must be addressable by the caller and in the primary address space.

Format

CALL BPX1GRL,(Resource,
              Rlimit,
              Return_value,
              Return_code,
              Reason_code)

AMODE 64 callers use BPX4GRL with the same parameters.

Parameters

Resource
Supplied parameter
Type:
Integer
Length:
Fullword
The name of a fullword that contains a value that indicates the resource for which to get the hard and soft limits. This parameter can have one of the following values:
Constant Name Description
RLIMIT_MEMLIMIT Limit of 1-megabyte segments above the 2-gigabyte addressing range
RLIMIT_CORE Limit size of core dump
RLIMIT_CPU Limit CPU time per process
RLIMIT_FSIZE Limit file size
RLIMIT_NOFILE Limit number of open files
RLIMIT_AS Limit address space size

The RLIMIT_ constants are defined in the BPXYCONS macro. (See BPXYCONS — Constants used by services.)

Rlimit
Supplied parameter
Type:
Structure
Length:
The length of the rlimit structure

The name of an rlimit structure in which the hard (maximum) and soft (current) limit values for the resource that is identified by the resource parameter are to be placed. Macro BPXYRLIM defines the rlimit structure. (See BPXYRLIM — Map the rlimit, rusage, and timeval structures.) Each limit value contains two fullwords. For all resources except RLIMIT_FSIZE, the upper fullword for each limit value is set to zero before returning to the caller.

Return_value
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the getrlimit service returns a value of zero if it is successful, and -1 if it is not successful.

Return_code
Returned parameter
Type:
Integer
Length:
Fullword
The name of a fullword in which the getrlimit service stores the return code. The getrlimit service returns Return_code only if Return_value is -1. For a complete list of possible return code values, see z/OS UNIX System Services Messages and Codes. The getrlimit service can return one of the following values in the Return_code parameter:
Return_code Explanation
EINVAL An incorrect resource was specified. The following reason code can accompany the return code: JrInvalidResource.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the getrlimit service stores the reason code. The getrlimit service returns Reason_code only if Return_value is -1. Reason_code further qualifies the Return_code value. For the reason codes, see z/OS UNIX System Services Messages and Codes.

Related services

Characteristics and restrictions

The current high-memory limit that is returned in RLIM_CUR_DW is the exact current memory limit. When the MEMLIMIT value is set by SMF, the maximum number of bytes that can be returned in RLIM_MAX_DW is X'FFFFFFFF00000000'. When the MEMLIMIT value is set by a z/OS UNIX service, the highest value that is supported is 16383 petabytes, or X'FFFC00000000000000'. It is therefore possible for the current MEMLIMIT to be larger than the maximum MEMLIMIT supported by z/OS UNIX System Services.

Examples

For an example using this callable service, see BPX1GRL (getrlimit) example.