Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
SIGCHLD 只能被父进程捕获以监控子进程是否退出。但是我想写一个独立的程序来监控一些进程,如果它们退出,立即报告日志。
有没有我可以使用的编程方式,而不是使用 shell“ps”命令来监视进程名称/id,然后在死循环中查询?
您可以通过通常安装在 /proc 的 proc 伪文件系统监控进程活动。供参考使用: https ://www.kernel.org/doc/Documentation/filesystems/proc.txt