1 .\" Copyright (c) 2006 by Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .TH CORE 5 2006-04-03 "Linux" "Linux Programmer's Manual"
25 core \- core dump file
27 The default action of certain signals is to cause a process to terminate
29 .IR "core dump file" ,
30 a disk file containing an image of the process's memory at
31 the time of termination.
32 A list of the signals which cause a process to dump core can be found in
35 A process can set its soft
37 resource limit to place an upper limit on the size of the core dump file
38 that will be produced if it receives a "core dump" signal; see
42 There are various circumstances in which a core dump file is
45 The process does not have permission to write the core file.
46 (By default the core file is called
48 and is created in the current working directory.
49 See below for details on naming.)
50 Writing the core file will fail if the directory in which
51 it is to be created is non-writable,
52 or if a file with the same name exists and
54 or is not a regular file
55 (e.g., it is a directory or a symbolic link).
57 A (writable, regular) file with the same name as would be used for the
58 core dump already exists, but there is more than one hard link to that
61 The file system where the core dump file would be created is full;
62 or has run out of inodes; or is mounted read-only;
63 or the user has reached their quota for the file system.
65 The directory in which the core dump file is to be created does
71 resource limits for a process are set to zero (see
74 The binary being executed by the process does not have read
77 The process is executing a set-user-ID (set-group-ID) program
78 that is owned by a user (group) other than the real user (group)
80 (However, see the description of the
83 operation, and the description of the
84 .I /proc/sys/fs/suid_dumpable
87 .SS Naming of core dump files
88 By default, a core dump file is named
91 .I /proc/sys/kernel/core_pattern
93 (since Linux 2.6 and 2.4.21)
94 can be set to define a template that is used to name core dump files.
95 The template can contain % specifiers which are substituted
96 by the following values when a core file is created:
99 %% A single % character
100 %p PID of dumped process
101 %u real UID of dumped process
102 %g real GID of dumped process
103 %s number of signal causing dump
104 %t time of dump (seconds since 0:00h, 1 Jan 1970)
105 %h hostname (same as 'nodename' returned by \fBuname\fP(2))
106 %e executable filename
109 A single % at the end of the template is dropped from the
110 core filename, as is the combination of a % followed by any
111 character other than those listed above.
112 All other characters in the template become a literal
113 part of the core filename.
114 The template may include \'/\' characters, which are interpreted
115 as delimiters for directory names.
116 The maximum size of the resulting core filename is 64 bytes.
117 The default value in this file is "core".
118 For backward compatibility, if
119 .I /proc/sys/kernel/core_pattern
120 does not include "%p" and
121 .I /proc/sys/kernel/core_uses_pid
123 is non-zero, then .PID will be appended to the core filename.
125 Since version 2.4, Linux has also provided
126 a more primitive method of controlling
127 the name of the core dump file.
129 .I /proc/sys/kernel/core_uses_pid
130 file contains the value 0, then a core dump file is simply named
132 If this file contains a non-zero value, then the core dump file includes
133 the process ID in a name of the form
139 command can be used to obtain a core dump of a running process.
141 If a multithreaded process (or, more precisely, a process that
142 shares its memory with another process by being created with the
146 dumps core, then the process ID is always appended to the core filename,
147 unless the process ID was already included elsewhere in the
148 filename via a %p specification in
149 .IR /proc/sys/kernel/core_pattern .
150 (This is primarily useful when employing the LinuxThreads implementation,
151 where each thread of a process has a different PID.)
152 .\" Always including the PID in the name of the core file made
153 .\" sense for LinuxThreads, where each thread had a unique PID,
154 .\" but doesn't seem to serve any purpose with NPTL, where all the
155 .\" threads in a process share the same PID (as POSIX.1 requires).
156 .\" Probably the behavior is maintained so that applications using
157 .\" LinuxThreads continue appending the PID (the kernel has no easy
158 .\" way of telling which threading implementation the userspace
159 .\" application is using). -- mtk, April 2006