]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man5/core.5
src.conf.5: regen after r309142 (WITH_LLD_AS_LD knob)
[FreeBSD/FreeBSD.git] / share / man / man5 / core.5
1 .\" Copyright (c) 1980, 1991, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\"     @(#)core.5      8.3 (Berkeley) 12/11/93
29 .\" $FreeBSD$
30 .\"
31 .Dd October 5, 2015
32 .Dt CORE 5
33 .Os
34 .Sh NAME
35 .Nm core
36 .Nd memory image file format
37 .Sh SYNOPSIS
38 .In sys/param.h
39 .Sh DESCRIPTION
40 A small number of signals which cause abnormal termination of a process
41 also cause a record of the process's in-core state to be written
42 to disk for later examination by one of the available debuggers.
43 (See
44 .Xr sigaction 2 . )
45 This memory image is written to a file named by default
46 .Nm programname.core
47 in the working directory;
48 provided the terminated process had write permission in the directory,
49 and provided the abnormality did not cause
50 a system crash.
51 (In this event, the decision to save the core file is arbitrary, see
52 .Xr savecore 8 . )
53 .Pp
54 The maximum size of a core file is limited by
55 .Xr setrlimit 2 .
56 Files which would be larger than the limit are not created.
57 .Pp
58 The name of the file is controlled via the
59 .Xr sysctl 8
60 variable
61 .Va kern.corefile .
62 The contents of this variable describes a filename to store
63 the core image to.
64 This filename can be absolute, or relative (which
65 will resolve to the current working directory of the program
66 generating it).
67 .Pp
68 The following format specifiers may be used in the
69 .Va kern.corefile
70 sysctl to insert additional information into the resulting core file
71 name:
72 .Bl -tag -width "1234567890" -compact -offset "12345"
73 .It Em \&%H
74 Machine hostname.
75 .It Em \&%I
76 An index starting at zero until the sysctl
77 .Em debug.ncores
78 is reached.
79 This can be useful for limiting the number of corefiles
80 generated by a particular process.
81 .It Em \&%N
82 process name.
83 .It Em \&%P
84 processes PID.
85 .It Em \&%U
86 process UID.
87 .El
88 .Pp
89 The name defaults to
90 .Em \&%N.core ,
91 yielding the traditional
92 .Fx
93 behaviour.
94 .Pp
95 By default, a process that changes user or group credentials whether
96 real or effective will not create a corefile.
97 This behaviour can be
98 changed to generate a core dump by setting the
99 .Xr sysctl 8
100 variable
101 .Va kern.sugid_coredump
102 to 1.
103 .Pp
104 Corefiles can be compressed by the kernel if the following item
105 is included in the kernel configuration file:
106 .Bl -tag -width "1234567890" -compact -offset "12345"
107 .It options
108 GZIO
109 .El
110 .Pp
111 When the GZIO option is included, the following sysctls control whether core
112 files will be compressed:
113 .Bl -tag -width "kern.compress_user_cores_gzlevel" -compact -offset "12345"
114 .It Em kern.compress_user_cores_gzlevel
115 Gzip compression level.
116 Defaults to 6.
117 .It Em kern.compress_user_cores
118 Actually compress user cores.
119 Compressed core files will have a suffix of
120 .Ql .gz
121 appended to them.
122 .El
123 .Sh NOTES
124 Corefiles are written with open file descriptor information as an ELF note.
125 By default, file paths are packed to only use as much space as needed.
126 However, file paths can change at any time, including during core dump,
127 and this can result in truncated file descriptor data.
128 .Pp
129 All file descriptor information can be preserved by disabling packing.
130 This potentially wastes up to PATH_MAX bytes per open fd.
131 Packing is disabled with
132 .Dl sysctl kern.coredump_pack_fileinfo=0 .
133 .Pp
134 Similarly, corefiles are written with vmmap information as an ELF note, which
135 contains file paths.
136 By default, they are packed to only use as much space as
137 needed.
138 By the same mechanism as for the open files note, these paths can also
139 change at any time and result in a truncated note.
140 .Pp
141 All vmmap information can be preserved by disabling packing.
142 Like the file information, this potentially wastes up to PATH_MAX bytes per
143 mapped object.
144 Packing is disabled with
145 .Dl sysctl kern.coredump_pack_vmmapinfo=0 .
146 .Sh EXAMPLES
147 In order to store all core images in per-user private areas under
148 .Pa /var/coredumps ,
149 the following
150 .Xr sysctl 8
151 command can be used:
152 .Pp
153 .Dl sysctl kern.corefile=/var/coredumps/\&%U/\&%N.core
154 .Sh SEE ALSO
155 .Xr gdb 1 ,
156 .Xr kgdb 1 ,
157 .Xr setrlimit 2 ,
158 .Xr sigaction 2 ,
159 .Xr sysctl 8
160 .Sh HISTORY
161 A
162 .Nm
163 file format appeared in
164 .At v6 .