man-pages/man5/core.5

165 lines
5.7 KiB
Groff
Raw Normal View History

2006-03-31 07:05:11 +00:00
.\" Copyright (c) 2006 by Michael Kerrisk <mtk-manpages@gmx.net>
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
2007-05-30 05:36:26 +00:00
.TH CORE 5 2006-04-03 "Linux" "Linux Programmer's Manual"
2006-03-31 07:05:11 +00:00
.SH NAME
core \- core dump file
.SH DESCRIPTION
The default action of certain signals is to cause a process to terminate
2006-03-31 07:05:11 +00:00
and produce a
.IR "core dump file" ,
a disk file containing an image of the process's memory at
2006-03-31 07:05:11 +00:00
the time of termination.
A list of the signals which cause a process to dump core can be found in
.BR signal (7).
2006-03-31 13:22:11 +00:00
A process can set its soft
2006-03-31 07:05:11 +00:00
.BR RLIMIT_CORE
resource limit to place an upper limit on the size of the core dump file
2006-03-31 07:05:11 +00:00
that will be produced if it receives a "core dump" signal; see
.BR getrlimit (2)
for details.
There are various circumstances in which a core dump file is
2006-03-31 07:05:11 +00:00
not produced:
.IP *
The process does not have permission to write the core file.
(By default the core file is called
.IR core ,
and is created in the current working directory.
See below for details on naming.)
Writing the core file will fail if the directory in which
it is to be created is non-writable,
or if a file with the same name exists and
is not writable
or is not a regular file
(e.g., it is a directory or a symbolic link).
2006-03-31 07:05:11 +00:00
.IP *
A (writable, regular) file with the same name as would be used for the
core dump already exists, but there is more than one hard link to that
file.
.IP *
The file system where the core dump file would be created is full;
2007-06-11 19:23:43 +00:00
or has run out of inodes; or is mounted read only;
or the user has reached their quota for the file system.
.IP *
The directory in which the core dump file is to be created does
not exist.
2006-03-31 07:05:11 +00:00
.IP *
.B RLIMIT_CORE
or
2006-03-31 07:05:11 +00:00
.B RLIMIT_FSIZE
2006-03-31 13:22:11 +00:00
resource limits for a process are set to zero (see
.BR getrlimit (2)).
2006-03-31 07:05:11 +00:00
.IP *
The binary being executed by the process does not have read
2006-03-31 07:05:11 +00:00
permission enabled.
.IP *
The process is executing a set-user-ID (set-group-ID) program
that is owned by a user (group) other than the real user (group)
2006-03-31 07:05:11 +00:00
ID of the process.
(However, see the description of the
.BR prctl (2)
.B PR_SET_DUMPABLE
operation, and the description of the
.I /proc/sys/fs/suid_dumpable
file in
.BR proc (5).)
.SS Naming of core dump files
By default, a core dump file is named
2006-03-31 07:05:11 +00:00
.IR core ,
but the
2006-03-31 07:05:11 +00:00
.I /proc/sys/kernel/core_pattern
file
(since Linux 2.6 and 2.4.21)
2006-03-31 07:05:11 +00:00
can be set to define a template that is used to name core dump files.
The template can contain % specifiers which are substituted
by the following values when a core file is created:
.nf
2006-03-31 07:05:11 +00:00
%% A single % character
%p PID of dumped process
%u real UID of dumped process
%g real GID of dumped process
%s number of signal causing dump
%t time of dump (seconds since 0:00h, 1 Jan 1970)
%h hostname (same as 'nodename' returned by \fBuname\fP(2))
%e executable filename
2006-03-31 07:05:11 +00:00
.fi
A single % at the end of the template is dropped from the
core filename, as is the combination of a % followed by any
2006-03-31 07:05:11 +00:00
character other than those listed above.
All other characters in the template become a literal
part of the core filename.
The template may include '/' characters, which are interpreted
2006-03-31 07:05:11 +00:00
as delimiters for directory names.
The maximum size of the resulting core filename is 64 bytes.
The default value in this file is "core".
For backward compatibility, if
.I /proc/sys/kernel/core_pattern
does not include "%p" and
.I /proc/sys/kernel/core_uses_pid
(see below)
is non-zero, then .PID will be appended to the core filename.
Since version 2.4, Linux has also provided
a more primitive method of controlling
2006-03-31 07:05:11 +00:00
the name of the core dump file.
If the
.I /proc/sys/kernel/core_uses_pid
file contains the value 0, then a core dump file is simply named
.IR core .
If this file contains a non-zero value, then the core dump file includes
the process ID in a name of the form
.IR core.PID .
.SH NOTES
The
2006-03-31 07:05:11 +00:00
.BR gdb (1)
.I gcore
command can be used to obtain a core dump of a running process.
If a multithreaded process (or, more precisely, a process that
shares its memory with another process by being created with the
.B CLONE_VM
flag of
.BR clone (2))
dumps core, then the process ID is always appended to the core filename,
2006-04-15 20:58:17 +00:00
unless the process ID was already included elsewhere in the
filename via a %p specification in
.IR /proc/sys/kernel/core_pattern .
2006-04-15 21:31:43 +00:00
.\" FIXME Is the following speculation correct? If it is, then
.\" it might be worth incorporating it into the text:
.\" Always including the PID in the name of the core file made
.\" sense for LinuxThreads, where each thread had a unique PID,
.\" but doesn't seem to server any purpose with NPTL, where all the
.\" threads in a process share the same PID (as POSIX.1 requires).
.\" Probably the behavior is maintained so that applications using
.\" LinuxThreads continue appending the PID (the kernel has no easy
.\" way of telling which threading implementation the userspace
2006-04-15 20:58:17 +00:00
.\" application is using). -- mtk, April 2006
2006-03-31 07:05:11 +00:00
.SH SEE ALSO
.BR gdb (1),
.BR getrlimit (2),
.BR prctl (2),
.BR sigaction (2),
.BR elf (5),
.BR proc (5),
.BR signal (7)