[英]Is there anyway to find the PID of parent process without using getppid?
我知道 PCB 是一个数据结构,其中包括父进程 id(pPID)、进程 id(PID)、指针等。有没有办法在不使用 getppid 函数的情况下找到父进程的 PID?
The fields of /proc/self/stat
(as documented in proc(5) ) include PPID. /proc/self/stat
的字段(如proc(5) 中所述)包括 PPID。 Take care in parsing as comm
may contain spaces and other unusual characters.解析时要小心,因为
comm
可能包含空格和其他不寻常的字符。
(But I second @JohnZwinck's comment. Why?) (但我支持@JohnZwinck 的评论。为什么?)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.