Content-type: text/html Man page of core


Section: Devices and Network Interfaces (4)
Index Return to Main Contents


core - Format of memory image file  


#include <sys/core.h>  


The system writes out a memory image of a terminated process when any of various errors occur. See sigaction(2) for the list of reasons; the most common are memory violations, illegal instructions, bus errors, and user-generated quit signals. The memory image is called core and is written in the process's working directory (provided it can be; normal access controls apply).

The maximum size of a core file is limited. Files that would be larger than the limit are not created.

Default behavior is for the system to name a core file core and overwrite any other core file in the working directory.

You can enable enhanced core file naming, which causes the system to create unique names for core files. Core files are not overwritten, thereby preventing loss of valuable debugging information when the same program fails mulitiple times (and perhaps for mulitple reasons).

When enhanced core file naming is enabled, the system produces core files with names in the following format:

core.program_name.host_name.numeric_tag The literal string core. Up to sixteen characters taken from the program name as shown by the ps command. The first portion of the system's network host name, or up to 16 characters of the host name, taken from the part of the host name that precedes the first dot. This tag is assigned to the core file to make it unique among all the core files generated by a program on a host. The maximum value for this tag, and thus the maximum number of core files for this program and host, is set by a system configuration parameter.

Note the tag is not a literal version number. The system selects the first available unique tag for the core file. For example, if a program's core files have tags .0, .1, and .3, the system uses tag .2 for the next core file it creates for that program. If the system-configured limit for core file instances is reached, the system will not create any more core files for that program/host combination. By default, the system can create up to 16 versions of a core file.
For example, the fourth core file generated on host by the program dropsy would be: core.dropsy.buggy.3

You must enable enhanced core file naming; there are two ways to do so. First, you can enable enhanced core file naming at the system level by setting the enhanced-core-name system configuration variable to 1 in the proc subsystem:

                enhanced-core-name = 1 Second, you can enable enhanced core file naming at the program level by calling the uswitch system call with the USW_CORE flag set. See the EXAMPLE section.

The system manager can limit the number of unique core file versions that a program can create on a specific host system by setting the system configuration variable enhanced-core-max-versions to the desired value:

                enhanced-core-name = 1
                enhanced-core-max-versions = 8 The miminum value is 1, the maximum is 99,999, and the default is 16.



The following example shows a code fragment that calls the uswitch system call with the USW_CORE flag set:
        #include <signal.h>
        #include <sys/uswitch.h>

         * Request enhanced core file naming for
         * this process then create a core file.
                long uval = uswitch(USC_GET, 0);
                uval = uswitch(USC_SET, uval | USW_CORE);
                if (uval < 0) {

In general the debugger dbx(1) is sufficient to deal with core images.  


sigaction(2), uswitch(2), sysconfigdb(8), dbx(1) delim off




This document was created by man2html, using the manual pages.
Time: 02:40:08 GMT, October 02, 2010