Previous Page
Next Page

Core File Configuration

Objective:

Manage crash dumps and core file behaviors.

Core files are created when a program or an application terminates abnormally. The default location for a core file to be written is the current working directory. However, as the system administrator, you might want to configure the system so that all core files are written to a central location. This would make administration and management of core files much easier because core files can sometimes take up a significant amount of disk space.

You manage core files by using the coreadm command:

coreadm  [-g pattern] [-G content] [-i pattern] [-I content] \
[-d option...]   [-e option...]

coreadm  [-p pattern] [-P content] [pid]
coreadm -u

The options for the coreadm command are described in Table 9.4.

Table 9.4. coreadm Command Options

Option

Description

-g pattern

Sets the global core file name pattern.

-G content

Sets the global core file content using one of the description tokens.

-i pattern

Sets the per-process core file name pattern.

-I content

Sets the per-process core file name to content.

-d option

Disables the specified core file option.

-e option

Enables the specified core file option.

-p pattern

Sets the per-process core file name pattern for each of the specified pids.

-P content

Sets the per-process core file content to content.

-u

Updates the systemwide core file options from the configuration file /etc/coreadm.conf.


Running coreadm with no options displays the current configuration, which you can determine by reading the file /etc/coreadm.conf.

A core file name pattern consists of a file system pathname, along with embedded variables. These variables are specified with a leading % character. The values are then expanded when a core file is created. Valid pattern variables are described in Table 9.5.

Table 9.5. coreadm Patterns

coreadm Pattern

Description

%p

Specifies the process ID (PID).

%u

Specifies the effective user ID.

%g

Specifies the effective group ID.

%d

Specifies the executable file directory name.

%f

Specifies the executable filename.

%n

Specifies the system node name. This is the same as running uname -n.

%m

Specifies the machine name. This is the same as running uname -m.

%t

Specifies the decimal value of time, as the number of seconds since 00:00:00 January 1, 1970.

-z

Specifies the name of the zone in which the process is executed (zonename).

%%

Specifies the a literal % character.


The -d and -e flags of the coreadm command can take several options. These are listed in Table 9.6.

Table 9.6. coreadm -d and -e Flag Options

Option

Description

global

Allows core dumps, using the global core pattern.

process

Allows core dumps, using the per-process core pattern.

global-setid

Allows set-id core dumps, using the global core pattern.

proc-setid

Allows set-id core dumps, using the per-process core pattern.

log

Produces a syslog message when an attempt is made to generate a global core file.


To modify the core file configuration so that all files are dumped into the directory /cores and named core, followed by the system name and then the name of the program being run, you can follow the procedure described in Step by Step 9.4.

Step By Step 9.4: Configuring Core Files

1.
As root, use the coreadm command to display the current coreadm configuration:

# coreadm
     global core file pattern:
     global core file content: default
       init core file pattern: core
         init core file content: default
            global core dumps: disabled
       per-process core dumps: enabled
      global setid core dumps: disabled
 per-process setid core dumps: disabled
     global core dump logging: disabled

2.
As root, issue the following command to change the core file setup:

# coreadm -i /cores/core.%n.%f

3.
Run coreadm again to verify that the change has been made permanent:

# coreadm
global core file pattern:
global core file content: default
       init core file pattern: /cores/core.%n.%f
       init core file content: default
            global core dumps: disabled
       per-process core dumps: enabled
      global setid core dumps: disabled
 per-process setid core dumps: disabled
     global core dump logging: disabled


The coreadm process is now configured by the Service Management Facility (SMF) at system boot time. Use the svcs command to check its status. The service name for this process is svc:/system/coreadm:default.


Previous Page
Next Page