xref: /illumos-gate/usr/src/man/man3proc/Pupanic.3proc (revision 77c0a660417a046bfab6c8ef58d00c181c0264b3)
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 2020 Oxide Comptuer Company
13.\"
14.Dd March 30, 2022
15.Dt PUPANIC 3PROC
16.Os
17.Sh NAME
18.Nm Pupanic ,
19.Nm Pupanic_free
20.Nd get upanic information from a core file
21.Sh LIBRARY
22.Lb libproc
23.Sh SYNOPSIS
24.In libproc.h
25.Ft int
26.Fo Pupanic
27.Fa "struct ps_prochandle *P"
28.Fa "prupanic_t **prup"
29.Fc
30.Ft void
31.Fo Pupanic_free
32.Fa "prupanic_t *pru"
33.Fc
34.Sh DESCRIPTION
35The
36.Fn Pupanic
37function copies the contents of the
38.Dv NT_UPANIC
39elf note from the process handle
40.Fa P
41that corresponds to a core file into
42.Fa prup .
43.Pp
44The library will allocate the memory needed for a
45.Ft prupanic_t
46and it is the caller's responsibility to release it by calling the
47.Fn Pupanic_free
48function with the returned data when they are done with the data.
49.Pp
50The allocated data stored in
51.Fa prup
52has a lifetime independent of the underlying process handle
53.Fa P .
54That is, it is safe to continue using it whether the process handle is
55still valid or has been released with
56.Xr Pfree 3PROC .
57.Pp
58If the process handle doesn't correspond to a core file or this note is
59not present in the core file, then the
60.Fn Pupanic
61function will fail.
62.Sh RETURN VALUES
63Upon successful completion, the
64.Fn Pupanic
65function returns
66.Sy 0
67and stores the allocated
68.Ft prupanic_t
69structure in
70.Fa prup .
71Otherwise
72.Sy -1
73is returned
74and
75.Vt errno
76is set to indicate the error.
77.Sh ERRORS
78The
79.Fn Pupanic
80function will fail if:
81.Bl -tag -width Er
82.It Er ENODATA
83The process handle
84.Fa P
85does not correspond to a core file.
86.It Er ENOENT
87The core file does not have a
88.Dv NT_UPANIC
89elf note.
90.It Er EAGAIN, Er ENOMEM
91An underlying memory allocation failed.
92.El
93.Sh INTERFACE STABILITY
94.Sy Uncommitted
95.Sh MT-LEVEL
96See
97.Sy LOCKING
98in
99.Xr libproc 3LIB .
100.Sh SEE ALSO
101.Xr upanic 2 ,
102.Xr libproc 3LIB ,
103.Xr core 5
104