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