posix_getrlimi() returns an array of information about the current resource's soft and hard limits.
Each resource has an associated soft and hard limit. The soft limit is the value that the kernel enforces for the corresponding resrource. The hard limit acts as a cieling for the soft limit. An unprivileged process may only set its soft limit to a value from 0 to the hard limit, and irreversibly lowers its hard limit.
Returns an associative array of elements for each limit that is defined. Each limit has a soft and a hard limit.
Table 1. List of possible limits returned
|Limit name||Limit description|
|core||The maximum size of the core file. When 0, not core files are created. When core files are larger than this size, they will be truncated at this size.|
|totalmem||The maximum size of the memory of the process, in bytes.|
|virtualmem||The maximum size of the virtual memory for the process, in bytes.|
|data||The maximum size of the data segment for the process, in bytes.|
|stack||The maximum size of the process stack, in bytes.|
|rss||The maximum number of virtual pages resident in RAM|
|maxproc||The maximum number of processes that can be created for the real user ID of the calling process.|
|memlock||The maximum number of bytes of memory that may be locked into RAM.|
|cpu||The amount of time the process is allowed to use the CPU.|
|filesize||The maximum size of the data segment for the process, in bytes.|
|openfiles||One more than the maximum number of open file descriptors.|
This is a not POSIX function, but is common on BSD and System V systems. If your system does not support this function, then it will not be included at compile time. You may check if this function exists with function_exists().
Example 1. Example use of posix_getrlimit()
The above example will output something similar to: