略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: POSIX 函数

2024-11-15

POSIX 函数

参见

The section about Process Control Functions maybe of interest for you.

目录

add a noteadd a note

User Contributed Notes 2 notes

up
11
random832 at fastmail dot fm
15 years ago
That is not part of POSIX, those are only present as you listed on linux systems - some other systems have a /proc with different things in it (sometimes stuff that's symbolic links on linux will be hardlinks, textfiles on linux will be binary, or different files with different information) or none at all
up
-1
roberto at spadim dot com dot br
15 years ago
don't forget that in posix systems you can use /proc/$process_id/
files:
auxv
cmdline
cwd
environ
exe
fd
maps
mem
mounts
root
stat 
statm 
status 
task 
wchan

with it you can make somethings like:

$PPID=getmypid();
$pid=pcntl_fork();
if ($pid==0){
while(1){
if (strpos(file_get_contents("/proc/$PPID/cmdline"),'php')===false) echo "parent pid die";
}

}else{
// forked
}

with this you can use some libs that block signal or some bad signal handling or zombies process or anything you can think :)

官方地址:https://www.php.net/manual/en/ref.posix.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3