xref: /illumos-gate/usr/src/man/man3proc/Pgcore.3proc (revision c160bf3613805cfb4a89a0433ae896d3594f551f)
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. For details on the core file format, see
48.Xr core 4 .
49.Pp
50.Fn Pfgcore
51writes the core to the file represented by the open descriptor
52.Fa fd .
53The file descriptor should be open for both read and write.
54.Fn Pgcore
55writes the core to the file path
56.Fa fname .
57.Pp
58The content of the core is controlled by the
59.Fa content
60argument. It's the inclusive-bitwise-OR of the various content types
61listed under the
62.Sy core_content_t
63heading in the
64.Sy TYPES
65section in
66.Xr libproc 3LIB .
67Using
68.Dv CC_CONTENT_INVALID
69is illegal and will result in an error.
70.Pp
71Neither the
72.Fn Pgcore
73or
74.Fn Pfgcore
75functions stop the handle
76.Fa P .
77It is up to the caller to stop the process; which is recommended for
78obtaining a consistent view of the process. See the
79.Xr Pstop 3PROC
80function for a means to stop a handle.
81.Sh RETURN VALUES
82Upon successful completion, the
83.Fn Pfcore
84and
85.Fn Pgcore
86functions return
87.Sy 0
88and write out a core file to specified location. Otherwise,
89.Sy -1
90is returned. The
91.Fn Pfgcore
92function will truncate
93.Fa fd
94and the
95.Fn Pgcore
96function will remove
97.Fa fname .
98.Sh INTERFACE STABILITY
99.Sy Uncommitted
100.Sh MT-LEVEL
101See
102.Sy LOCKING
103in
104.Xr libproc 3LIB .
105.Sh SEE ALSO
106.Xr coreadm 1M ,
107.Xr libproc 3LIB ,
108.Xr Pstop 3PROC ,
109.Xr core 4 ,
110.Xr proc 4
111