【问题标题】:Can the parent process know if the child is coredumping父进程能否知道子进程是否在进行核心转储
【发布时间】:2015-04-02 18:17:36
【问题描述】:

据我了解,在 Linux 中,在父进程中,等待调用只有在子进程死亡时才会返回。如果一个孩子决定转储核心,等待只会在核心转储发生后返回。

Linux中是否有办法让父母知道孩子是否在转储核心,如果是,则采取其他行动(一些事件发布),而另一方面,孩子可以继续转储核心。也就是说,有没有办法让孩子或内核在开始转储核心之前通知父母,它已经死了,现在将转储核心?

谢谢

【问题讨论】:

    标签: linux process linux-kernel coredump


    【解决方案1】:

    人核心:

    将核心转储传送到程序

     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
    

    这意味着您可以配置一些程序来接受核心转储并通知感兴趣的人。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多