2

Is there a way to change the core filename format per session instead of for the entire machine?
On Linux the only way I can find is using sysctl as root:

sudo /sbin/sysctl -w "kernel.core_pattern=core-%H-%N-%P"

On Solaris same problem with root

coreadm -g core-%n-%f-%p

But unfortunately both these commands change the system permanently for all users, which I wish to avoid.

What I want is to be able to put a command in my .bashrc and as a non priv user have my core files be placed and named where I want them.

EDIT:

Just found out you can do this in solaris with

coreadm -p core-%n-%f-%p $$

Does anyone know about Linux?

1 Answer 1

2

On Linux, as far as I can tell, the core file name pattern is a global kernel setting.

The core file name is determined by format_corename in fs/exec.c. It is computed from the corename variable, which is set only through the kernel.core_pattern sysctl.

But maybe the behavior you want can be obtained by setting the core pattern to |/path/to/foo %h %p, which causes the core file contents to be piped into the /path/to/foo executable. Note that what follows the pipe is split into words at spaces.

1
  • Did the |/path/to/foo %h %p thing work? May 2, 2014 at 18:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .