NetBSD/share/man/man5/core.5

131 lines
4.8 KiB
Groff
Raw Normal View History

1999-10-10 19:17:43 +04:00
.\" $NetBSD: core.5,v 1.11 1999/10/10 15:17:43 jdolecek Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
1993-03-21 12:45:37 +03:00
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)core.5 8.3 (Berkeley) 12/11/93
1993-03-21 12:45:37 +03:00
.\"
.Dd December 11, 1993
1993-03-21 12:45:37 +03:00
.Dt CORE 5
.Os
1993-03-21 12:45:37 +03:00
.Sh NAME
.Nm core
.Nd memory image file format
.Sh SYNOPSIS
.Fd #include <sys/param.h>
.Sh DESCRIPTION
A small number of signals which cause abnormal termination of a process
also cause a record of the process's in-core state to be written
1999-10-10 19:17:43 +04:00
to disk for later examination by one of the available debuggers
(see
.Xr signal 7 ).
This memory image is written to a file named from a per-process template;
provided the terminated process had write permission, and provided the
abnormality did not cause a system crash.
1993-03-21 12:45:37 +03:00
(In this event, the decision to save the core file is arbitrary, see
.Xr savecore 8 . )
The file is named from a per-process template, mapped to the sysctl
variable
.Em proc.<pid>.corename
1999-10-10 19:04:47 +04:00
(where <pid> has to be replaced by the pid in decimal format of the
process).
This template is either an absolute or relative path name, in which format
characters can be used, preceeded by the percent character (``%'').
The following characters are recognised as format and subsitued:
.Bl -column "cAA" "The process's creation date (in seconds)xxx" -offset indent
.It Li n The process's name
.It Li p The PID of the process (in decimal)
.It Li t The process's creation date (a la
.Xr time 3 ,
in decimal)
.It Li u The login name, as returned by
.Xr getlogin 2
.El
.Pp
By default, the per-process template string points to the default core name
template, which is mapped to the sysctl variable
.Em kern.defcorename .
Changing this value on a live system will change the core name template for
all processes which didn't have a per-process template set.
The default value of the default core name template is
.Nm %n.core
and can be changed at compile-time with the kernel configuration option
.Cd options DEFCORENAME
(see
.Xr options 4 )
.Pp
The per-process template string is inherited on process creation, but is reset
to point to the default core name template on execution of a set-id binary.
1993-03-21 12:45:37 +03:00
.Pp
The maximum size of a core file is limited by
1993-03-21 12:45:37 +03:00
.Xr setrlimit 2 .
Files which would be larger than the limit are not created.
.Pp
The core file consists of the
1999-03-07 07:19:36 +03:00
.Fa u. area ,
whose size (in pages) is defined by the
1993-03-21 12:45:37 +03:00
.Dv UPAGES
manifest in the
.Aq Pa sys/param.h
file. The
1999-03-07 07:19:36 +03:00
.Fa u. area
starts with a
1993-03-21 12:45:37 +03:00
.Fa user
structure as given in
.Aq Pa sys/user.h .
The remainder of the core file consists of the data pages followed by
1993-03-21 12:45:37 +03:00
the stack pages of the process image.
The amount of data space image in the core file is given (in pages) by the
1993-03-21 12:45:37 +03:00
variable
.Fa u_dsize
in the
1999-03-07 07:19:36 +03:00
.Fa u. area .
1993-03-21 12:45:37 +03:00
The amount of stack image in the core file is given (in pages) by the
variable
.Fa u_ssize
in the
1999-03-07 07:19:36 +03:00
.Fa u. area .
1993-03-21 12:45:37 +03:00
The size of a ``page'' is given by the constant
.Dv NBPG
(also from
.Aq Pa sys/param.h ) .
.Sh SEE ALSO
.Xr gdb 1 ,
1999-10-10 19:17:43 +04:00
.Xr setrlimit 2 ,
.Xr sysctl 3 ,
1999-10-10 19:17:43 +04:00
.Xr signal 7 ,
.Xr sysctl 8
1993-03-21 12:45:37 +03:00
.Sh HISTORY
A
.Nm core
1993-03-21 12:45:37 +03:00
file format appeared in
.At v6 .