]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man5/core.5
Change mtk's email address
[thirdparty/man-pages.git] / man5 / core.5
CommitLineData
c11b1abf 1.\" Copyright (c) 2006 by Michael Kerrisk <mtk.manpages@gmail.com>
0be6f5cc
MK
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.
16.\"
17.\" Formatted or processed versions of this manual, if unaccompanied by
18.\" the source, must acknowledge the copyright and authors of this work.
19.\"
d9343c5c 20.TH CORE 5 2006-04-03 "Linux" "Linux Programmer's Manual"
0be6f5cc
MK
21.SH NAME
22core \- core dump file
23.SH DESCRIPTION
c13182ef 24The default action of certain signals is to cause a process to terminate
0be6f5cc
MK
25and produce a
26.IR "core dump file" ,
c13182ef 27a disk file containing an image of the process's memory at
0be6f5cc
MK
28the time of termination.
29A list of the signals which cause a process to dump core can be found in
30.BR signal (7).
31
53cd945e 32A process can set its soft
0be6f5cc 33.BR RLIMIT_CORE
c13182ef 34resource limit to place an upper limit on the size of the core dump file
0be6f5cc
MK
35that will be produced if it receives a "core dump" signal; see
36.BR getrlimit (2)
37for details.
38
c13182ef 39There are various circumstances in which a core dump file is
0be6f5cc
MK
40not produced:
41.IP *
67ed0e4b 42The process does not have permission to write the core file.
c13182ef 43(By default the core file is called
67ed0e4b 44.IR core ,
c13182ef 45and is created in the current working directory.
67ed0e4b 46See below for details on naming.)
c13182ef
MK
47Writing the core file will fail if the directory in which
48it is to be created is non-writable,
49or if a file with the same name exists and
67ed0e4b 50is not writable
c13182ef 51or is not a regular file
67ed0e4b 52(e.g., it is a directory or a symbolic link).
0be6f5cc 53.IP *
c13182ef
MK
54A (writable, regular) file with the same name as would be used for the
55core dump already exists, but there is more than one hard link to that
10cd859a
MK
56file.
57.IP *
c13182ef 58The file system where the core dump file would be created is full;
460e6363 59or has run out of inodes; or is mounted read only;
10cd859a
MK
60or the user has reached their quota for the file system.
61.IP *
c13182ef 62The directory in which the core dump file is to be created does
67ed0e4b 63not exist.
0be6f5cc
MK
64.IP *
65.B RLIMIT_CORE
c13182ef 66or
0be6f5cc 67.B RLIMIT_FSIZE
53cd945e
MK
68resource limits for a process are set to zero (see
69.BR getrlimit (2)).
0be6f5cc 70.IP *
c13182ef 71The binary being executed by the process does not have read
0be6f5cc
MK
72permission enabled.
73.IP *
74The process is executing a set-user-ID (set-group-ID) program
c13182ef 75that is owned by a user (group) other than the real user (group)
0be6f5cc
MK
76ID of the process.
77(However, see the description of the
78.BR prctl (2)
79.B PR_SET_DUMPABLE
80operation, and the description of the
81.I /proc/sys/fs/suid_dumpable
82file in
83.BR proc (5).)
84.SS Naming of core dump files
c13182ef 85By default, a core dump file is named
0be6f5cc 86.IR core ,
c13182ef 87but the
0be6f5cc
MK
88.I /proc/sys/kernel/core_pattern
89file
10cd859a 90(since Linux 2.6 and 2.4.21)
0be6f5cc
MK
91can be set to define a template that is used to name core dump files.
92The template can contain % specifiers which are substituted
93by the following values when a core file is created:
94.nf
c13182ef 95
0be6f5cc
MK
96 %% A single % character
97 %p PID of dumped process
98 %u real UID of dumped process
99 %g real GID of dumped process
100 %s number of signal causing dump
101 %t time of dump (seconds since 0:00h, 1 Jan 1970)
102 %h hostname (same as 'nodename' returned by \fBuname\fP(2))
103 %e executable filename
c13182ef 104
0be6f5cc 105.fi
c13182ef
MK
106A single % at the end of the template is dropped from the
107core filename, as is the combination of a % followed by any
0be6f5cc
MK
108character other than those listed above.
109All other characters in the template become a literal
110part of the core filename.
928410b4 111The template may include '/' characters, which are interpreted
0be6f5cc
MK
112as delimiters for directory names.
113The maximum size of the resulting core filename is 64 bytes.
114The default value in this file is "core".
115For backward compatibility, if
116.I /proc/sys/kernel/core_pattern
117does not include "%p" and
118.I /proc/sys/kernel/core_uses_pid
119(see below)
120is non-zero, then .PID will be appended to the core filename.
121
10cd859a
MK
122Since version 2.4, Linux has also provided
123a more primitive method of controlling
0be6f5cc
MK
124the name of the core dump file.
125If the
126.I /proc/sys/kernel/core_uses_pid
127file contains the value 0, then a core dump file is simply named
128.IR core .
129If this file contains a non-zero value, then the core dump file includes
130the process ID in a name of the form
131.IR core.PID .
132.SH NOTES
c13182ef 133The
0be6f5cc
MK
134.BR gdb (1)
135.I gcore
136command can be used to obtain a core dump of a running process.
5ddfb8c7
MK
137
138If a multithreaded process (or, more precisely, a process that
139shares its memory with another process by being created with the
140.B CLONE_VM
141flag of
142.BR clone (2))
c13182ef 143dumps core, then the process ID is always appended to the core filename,
d216b211
MK
144unless the process ID was already included elsewhere in the
145filename via a %p specification in
5ddfb8c7 146.IR /proc/sys/kernel/core_pattern .
b8424e6a
MK
147(This is primarily useful when employing the LinuxThreads implementation,
148where each thread of a process has a different PID.)
4b47fc34
MK
149.\" Always including the PID in the name of the core file made
150.\" sense for LinuxThreads, where each thread had a unique PID,
905e99f2 151.\" but doesn't seem to serve any purpose with NPTL, where all the
c13182ef 152.\" threads in a process share the same PID (as POSIX.1 requires).
d9bfdb9c 153.\" Probably the behavior is maintained so that applications using
c13182ef
MK
154.\" LinuxThreads continue appending the PID (the kernel has no easy
155.\" way of telling which threading implementation the userspace
d216b211 156.\" application is using). -- mtk, April 2006
0be6f5cc
MK
157.SH SEE ALSO
158.BR gdb (1),
159.BR getrlimit (2),
160.BR prctl (2),
161.BR sigaction (2),
162.BR elf (5),
163.BR proc (5),
b8424e6a 164.BR pthreads (7),
0be6f5cc 165.BR signal (7)