Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading