简体   繁体   中英

core kernel pattern %e on Linux appends PID

According to documentation of core the %e in kernel pattern stands for 'The process or thread's comm value'. in addition the core comm value is defined as whatever /proc/[pid]/comm returns. However on my machine (CentOs) despite the kernel pattern is defined as core-%e and comm value returns only process name, PID is still appended to the core name. Why is this discrepancy between the documentation and actual behaviour?

[root@mde-segment-bouretskey dump]# cat /proc/sys/kernel/core_pattern
/tmp/dump/core-%e
[root@mde-segment-bouretskey dump]# ls /tmp/dump/core-*
/tmp/dump/core-a.out.42098  /tmp/dump/core-a.out.43097
[root@mde-segment-bouretskey dump]#

[root@mde-segment-bouretskey crashtest]# cat /proc/45301/comm
a.out

You need to set kernel.core_uses_pid=0 to avoid having the pid appended when %p is missing.

From core(5):

For backward compatibility, if /proc/sys/kernel/core_pattern does not include %p and /proc/sys/kernel/core_uses_pid (see below) is nonzero, then.PID will be appended to the core filename.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM