coredump Subroutine

Purpose

Creates a core file without terminating the calling process.

Library

Standard C library (libc.a)

Syntax

#include <core.h>

int coredump( coredumpinfop)
struct
coredumpinfo *coredumpinfop ;

Description

The coredump subroutine creates a core file of the calling process without terminating the calling process. The created core file contains the memory image of the process, and this can be used with the dbx command for debugging purposes. In multithreaded processes, only one thread at a time should attempt to call this subroutine. Subsequent calls to coredump while a core dump (initiated by another thread) is in progress will fail.

Applications expected to use this facility need to be built with the -bM:UR binder flag, otherwise the routine will fail with an error code of ENOTSUP.

The coredumpinfo structure has the following fields:

Member Type Member Name Description
unsigned int length Length of the core file name
char * name Points to a character string that contains the name of the core file
int reserved[8] Reserved fields for future use

Parameters

Item Description
coredumpinfop Points to the coredumpinfo structure

If a NULL pointer is passed as an argument, the default file named core in the current directory is used.

Return Values

Upon successful completion, the coredump subroutine returns a value of 0. If the coredump subroutine is not successful, a value of -1 is returned and the errno global variable is set to indicate the error

Error Codes

Item Description
EINVAL Invalid argument.
EACCES Search permission is denied on a component of the path prefix, the file exists and the pwrite permission is denied, or the file does not exist and write permission is denied for the parent directory of the file to be created.
EINPROGRESS A core dump is already in progress.
ENOMEM Not enough memory.
ENOTSUP Routine not supported.
EFAULT Invalid user address.