posix_getrlimit() - posix函数(可移植操作系统接口)
posix_getrlimit()
(PHP 4, PHP 5, PHP 7)
Return info about system resource limits
说明
posix_getrlimit(void): arrayposix_getrlimit() 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 resource. The hard limit acts as a ceiling for the soft limit. An unprivileged process may only set its soft limit to a value from 0 to the hard limit, and irreversibly lower its hard limit.
返回值
Returns an associative array of elements for each limit that is defined. Each limit has a soft and a hard limit.
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. |
范例
Example use of posix_getrlimit()
以上例程的输出类似于:
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 )
参见
- man page GETRLIMIT(2)
posix_setrlimit()
Set system resource limits
The array returned (on a RH6.2 box) is: 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 = 2048 hard maxproc = 2048 soft memlock = unlimited hard memlock = unlimited soft cpu = unlimited hard cpu = unlimited soft filesize = unlimited hard filesize = unlimited soft openfiles = 1024 hard openfiles = 1024
鹏仔微信 15129739599 鹏仔QQ344225443 鹏仔前端 pjxi.com 共享博客 sharedbk.com
图片声明:本站部分配图来自网络。本站只作为美观性配图使用,无任何非法侵犯第三方意图,一切解释权归图片著作权方,本站不承担任何责任。如有恶意碰瓷者,必当奉陪到底严惩不贷!