1.\" 2.\" This file and its contents are supplied under the terms of the 3.\" Common Development and Distribution License ("CDDL"), version 1.0. 4.\" You may only use this file in accordance with the terms of version 5.\" 1.0 of the CDDL. 6.\" 7.\" A full copy of the text of the CDDL should have accompanied this 8.\" source. A copy of the CDDL is also available via the Internet at 9.\" http://www.illumos.org/license/CDDL. 10.\" 11.\" 12.\" Copyright 2015 Joyent, Inc. 13.\" 14.Dd May 11, 2016 15.Dt PGCORE 3PROC 16.Os 17.Sh NAME 18.Nm Pfgcore , 19.Nm Pgcore 20.Nd produce a core file of a process 21.Sh SYNOPSIS 22.Ft int 23.Fo Pfgcore 24.Fa "struct ps_prochandle *P" 25.Fa "int fd" 26.Fa "core_content_t content" 27.Fc 28.Ft int 29.Fo Pgcore 30.Fa "struct ps_prochandle *P" 31.Fa "const char *fname" 32.Fa "core_content_t content" 33.Fc 34.Sh DESCRIPTION 35The 36.Fn Pgcore 37and 38.Fn Pfgcore 39functions produce core files of the handle referred to by 40.Fa P . 41Core files represent a snapshot of a process and may be manipulated by a 42wide variety of tools and libraries including 43.Xr libproc 3LIB , 44.Xr mdb 1 , 45.Xr pargs 1 , 46.Xr pstack 1 , 47and more. 48For details on the core file format, see 49.Xr core 5 . 50.Pp 51.Fn Pfgcore 52writes the core to the file represented by the open descriptor 53.Fa fd . 54The file descriptor should be open for both read and write. 55.Fn Pgcore 56writes the core to the file path 57.Fa fname . 58.Pp 59The content of the core is controlled by the 60.Fa content 61argument. 62It's the inclusive-bitwise-OR of the various content types listed under the 63.Sy core_content_t 64heading in the 65.Sy TYPES 66section in 67.Xr libproc 3LIB . 68Using 69.Dv CC_CONTENT_INVALID 70is illegal and will result in an error. 71.Pp 72Neither the 73.Fn Pgcore 74or 75.Fn Pfgcore 76functions stop the handle 77.Fa P . 78It is up to the caller to stop the process; which is recommended for 79obtaining a consistent view of the process. 80See the 81.Xr Pstop 3PROC 82function for a means to stop a handle. 83.Sh RETURN VALUES 84Upon successful completion, the 85.Fn Pfcore 86and 87.Fn Pgcore 88functions return 89.Sy 0 90and write out a core file to specified location. 91Otherwise, 92.Sy -1 93is returned. 94The 95.Fn Pfgcore 96function will truncate 97.Fa fd 98and the 99.Fn Pgcore 100function will remove 101.Fa fname . 102.Sh INTERFACE STABILITY 103.Sy Uncommitted 104.Sh MT-LEVEL 105See 106.Sy LOCKING 107in 108.Xr libproc 3LIB . 109.Sh SEE ALSO 110.Xr libproc 3LIB , 111.Xr Pstop 3PROC , 112.Xr core 5 , 113.Xr proc 5 , 114.Xr coreadm 8 115