I am trying to provide support for coredump file generation from my rootfs ,I have modified /etc/limits file with "ulimit -c unlimited" command and "* hard core -1" ,Now when I give kill -6 $$ ,expecting core file generation but to get this core file have to run ulimit -c unlimited explicitly .
But I want it to happen automatically , no need to run ulimit -c unlimited it again in shell.
Can anybody tell me what changes I have to make for the same to happen
From a program you can use
setrlimit(RLIMIT_CORE, ...)
to set the core file's maximum size. To specify an infinite size passRLIM_INFINITY
.For details on this please read here: http://manpages.debian.net/cgi-bin/man.cgi?query=getrlimit&sektion=2
Using the
sysctl
command you can doto have the kernel create cores named
core.<pid>
in/var/core
.Adding
kernel.core_pattern=/var/core/core.%p
to/etc/sysctl.conf
makes it permanent. (runsysctl -p
to process your changes to/etc/sysctl.conf
)Besides
%p
(for the process id) there are other placeholders as follows (taken from here):