Go to main content

man pages section 3: Extended Library Functions, Volume 3

Exit Print View

Updated: Thursday, June 13, 2019
 
 

Pcontent (3PROC)

Name

Pcontent, Pgcore, Pfgcore, proc_str2content, proc_content2str - get core file contents, generate a core file

Synopsis

#include <libproc.h>
#include <sys/corectl.h>
core_content_t Pcontent(ps_prochandle_t *Pr);
int Pgcore(ps_prochandle_t *Pr, const char *fname,
         core_content_t content);
int Pfgcore(ps_prochandle_t *Pr, int fd,
         core_content_t content);
int proc_str2content(const char *str, core_content_t *cp);
int proc_content2str(core_content_t content, char *buf, size_t size);

Description

The Pr argument identifies a victim process or a core file or an ELF file attached to the controlling process by the create and grab interfaces. For more information, see the Pcreate(3PROC) and Pgrab(3PROC) man pages.

The Pcontent() function returns a core_content_t bitmap identifying the contents present in the victim process, core file, or ELF file represented by the Pr argument, constructed of the following bit values:

CC_CONTENT_STACK      /* process stack */
CC_CONTENT_HEAP       /* process heap */
CC_CONTENT_SHFILE     /* file-backed shared mapping */
CC_CONTENT_SHANON     /* anonymous shared mapping */
CC_CONTENT_TEXT       /* read/exec file mappings */
CC_CONTENT_DATA       /* writable file mappings */
CC_CONTENT_RODATA     /* read-only file mappings */
CC_CONTENT_ANON       /* anonymous mappings (MAP_ANON) */
CC_CONTENT_SHM        /* System V shared memory */
CC_CONTENT_ISM        /* intimate shared memory */
CC_CONTENT_DISM       /* dynamic intimate shared memory */
CC_CONTENT_CTF        /* CTF data */
CC_CONTENT_SYMTAB     /* symbol table */
CC_CONTENT_OSM        /* optimized shared memory */
CC_CONTENT_PRUNE      /* Prune enabled */

The Pgcore() function creates a core file named fname from the live victim process identified by the Pr argument with contents specified by the content argument.

The Pfgcore() function writes a core file image to the file descriptor specified by the fd argument from the live victim process identified by the Pr argument with contents specified by the content argument.

The proc_str2content() function accepts a core file content description string of the form described in the coreadm(8) man page and sets the core_content_t value in the cp argument. The proc_str2content() function returns 0 on success or -1 on failure.

The proc_content2str() function accepts a core_content_t value and stores a core file content description string in the buffer specified by the buf argument, storing no more than size-1 bytes in the buffer. The proc_content2str() returns the length of the string that was or would have been stored into the buffer if size was large enough. The proc_content2str() function can be called with a value of zero for the size argument in order to determine the actual size of the buffer necessary to hold the resulting string.

Return Values

On successful completion, the Pgcore() and Pfgcore() functions return 0. On failure, they return -1 and set errno to indicate the error.

The Pcontent() function has no error return. The proc_str2content() function does not set errno on failure. The proc_content2str() function has no error return.

Errors

On failure, these errno values may be set:

EAGAIN

Process has been lost to control, need the Preopen() function

ENODATA

Pr does not refer to a live process or core file

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
Unsafe

See Also

coreadm(8), libproc(3LIB), libproc.h(3HEAD), Pcreate(3PROC), Pgrab(3PROC), proc(5)