xref: /freebsd/share/man/man5/core.5 (revision 53d3620b6ac88e9fe76df361241b4e5c7e28918f)
1afe61c15SRodney W. Grimes.\" Copyright (c) 1980, 1991, 1993
2afe61c15SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
3afe61c15SRodney W. Grimes.\"
4afe61c15SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
5afe61c15SRodney W. Grimes.\" modification, are permitted provided that the following conditions
6afe61c15SRodney W. Grimes.\" are met:
7afe61c15SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
8afe61c15SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
9afe61c15SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
10afe61c15SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
11afe61c15SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
12afe61c15SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software
13afe61c15SRodney W. Grimes.\"    must display the following acknowledgement:
14afe61c15SRodney W. Grimes.\"	This product includes software developed by the University of
15afe61c15SRodney W. Grimes.\"	California, Berkeley and its contributors.
16afe61c15SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
17afe61c15SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
18afe61c15SRodney W. Grimes.\"    without specific prior written permission.
19afe61c15SRodney W. Grimes.\"
20afe61c15SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21afe61c15SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22afe61c15SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23afe61c15SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24afe61c15SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25afe61c15SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26afe61c15SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27afe61c15SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28afe61c15SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29afe61c15SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30afe61c15SRodney W. Grimes.\" SUCH DAMAGE.
31afe61c15SRodney W. Grimes.\"
32afe61c15SRodney W. Grimes.\"     @(#)core.5	8.3 (Berkeley) 12/11/93
337f3dea24SPeter Wemm.\" $FreeBSD$
34afe61c15SRodney W. Grimes.\"
35afe61c15SRodney W. Grimes.Dd December 11, 1993
36afe61c15SRodney W. Grimes.Dt CORE 5
373d45e180SRuslan Ermilov.Os
38afe61c15SRodney W. Grimes.Sh NAME
39afe61c15SRodney W. Grimes.Nm core
40afe61c15SRodney W. Grimes.Nd memory image file format
41afe61c15SRodney W. Grimes.Sh SYNOPSIS
4232eef9aeSRuslan Ermilov.In sys/param.h
43afe61c15SRodney W. Grimes.Sh DESCRIPTION
44afe61c15SRodney W. GrimesA small number of signals which cause abnormal termination of a process
45afe61c15SRodney W. Grimesalso cause a record of the process's in-core state to be written
46afe61c15SRodney W. Grimesto disk for later examination by one of the available debuggers.
47afe61c15SRodney W. Grimes(See
48afe61c15SRodney W. Grimes.Xr sigaction 2 . )
49aa81f3a9SJoerg WunschThis memory image is written to a file named by default
50afe61c15SRodney W. Grimes.Nm programname.core
51afe61c15SRodney W. Grimesin the working directory;
52afe61c15SRodney W. Grimesprovided the terminated process had write permission in the directory,
53afe61c15SRodney W. Grimesand provided the abnormality did not cause
54afe61c15SRodney W. Grimesa system crash.
55afe61c15SRodney W. Grimes(In this event, the decision to save the core file is arbitrary, see
56afe61c15SRodney W. Grimes.Xr savecore 8 . )
57afe61c15SRodney W. Grimes.Pp
58aa81f3a9SJoerg WunschThe maximum size of a core file is limited by
59afe61c15SRodney W. Grimes.Xr setrlimit 2 .
60afe61c15SRodney W. GrimesFiles which would be larger than the limit are not created.
61afe61c15SRodney W. Grimes.Pp
62aa81f3a9SJoerg WunschThe name of the file is controlled via the
63aa81f3a9SJoerg Wunsch.Xr sysctl 8
64aa81f3a9SJoerg Wunschvariable
65aa81f3a9SJoerg Wunsch.Va kern.corefile .
66aa81f3a9SJoerg WunschThe contents of this variable describes a filename to store
67aa81f3a9SJoerg Wunschthe core image to.  This filename can be absolute, or relative (which
68aa81f3a9SJoerg Wunschwill resolve to the current working directory of the program
69aa81f3a9SJoerg Wunschgenerating it).  Any sequence of
70aa81f3a9SJoerg Wunsch.Em \&%N
71aa81f3a9SJoerg Wunschin this filename template will be replaced by the process name,
72aa81f3a9SJoerg Wunsch.Em \&%P
73aa81f3a9SJoerg Wunschby the processes PID, and
74aa81f3a9SJoerg Wunsch.Em \&%U
75aa81f3a9SJoerg Wunschby the UID.  The name defaults to
76aa81f3a9SJoerg Wunsch.Em \&%N.core ,
77b5c508fbSRuslan Ermilovyielding the traditional
78b5c508fbSRuslan Ermilov.Fx
79b5c508fbSRuslan Ermilovbehaviour.
80aa81f3a9SJoerg Wunsch.Pp
8153d3620bSNik ClaytonBy default, a process that changes user or group credentials whether
8253d3620bSNik Claytonreal or effective will not create a corefile.  This behaviour can be
8353d3620bSNik Claytonchanged to generate a core dump by setting the
8453d3620bSNik Clayton.Xr sysctl 8
8553d3620bSNik Claytonvariable
8653d3620bSNik Clayton.Va kern.sugid_coredump
8753d3620bSNik Claytonto 1.
8853d3620bSNik Clayton.Pp
89aa81f3a9SJoerg WunschThe core file consists of the
90afe61c15SRodney W. Grimes.Fa u .
91afe61c15SRodney W. Grimesarea, whose size (in pages) is
92afe61c15SRodney W. Grimesdefined by the
93afe61c15SRodney W. Grimes.Dv UPAGES
94afe61c15SRodney W. Grimesmanifest in the
95afe61c15SRodney W. Grimes.Aq Pa sys/param.h
96afe61c15SRodney W. Grimesfile.  The
97afe61c15SRodney W. Grimes.Fa u .
98afe61c15SRodney W. Grimesarea starts with a
99afe61c15SRodney W. Grimes.Fa user
100afe61c15SRodney W. Grimesstructure as given in
101afe61c15SRodney W. Grimes.Aq Pa sys/user.h .
102aa81f3a9SJoerg WunschThe remainder of the core
103afe61c15SRodney W. Grimesfile consists of the data pages followed by
104afe61c15SRodney W. Grimesthe stack pages of the process image.
105aa81f3a9SJoerg WunschThe amount of data space image in the core
106afe61c15SRodney W. Grimesfile is given (in pages) by the
107afe61c15SRodney W. Grimesvariable
108afe61c15SRodney W. Grimes.Fa u_dsize
109afe61c15SRodney W. Grimesin the
110afe61c15SRodney W. Grimes.Fa u .
111afe61c15SRodney W. Grimesarea.
112afe61c15SRodney W. GrimesThe amount of stack image in the core file is given (in pages) by the
113afe61c15SRodney W. Grimesvariable
114afe61c15SRodney W. Grimes.Fa u_ssize
115afe61c15SRodney W. Grimesin the
116afe61c15SRodney W. Grimes.Ar u .
117afe61c15SRodney W. Grimesarea.
118afe61c15SRodney W. GrimesThe size of a ``page'' is given by the constant
11919dd549aSSteve Price.Dv PAGE_SIZE
120afe61c15SRodney W. Grimes(also from
121afe61c15SRodney W. Grimes.Aq Pa sys/param.h ) .
122aa81f3a9SJoerg Wunsch.Sh EXAMPLES
123aa81f3a9SJoerg WunschIn order to store all core images in per-user private areas under
124aa81f3a9SJoerg Wunsch.Pa /var/coredumps ,
125aa81f3a9SJoerg Wunschthe following
126aa81f3a9SJoerg Wunsch.Xr sysctl 8
127aa81f3a9SJoerg Wunschcommand can be used:
128aa81f3a9SJoerg Wunsch.Pp
129e21a315eSRuslan Ermilov.Dl sysctl kern.corefile="/var/coredumps/\&%U/\&%N.core"
130afe61c15SRodney W. Grimes.Sh SEE ALSO
131afe61c15SRodney W. Grimes.Xr gdb 1 ,
132afe61c15SRodney W. Grimes.Xr kgdb 1 ,
133c69a537cSWolfram Schneider.Xr setrlimit 2 ,
134aa81f3a9SJoerg Wunsch.Xr sigaction 2 ,
135aa81f3a9SJoerg Wunsch.Xr sysctl 8
136afe61c15SRodney W. Grimes.Sh HISTORY
137afe61c15SRodney W. GrimesA
1384b66483fSRuslan Ermilov.Nm
139afe61c15SRodney W. Grimesfile format appeared in
140afe61c15SRodney W. Grimes.At v6 .
141