在 Linux 中,据我了解,在父进程中,wait 调用只会在子进程死亡时返回。如果 child 决定转储核心,等待只会在核心转储发生后返回。
Linux中有没有办法让parent知道child是否在dumping core,如果是,则采取其他行动(一些Event publishing),而child可以在一旁继续dumping core。也就是说,在开始转储内核之前,有没有办法让子内核或内核通知父内核它已经死了,现在将转储内核?
谢谢
最佳答案
男核心:
Piping core dumps to a program
Since kernel 2.6.19, Linux supports an alternate syntax for the /proc/sys/kernel/core_pattern file. If the first character of this file is a pipe symbol (|), then the remainder of the line is interpreted as a program to be executed. Instead of being written to a disk file, the core dump is given as standard input to the program.
例子:
cat /proc/sys/kernel/core_pattern
|/usr/lib/systemd/systemd-coredump %p %u %g %s %t %e
这意味着您可以配置一些程序来接受核心转储并通知任何感兴趣的人。
关于linux - 父进程能否知道子进程是否在coredumping,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29419761/