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.\" 350f3ac37eSRuslan Ermilov.Dd January 9, 2002 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 670f3ac37eSRuslan Ermilovthe core image to. 680f3ac37eSRuslan ErmilovThis filename can be absolute, or relative (which 69aa81f3a9SJoerg Wunschwill resolve to the current working directory of the program 700f3ac37eSRuslan Ermilovgenerating it). 710dce12b8SAlfred Perlstein.Pp 720dce12b8SAlfred PerlsteinThe following format specifiers may be used in the 730dce12b8SAlfred Perlstein.Va kern.corefile 740dce12b8SAlfred Perlsteinsysctl to insert additional information into the resulting core file 750dce12b8SAlfred Perlsteinname: 760dce12b8SAlfred Perlstein.Bl -tag -width "1234567890" -compact -offset "12345" 770dce12b8SAlfred Perlstein.It Em \&%H 780dce12b8SAlfred PerlsteinMachine hostname. 790dce12b8SAlfred Perlstein.It Em \&%I 800dce12b8SAlfred PerlsteinAn index starting at zero until the sysctl 810dce12b8SAlfred Perlstein.Em debug.num_cores 820dce12b8SAlfred Perlsteinis reached. This can be useful for limiting the number of corefiles 830dce12b8SAlfred Perlsteingenerated by a particular process. 840dce12b8SAlfred Perlstein.It Em \&%N 850dce12b8SAlfred Perlsteinprocess name. 860dce12b8SAlfred Perlstein.It Em \&%P 870dce12b8SAlfred Perlsteinprocesses PID. 880dce12b8SAlfred Perlstein.It Em \&%U 890dce12b8SAlfred Perlsteinprocess UID. 900dce12b8SAlfred Perlstein.El 910dce12b8SAlfred Perlstein.Pp 920f3ac37eSRuslan ErmilovThe name defaults to 93aa81f3a9SJoerg Wunsch.Em \&%N.core , 94b5c508fbSRuslan Ermilovyielding the traditional 95b5c508fbSRuslan Ermilov.Fx 96b5c508fbSRuslan Ermilovbehaviour. 97aa81f3a9SJoerg Wunsch.Pp 9853d3620bSNik ClaytonBy default, a process that changes user or group credentials whether 990f3ac37eSRuslan Ermilovreal or effective will not create a corefile. 1000f3ac37eSRuslan ErmilovThis behaviour can be 10153d3620bSNik Claytonchanged to generate a core dump by setting the 10253d3620bSNik Clayton.Xr sysctl 8 10353d3620bSNik Claytonvariable 10453d3620bSNik Clayton.Va kern.sugid_coredump 10553d3620bSNik Claytonto 1. 1060dce12b8SAlfred Perlstein.Pp 1070dce12b8SAlfred PerlsteinCorefiles can be compressed by the kernel if the following items 1080dce12b8SAlfred Perlsteinare included in the kernel configuration file: 1090dce12b8SAlfred Perlstein.Bl -tag -width "1234567890" -compact -offset "12345" 1100dce12b8SAlfred Perlstein.It options 1110dce12b8SAlfred PerlsteinCOMPRESS_USER_CORES 1120dce12b8SAlfred Perlstein.It devices 1130dce12b8SAlfred Perlsteingzio 1140dce12b8SAlfred Perlstein.El 1150dce12b8SAlfred Perlstein.Pp 1160dce12b8SAlfred PerlsteinWhen COMPRESS_USER_CORES is included the following sysctls can control 1170dce12b8SAlfred Perlsteinif core files will be compressed: 1180dce12b8SAlfred Perlstein.Bl -tag -width "kern.compress_user_cores_gzlevel" -compact -offset "12345" 1190dce12b8SAlfred Perlstein.It Em kern.compress_user_cores_gzlevel 1200dce12b8SAlfred PerlsteinGzip compression level. Defaults to -1. 1210dce12b8SAlfred Perlstein.It Em kern.compress_user_cores 1220dce12b8SAlfred PerlsteinActually compress user cores. Core files will have the suffix 1230dce12b8SAlfred Perlstein.Em .gz 1240dce12b8SAlfred Perlsteinappended to them. 1250dce12b8SAlfred Perlstein.El 126aa81f3a9SJoerg Wunsch.Sh EXAMPLES 127aa81f3a9SJoerg WunschIn order to store all core images in per-user private areas under 128aa81f3a9SJoerg Wunsch.Pa /var/coredumps , 129aa81f3a9SJoerg Wunschthe following 130aa81f3a9SJoerg Wunsch.Xr sysctl 8 131aa81f3a9SJoerg Wunschcommand can be used: 132aa81f3a9SJoerg Wunsch.Pp 133e21a315eSRuslan Ermilov.Dl sysctl kern.corefile="/var/coredumps/\&%U/\&%N.core" 134afe61c15SRodney W. Grimes.Sh SEE ALSO 135afe61c15SRodney W. Grimes.Xr gdb 1 , 136afe61c15SRodney W. Grimes.Xr kgdb 1 , 137c69a537cSWolfram Schneider.Xr setrlimit 2 , 138aa81f3a9SJoerg Wunsch.Xr sigaction 2 , 139aa81f3a9SJoerg Wunsch.Xr sysctl 8 140afe61c15SRodney W. Grimes.Sh HISTORY 141afe61c15SRodney W. GrimesA 1424b66483fSRuslan Ermilov.Nm 143afe61c15SRodney W. Grimesfile format appeared in 144afe61c15SRodney W. Grimes.At v6 . 145