1CORE(5)                    Linux Programmer's Manual                   CORE(5)
2
3
4

NAME

6       core - core dump file
7

DESCRIPTION

9       The  default  action of certain signals is to cause a process to termi‐
10       nate and produce a core dump file, a disk file containing an  image  of
11       the process's memory at the time of termination.  A list of the signals
12       which cause a process to dump core can be found in signal(7).
13
14       A process can set its soft RLIMIT_CORE resource limit to place an upper
15       limit  on  the  size  of the core dump file that will be produced if it
16       receives a "core dump" signal; see getrlimit(2) for details.
17
18       There are various circumstances in which a core dump file is  not  pro‐
19       duced:
20
21       *      The  process  does  not  have permission to write the core file.
22              (By default the core file is called core, and is created in  the
23              current  working  directory.   See below for details on naming.)
24              Writing the core file will fail if the directory in which it  is
25              to  be  created is non-writable, or if a file with the same name
26              exists and is not writable or is not a regular file (e.g., it is
27              a directory or a symbolic link).
28
29       *      A  (writable,  regular) file with the same name as would be used
30              for the core dump already exists, but there  is  more  than  one
31              hard link to that file.
32
33       *      The  file  system  where  the core dump file would be created is
34              full; or has run out of i-nodes; or is mounted read only; or the
35              user has reached their quota for the file system.
36
37       *      The  directory in which the core dump file is to be created does
38              not exist.
39
40       *      RLIMIT_CORE or RLIMIT_FSIZE resource limits for  a  process  are
41              set to zero (see getrlimit(2)).
42
43       *      The binary being executed by the process does not have read per‐
44              mission enabled.
45
46       *      The process is executing a  set-user-ID  (set-group-ID)  program
47              that is owned by a user (group) other than the real user (group)
48              ID of  the  process.   (However,  see  the  description  of  the
49              prctl(2)  PR_SET_DUMPABLE  operation, and the description of the
50              /proc/sys/fs/suid_dumpable file in proc(5).)
51
52   Naming of core dump files
53       By default, a core dump file is  named  core,  but  the  /proc/sys/ker‐
54       nel/core_pattern file (since Linux 2.6 and 2.4.21) can be set to define
55       a template that is used to name core dump files.  The template can con‐
56       tain  % specifiers which are substituted by the following values when a
57       core file is created:
58
59         %%  A single % character
60         %p  PID of dumped process
61         %u  real UID of dumped process
62         %g  real GID of dumped process
63         %s  number of signal causing dump
64         %t  time of dump (seconds since 0:00h, 1 Jan 1970)
65         %h  hostname (same as 'nodename' returned by uname(2))
66         %e  executable filename
67
68       A single % at the end of the template is dropped from  the  core  file‐
69       name, as is the combination of a % followed by any character other than
70       those listed above.  All other characters in the template become a lit‐
71       eral  part  of the core filename.  The template may include `/' charac‐
72       ters, which are interpreted as delimiters  for  directory  names.   The
73       maximum  size  of the resulting core filename is 64 bytes.  The default
74       value  in  this  file  is  "core".   For  backward  compatibility,   if
75       /proc/sys/kernel/core_pattern  does not include "%p" and /proc/sys/ker‐
76       nel/core_uses_pid (see below) is non-zero, then .PID will  be  appended
77       to the core filename.
78
79       Since  version  2.4, Linux has also provided a more primitive method of
80       controlling the name of the core  dump  file.   If  the  /proc/sys/ker‐
81       nel/core_uses_pid  file  contains the value 0, then a core dump file is
82       simply named core.  If this file contains a non-zero  value,  then  the
83       core dump file includes the process ID in a name of the form core.PID.
84

NOTES

86       The gdb(1) gcore command can be used to obtain a core dump of a running
87       process.
88
89       If a multithreaded process (or, more precisely, a process  that  shares
90       its memory with another process by being created with the CLONE_VM flag
91       of clone(2)) dumps core, then the process ID is always appended to  the
92       core  filename, unless the process ID was already included elsewhere in
93       the filename via a %p specification in /proc/sys/kernel/core_pattern.
94

SEE ALSO

96       gdb(1), getrlimit(2), prctl(2),  sigaction(2),  elf(5),  proc(5),  sig‐
97       nal(7)
98
99
100
101Linux 2.6.16                      2006-04-03                           CORE(5)
Impressum