tail head cat sleep
QR code linking to this page

Manual Pages  — CORE

NAME

core – memory image file format

CONTENTS

SYNOPSIS

#include <sys/param.h>

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 available debuggers. (See sigaction(2).) This memory image is written to a file named by default programname.core in the working directory; provided the terminated process had write permission in the directory, and provided the abnormality did not cause a system crash. (In this event, the decision to save the core file is arbitrary, see savecore(8).)

The maximum size of a core file is limited by setrlimit(2). Files which would be larger than the limit are not created.

The name of the file is controlled via the sysctl(8) variable kern.corefile. The contents of this variable describes a filename to store the core image to. This filename can be absolute, or relative (which will resolve to the current working directory of the program generating it).

The following format specifiers may be used in the kern.corefile sysctl to insert additional information into the resulting core file name:
%H Machine hostname.
%I An index starting at zero until the sysctl debug.ncores is reached. This can be useful for limiting the number of corefiles generated by a particular process.
%N process name.
%P processes PID.
%U process UID.

The name defaults to %N.core, yielding the traditional FreeBSD behaviour.

By default, a process that changes user or group credentials whether real or effective will not create a corefile. This behaviour can be changed to generate a core dump by setting the sysctl(8) variable kern.sugid_coredump to 1.

Corefiles can be compressed by the kernel if the following item is included in the kernel configuration file:
options GZIO

When the GZIO option is included, the following sysctls control whether core files will be compressed:
kern.compress_user_cores_gzlevel
  Gzip compression level. Defaults to 6.
kern.compress_user_cores Actually compress user cores. Compressed core files will have a suffix of ‘.gz’ appended to them.

NOTES

Corefiles are written with open file descriptor information as an ELF note. By default, file paths are packed to only use as much space as needed. However, file paths can change at any time, including during core dump, and this can result in truncated file descriptor data.

All file descriptor information can be preserved by disabling packing. This potentially wastes up to PATH_MAX bytes per open fd. Packing is disabled with

    sysctl kern.coredump_pack_fileinfo=0.

Similarly, corefiles are written with vmmap information as an ELF note, which contains file paths. By default, they are packed to only use as much space as needed. By the same mechanism as for the open files note, these paths can also change at any time and result in a truncated note.

All vmmap information can be preserved by disabling packing. Like the file information, this potentially wastes up to PATH_MAX bytes per mapped object. Packing is disabled with

    sysctl kern.coredump_pack_vmmapinfo=0.

EXAMPLES

In order to store all core images in per-user private areas under /var/coredumps, the following sysctl(8) command can be used:

    sysctl kern.corefile=/var/coredumps/%U/%N.core

SEE ALSO

gdb(1), kgdb(1), setrlimit(2), sigaction(2), sysctl(8)

HISTORY

A core file format appeared in AT&T v6 .

CORE (5) October 5, 2015

tail head cat sleep
QR code linking to this page


Please direct any comments about this manual page service to Ben Bullock.

What will happen when the 32-bit Unix date goes negative in mid-January 2038 does not bear thinking about.
— Henry Spencer