NAME | SYNOPSIS | API RESTRICTIONS | DESCRIPTION | PARAMETERS | EXTENDED DESCRIPTION | RETURN VALUES | ERRORS | ATTRIBUTES
#include <sys/time.h> #include <sys/resource.h> #include <sys/types.h>int getrlimit(int resource, struct rlimit * rlp);
The function or functions documented here may not be used safely in all application contexts with all APIs provided in the ChorusOS 5.0 product.
See API(5FEA) for details.
Limits on the consumption of system resources by the current actor may be obtained using the getrlimit() call, and set with the setrlimit() call.
getrlimit() and setrlimit() take the following resource parameters:
The largest file size, in bytes, that can be created.
The maximum number of open files for the process.
A resource limit is specified as a soft limit and a hard limit. When
a soft limit is exceeded, an actor is allowed to continue execution until
it reaches the hard limit or modifies its resource limit. The
rlimit
structure is used to specify the hard and soft limits on a resource.
For example:
struct rlimit { rlim_t rlim_cur; /* current (soft) limit */ rlim_t rlim_max; /* maximum value for rlim_cur */ };
Only trusted actors may raise the maximum limits. Other actors may only alter rlim_cur within the range from 0 to rlim_max , or lower rlim_max irreversibly.
An "infinite" value for a limit is defined as RLIM_INFINITY .
A return value of
0
indicates that the call
succeeded in changing or returning the resource limit. A return value of
-1
means that an error occurred, and an error code is stored
in the global location
errno
indicating one of the following
error conditons.
getrlimit() and setrlimit() fail if:
The address specified for rlp is invalid.
The limit specified for setrlimit() would raise the maximum value, and the caller is not a trusted actor.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
NAME | SYNOPSIS | API RESTRICTIONS | DESCRIPTION | PARAMETERS | EXTENDED DESCRIPTION | RETURN VALUES | ERRORS | ATTRIBUTES