insert ANSI-mandated bogosity
[unix-history] / usr / src / share / man / man5 / core.5
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" %sccs.include.redist.roff%
.\"
.\" @(#)core.5 8.2 (Berkeley) %G%
.\"
.Dd
.Dt CORE 5
.Os BSD 4
.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
to disk for later examination by one of the aviailable debuggers.
(See
.Xr sigaction 2 . )
This memory image is written to a file named
.Nm programname.core
in the working directory;
provided the terminated process had write permission in the directory,
and provided the abnormality did not caused
a system crash.
(In this event, the decision to save the core file is arbitrary, see
.Xr savecore 8 . )
.Pp
The maximum size of a
.Nm programname.core
file is limited by
.Xr setrlimit 2 .
Files which would be larger than the limit are not created.
.Pp
The
.Nm programname.core
file consists of the
.Fa u .
area, whose size (in pages) is
defined by the
.Dv UPAGES
manifest in the
.Aq Pa sys/param.h
file. The
.Fa u .
area starts with a
.Fa user
structure as given in
.Aq Pa sys/user.h .
The remainder of the
.Nm programname.core
file consists of the data pages followed by
the stack pages of the process image.
The amount of data space image in the
.Nm programname.core
file is given (in pages) by the
variable
.Fa u_dsize
in the
.Fa u .
area.
The amount of stack image in the core file is given (in pages) by the
variable
.Fa u_ssize
in the
.Ar u .
area.
The size of a ``page'' is given by the constant
.Dv NBPG
(also from
.Aq Pa sys/param.h ) .
.Sh SEE ALSO
.Xr adb 1 ,
.Xr dbx 1 ,
.Xr gdb 1 ,
.Xr kgdb 1 ,
.Xr sigaction 2 ,
.Xr setrlimit 2
.Sh HISTORY
A
.Nm core
file format appeared in
.At v6 .