linux - 父进程能否知道子进程是否在coredumping

标签 linux process linux-kernel coredump

在 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/

相关文章:

java - 使用运行时从 Java 运行 smbclient 命令

linux - 创建共享对象时,不能使用针对符号 _ZTISt13runtime_error@@GLIBCXX_3.4 的重定位 R_X86_64_PC32;使用 -fPIC 重新编译

java - Android动态服务数量

php - 激活 pcntl_fork() ubuntu xampp

linux - 主要和堆栈对齐

c++ - Linux 上的 MySQL++ SSL 支持

linux - 使用 C++ 以编程方式监视进程状态

c - 如何使用系统调用编译C文件

linux - 重启RHEL服务器后,chef-server无法启动

linux - 中断发生时,或者进程调度时,是否需要保存标志寄存器?