posix_getrlimit
Description
The posix_getrlimit of POSIX for PHP returns information about system resource limits.
Syntax
posix_getrlimit( ?int $resource = null ): array|false
Parameters
resource
If null all resource limits will be fetched. Otherwise, the only limits of the resource type provided will be returned.
Return
Returns an associative array of elements for each soft and hard limit that is defined on success. Returns false on failure.
Name | 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. |
data | The maximum size of the data segment for the process, in bytes. |
stack | The maximum size of the process stack, in bytes. |
totalmem | The maximum size of the memory of the process, 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. |
Examples
1 · void
<? $return = posix_getrlimit(); print_r($return);
Array ( [soft core] => 0 [hard core] => unlimited [soft data] => unlimited [hard data] => unlimited [soft stack] => 8388608 [hard stack] => unlimited [soft totalmem] => unlimited [hard totalmem] => unlimited [soft rss] => unlimited [hard rss] => unlimited [soft maxproc] => unlimited [hard maxproc] => unlimited [soft memlock] => unlimited [hard memlock] => unlimited [soft cpu] => unlimited [hard cpu] => unlimited [soft filesize] => unlimited [hard filesize] => unlimited [soft openfiles] => 1024 [hard openfiles] => 1024 )
2 · resource · POSIX_RLIMIT_CORE
<? $resource = POSIX_RLIMIT_CORE; $return = posix_getrlimit($resource); print_r($return);
Array ( [0] => 0 [1] => unlimited )
3 · resource · POSIX_RLIMIT_DATA
<? $resource = POSIX_RLIMIT_DATA; $return = posix_getrlimit($resource); print_r($return);
Array ( [0] => unlimited [1] => unlimited )
4 · resource · POSIX_RLIMIT_STACK
<? $resource = POSIX_RLIMIT_STACK; $return = posix_getrlimit($resource); print_r($return);
Array ( [0] => 8388608 [1] => unlimited )
5 · resource · POSIX_RLIMIT_AS
<? $resource = POSIX_RLIMIT_AS; $return = posix_getrlimit($resource); print_r($return);
Array ( [0] => unlimited [1] => unlimited )
6 · resource · POSIX_RLIMIT_RSS
<? $resource = POSIX_RLIMIT_RSS; $return = posix_getrlimit($resource); print_r($return);
Array ( [0] => unlimited [1] => unlimited )
7 · resource · POSIX_RLIMIT_NPROC
<? $resource = POSIX_RLIMIT_NPROC; $return = posix_getrlimit($resource); print_r($return);
Array ( [0] => unlimited [1] => unlimited )
8 · resource · POSIX_RLIMIT_MEMLOCK
<? $resource = POSIX_RLIMIT_MEMLOCK; $return = posix_getrlimit($resource); print_r($return);
Array ( [0] => unlimited [1] => unlimited )
9 · resource · POSIX_RLIMIT_CPU
<? $resource = POSIX_RLIMIT_CPU; $return = posix_getrlimit($resource); print_r($return);
Array ( [0] => unlimited [1] => unlimited )
10 · resource · POSIX_RLIMIT_FSIZE
<? $resource = POSIX_RLIMIT_FSIZE; $return = posix_getrlimit($resource); print_r($return);
Array ( [0] => unlimited [1] => unlimited )
11 · resource · POSIX_RLIMIT_NOFILE
<? $resource = POSIX_RLIMIT_NOFILE; $return = posix_getrlimit($resource); print_r($return);
Array ( [0] => 1024 [1] => 1024 )
Links
POSIX
- posix_access
- posix_ctermid
- posix_eaccess
- posix_errno
- posix_fpathconf
- posix_get_last_error
- posix_getcwd
- posix_getegid
- posix_geteuid
- posix_getgid
- posix_getgrgid
- posix_getgrnam
- posix_getgroups
- posix_getlogin
- posix_getpgid
- posix_getpgrp
- posix_getpid
- posix_getppid
- posix_getpwnam
- posix_getpwuid
- posix_getsid
- posix_getuid
- posix_initgroups
- posix_isatty
- posix_kill
- posix_mkfifo
- posix_mknod
- posix_pathconf
- posix_setegid
- posix_seteuid
- posix_setgid
- posix_setpgid
- posix_setrlimit
- posix_setsid
- posix_setuid
- posix_strerror
- posix_sysconf
- posix_times
- posix_ttyname
- posix_uname