]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man5/core.5
Change use of quote characters to get better UTF-8 rendering.
[thirdparty/man-pages.git] / man5 / core.5
1 .\" Copyright (c) 2006 by Michael Kerrisk <mtk.manpages@gmail.com>
2 .\"
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.
6 .\"
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.
11 .\"
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
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .TH CORE 5 2006-04-03 "Linux" "Linux Programmer's Manual"
24 .SH NAME
25 core \- core dump file
26 .SH DESCRIPTION
27 The default action of certain signals is to cause a process to terminate
28 and produce a
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
33 .BR signal (7).
34
35 A process can set its soft
36 .B RLIMIT_CORE
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
39 .BR getrlimit (2)
40 for details.
41
42 There are various circumstances in which a core dump file is
43 not produced:
44 .IP * 3
45 The process does not have permission to write the core file.
46 (By default the core file is called
47 .IR core ,
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
53 is not writable
54 or is not a regular file
55 (e.g., it is a directory or a symbolic link).
56 .IP *
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
59 file.
60 .IP *
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.
64 .IP *
65 The directory in which the core dump file is to be created does
66 not exist.
67 .IP *
68 .B RLIMIT_CORE
69 or
70 .B RLIMIT_FSIZE
71 resource limits for a process are set to zero (see
72 .BR getrlimit (2)).
73 .IP *
74 The binary being executed by the process does not have read
75 permission enabled.
76 .IP *
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)
79 ID of the process.
80 (However, see the description of the
81 .BR prctl (2)
82 .B PR_SET_DUMPABLE
83 operation, and the description of the
84 .I /proc/sys/fs/suid_dumpable
85 file in
86 .BR proc (5).)
87 .SS Naming of core dump files
88 By default, a core dump file is named
89 .IR core ,
90 but the
91 .I /proc/sys/kernel/core_pattern
92 file
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:
97 .nf
98
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 \fInodename\fP returned by \fBuname\fP(2))
106 %e executable filename
107
108 .fi
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
122 (see below)
123 is non-zero, then .PID will be appended to the core filename.
124
125 Since version 2.4, Linux has also provided
126 a more primitive method of controlling
127 the name of the core dump file.
128 If the
129 .I /proc/sys/kernel/core_uses_pid
130 file contains the value 0, then a core dump file is simply named
131 .IR core .
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
134 .IR core.PID .
135 .SH NOTES
136 The
137 .BR gdb (1)
138 .I gcore
139 command can be used to obtain a core dump of a running process.
140
141 If a multithreaded process (or, more precisely, a process that
142 shares its memory with another process by being created with the
143 .B CLONE_VM
144 flag of
145 .BR clone (2))
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
160 .SH SEE ALSO
161 .BR gdb (1),
162 .BR getrlimit (2),
163 .BR prctl (2),
164 .BR sigaction (2),
165 .BR elf (5),
166 .BR proc (5),
167 .BR pthreads (7),
168 .BR signal (7)