xref: /illumos-gate/usr/src/man/man2/upanic.2 (revision 99308ed0417a2b8ab73c5856a8a5345ce2a7aea7)
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 Computer Company
13.\"
14.Dd October 31, 2020
15.Dt UPANIC 2
16.Os
17.Sh NAME
18.Nm upanic
19.Nd user process panic
20.Sh SYNOPSIS
21.In upanic.h
22.Ft void noreturn
23.Fo upanic
24.Fa "const char *msg"
25.Fa "size_t len"
26.Fc
27.Sh DESCRIPTION
28The
29.Fn upanic
30system call terminates the calling process and generates a core file in
31the process, subject to the current core file settings as described in
32.Xr core 4
33and controlled by
34.Xr coreadm 1M .
35.Pp
36Unlike
37.Xr abort 3C ,
38signals are not generated, which avoids two related challenges:
39.Bl -enum
40.It
41A signal handler attempting to catch a
42.Dv SIGABRT .
43.It
44Needing to make multiple system calls and potentially unmasking the
45signal.
46.El
47.Pp
48The
49.Fn upanic
50system call allows an optional message to be transmitted that will be
51put in a
52.Dv NT_UPANIC
53elf note in the resulting core file.
54If a message is not desired, then one should pass
55.Dv NULL
56for
57.Fa msg .
58In general, it is expected that
59.Fa msg
60is a character string with a human-readable message; however, it may
61include binary data.
62The system will copy
63.Fa len
64bytes regardless of whether the string has a NUL character to terminate
65it or not.
66If
67.Fa msg
68points to an invalid value or
69.Fa len
70is a size that is larger than the system's internal maximum size, then
71the process will still terminate; however, this will be noted in the
72.Dv NT_UPANIC
73elf note.
74.Pp
75The
76.Fn upanic
77system call is illumos-specific and not portable to other systems.
78For portable applications, instead use
79.Xr abort 3C .
80.Sh RETURN VALUES
81The
82.Fn upanic
83system call does not return.
84It always terminates the process.
85.Sh INTERFACE STABILITY
86.Sy Committed
87.Sh MT-LEVEL
88.Sy Async-Signal-Safe
89.Sh SEE ALSO
90.Xr elfdump 1 ,
91.Xr mdb 1 ,
92.Xr coreadm 1M ,
93.Xr abort 3 ,
94.Xr upanic.h 3HEAD ,
95.Xr core 4
96