]>
Commit | Line | Data |
---|---|---|
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 |
22 | core \- core dump file | |
23 | .SH DESCRIPTION | |
c13182ef | 24 | The default action of certain signals is to cause a process to terminate |
0be6f5cc MK |
25 | and produce a |
26 | .IR "core dump file" , | |
c13182ef | 27 | a disk file containing an image of the process's memory at |
0be6f5cc MK |
28 | the time of termination. |
29 | A list of the signals which cause a process to dump core can be found in | |
30 | .BR signal (7). | |
31 | ||
53cd945e | 32 | A process can set its soft |
0be6f5cc | 33 | .BR RLIMIT_CORE |
c13182ef | 34 | resource limit to place an upper limit on the size of the core dump file |
0be6f5cc MK |
35 | that will be produced if it receives a "core dump" signal; see |
36 | .BR getrlimit (2) | |
37 | for details. | |
38 | ||
c13182ef | 39 | There are various circumstances in which a core dump file is |
0be6f5cc MK |
40 | not produced: |
41 | .IP * | |
67ed0e4b | 42 | The process does not have permission to write the core file. |
c13182ef | 43 | (By default the core file is called |
67ed0e4b | 44 | .IR core , |
c13182ef | 45 | and is created in the current working directory. |
67ed0e4b | 46 | See below for details on naming.) |
c13182ef MK |
47 | Writing the core file will fail if the directory in which |
48 | it is to be created is non-writable, | |
49 | or if a file with the same name exists and | |
67ed0e4b | 50 | is not writable |
c13182ef | 51 | or is not a regular file |
67ed0e4b | 52 | (e.g., it is a directory or a symbolic link). |
0be6f5cc | 53 | .IP * |
c13182ef MK |
54 | A (writable, regular) file with the same name as would be used for the |
55 | core dump already exists, but there is more than one hard link to that | |
10cd859a MK |
56 | file. |
57 | .IP * | |
c13182ef | 58 | The file system where the core dump file would be created is full; |
460e6363 | 59 | or has run out of inodes; or is mounted read only; |
10cd859a MK |
60 | or the user has reached their quota for the file system. |
61 | .IP * | |
c13182ef | 62 | The directory in which the core dump file is to be created does |
67ed0e4b | 63 | not exist. |
0be6f5cc MK |
64 | .IP * |
65 | .B RLIMIT_CORE | |
c13182ef | 66 | or |
0be6f5cc | 67 | .B RLIMIT_FSIZE |
53cd945e MK |
68 | resource limits for a process are set to zero (see |
69 | .BR getrlimit (2)). | |
0be6f5cc | 70 | .IP * |
c13182ef | 71 | The binary being executed by the process does not have read |
0be6f5cc MK |
72 | permission enabled. |
73 | .IP * | |
74 | The process is executing a set-user-ID (set-group-ID) program | |
c13182ef | 75 | that is owned by a user (group) other than the real user (group) |
0be6f5cc MK |
76 | ID of the process. |
77 | (However, see the description of the | |
78 | .BR prctl (2) | |
79 | .B PR_SET_DUMPABLE | |
80 | operation, and the description of the | |
81 | .I /proc/sys/fs/suid_dumpable | |
82 | file in | |
83 | .BR proc (5).) | |
84 | .SS Naming of core dump files | |
c13182ef | 85 | By default, a core dump file is named |
0be6f5cc | 86 | .IR core , |
c13182ef | 87 | but the |
0be6f5cc MK |
88 | .I /proc/sys/kernel/core_pattern |
89 | file | |
10cd859a | 90 | (since Linux 2.6 and 2.4.21) |
0be6f5cc MK |
91 | can be set to define a template that is used to name core dump files. |
92 | The template can contain % specifiers which are substituted | |
93 | by 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 |
106 | A single % at the end of the template is dropped from the |
107 | core filename, as is the combination of a % followed by any | |
0be6f5cc MK |
108 | character other than those listed above. |
109 | All other characters in the template become a literal | |
110 | part of the core filename. | |
928410b4 | 111 | The template may include '/' characters, which are interpreted |
0be6f5cc MK |
112 | as delimiters for directory names. |
113 | The maximum size of the resulting core filename is 64 bytes. | |
114 | The default value in this file is "core". | |
115 | For backward compatibility, if | |
116 | .I /proc/sys/kernel/core_pattern | |
117 | does not include "%p" and | |
118 | .I /proc/sys/kernel/core_uses_pid | |
119 | (see below) | |
120 | is non-zero, then .PID will be appended to the core filename. | |
121 | ||
10cd859a MK |
122 | Since version 2.4, Linux has also provided |
123 | a more primitive method of controlling | |
0be6f5cc MK |
124 | the name of the core dump file. |
125 | If the | |
126 | .I /proc/sys/kernel/core_uses_pid | |
127 | file contains the value 0, then a core dump file is simply named | |
128 | .IR core . | |
129 | If this file contains a non-zero value, then the core dump file includes | |
130 | the process ID in a name of the form | |
131 | .IR core.PID . | |
132 | .SH NOTES | |
c13182ef | 133 | The |
0be6f5cc MK |
134 | .BR gdb (1) |
135 | .I gcore | |
136 | command can be used to obtain a core dump of a running process. | |
5ddfb8c7 MK |
137 | |
138 | If a multithreaded process (or, more precisely, a process that | |
139 | shares its memory with another process by being created with the | |
140 | .B CLONE_VM | |
141 | flag of | |
142 | .BR clone (2)) | |
c13182ef | 143 | dumps core, then the process ID is always appended to the core filename, |
d216b211 MK |
144 | unless the process ID was already included elsewhere in the |
145 | filename 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, |
148 | where 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) |