Chapter Contents

Previous

Next
getrlimit

getrlimit



Obtain UNIX System Services Resource Limits

Portability: UNIX compatible


SYNOPSIS
DESCRIPTION
RETURN VALUE
USAGE NOTES
RELATED FUNCTIONS


SYNOPSIS

#include <sys/resource.h>
int getrlimit(int resource, 
              struct rlimit *info);


DESCRIPTION

The getrlimitgetrlimit function determines the resource limits for the calling process. The limits are expressed as a pair of integers, a soft limit and a hard limit. The soft limit controls the amount of the resource the program is actually allowed to consume, while the hard limit specifies an upper bound on the soft limit. The soft limit can be raised up to the hard limit value, but the hard limit can only be raised by a privileged (superuser) caller.

The info argument is a pointer to a structure of type struct rlimit, into which will be stored the defined limits. The structure contains the following fields:
rlim_cur the current (i.e., soft) limit
rlim_max the maximum limit

The resource argument defines the resource to which the limit applies. It should be specified as one of the symbolic values defined below.

RLIMIT_AS
The maximum size in bytes of the address space for this process.

RLIMIT_CORE
The maximum size in bytes of an UNIX System Services memory dump (core file) for this process.

RLIMIT_CPU
The maximum CPU time in seconds allowed for this address space.

RLIMIT_DATA
The maximum amount of memory available for data allocation using malloc or calloc. This limit is not enforced under UNIX System Services OS/390, and an attempt to set the limit lower than RLIM_INFINITY will be rejected.

RLIMIT_FSIZE
The maximum file size in bytes allowed for this process. The limit applies only to UNIX System Services HFS files, not to standard OS/390 data sets.

RLIMIT_NOFILE
The maximum number of file descriptors the process may have open.

RLIMIT_STACK
The maximum amount of memory available for stack allocation. This limit is not enforced under UNIX System Services OS/390, and an attempt to set the limit lower than RLIM_INFINITY will be rejected.


RETURN VALUE

getrlimit returns 0 if successful, or -1 if unsuccessful.


USAGE NOTES

The getrlimit function can only be used with MVS 5.2.2 or a later release.

Note:   Resource limits are inherited from the parent process when fork or exec is used.  [cautionend]


RELATED FUNCTIONS

setrlimit


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.