CORE(5) Linux Programmer s Manual CORE(5)

NAME core - core dump file

DESCRIPTION The default action of certain signals is to cause a process to termi- nate and produce a core dump file, a disk file containing an image of the processs memory at the time of termination. A list of the signals which cause a process to dump core can be found in signal(7).

A process can set its soft RLIMIT_CORE resource limit to place an upper limit on the size of the core dump file that will be produced if it receives a "core dump" signal; see getrlimit(2) for details.

There are various circumstances in which a core dump file is not pro- duced:

* The process does not have permission to write the core file. (By default the core file is called core, and is created in the current working directory. See below for details on naming.) Writing the core file will fail if the directory in which it is to be created is non-writable, or if a file with the same name exists and is not writable or is not a regular file (e.g., it is a directory or a symbolic link).

* The directory in which the core dump file is to be created does not exist.

* RLIMIT_CORE or RLIMIT_FSIZE resource limits for a process are set to zero (see getrlimit(2)).

* The binary being executed by the process does not have read per- mission enabled.

* The process is executing a set-user-ID (set-group-ID) program that is owned by a user (group) other than the real user (group) ID of the process. (However, see the description of the prctl(2) PR_SET_DUMPABLE operation, and the description of the /proc/sys/fs/suid_dumpable file in proc(5).)

Naming of core dump files By default, a core dump file is named core, but the /proc/sys/ker- nel/core_pattern file (new in Linux 2.5) can be set to define a tem- plate that is used to name core dump files. The template can contain % specifiers which are substituted by the following values when a core file is created:

%% A single % character %p PID of dumped process %u real UID of dumped process %g real GID of dumped process %s number of signal causing dump %t time of dump (seconds since 0:00h, 1 Jan 1970) %h hostname (same as nodename returned by uname(2)) %e executable filename

A single % at the end of the template is dropped from the core file- name, as is the combination of a % followed by any character other than those listed above. All other characters in the template become a lit- eral part of the core filename. The template may include / charac- ters, which are interpreted as delimiters for directory names. The maximum size of the resulting core filename is 64 bytes. The default value in this file is "core". For backward compatibility, if /proc/sys/kernel/core_pattern does not include "%p" and /proc/sys/ker- nel/core_uses_pid (see below) is non-zero, then .PID will be appended to the core filename.

Linux 2.4 does not provide /proc/sys/kernel/core_pattern, but does pro- vide a more primitive method of controlling the name of the core dump file. If the /proc/sys/kernel/core_uses_pid file contains the value 0, then a core dump file is simply named core. If this file contains a non-zero value, then the core dump file includes the process ID in a name of the form core.PID.

NOTES The gdb(1) gcore command can be used to obtain a core dump of a running process.

If a multithreaded process (or, more precisely, a process that shares its memory with another process by being created with the CLONE_VM flag of clone(2)) dumps core, then the process ID is always appended to the core filename, unless the process ID was already included elsewhere in the filename via a %p specification in /proc/sys/kernel/core_pattern.

SEE ALSO gdb(1), getrlimit(2), prctl(2), sigaction(2), elf(5), proc(5), sig- nal(7)

Linux 2.6.16 2006-04-03 CORE(5)