xref: /illumos-gate/usr/src/man/man2/upanic.2 (revision 350ffdd54baf880f440ddf9697666e283894ded1)
1*350ffdd5SRobert Mustacchi.\"
2*350ffdd5SRobert Mustacchi.\" This file and its contents are supplied under the terms of the
3*350ffdd5SRobert Mustacchi.\" Common Development and Distribution License ("CDDL"), version 1.0.
4*350ffdd5SRobert Mustacchi.\" You may only use this file in accordance with the terms of version
5*350ffdd5SRobert Mustacchi.\" 1.0 of the CDDL.
6*350ffdd5SRobert Mustacchi.\"
7*350ffdd5SRobert Mustacchi.\" A full copy of the text of the CDDL should have accompanied this
8*350ffdd5SRobert Mustacchi.\" source.  A copy of the CDDL is also available via the Internet at
9*350ffdd5SRobert Mustacchi.\" http://www.illumos.org/license/CDDL.
10*350ffdd5SRobert Mustacchi.\"
11*350ffdd5SRobert Mustacchi.\"
12*350ffdd5SRobert Mustacchi.\" Copyright 2020 Oxide Computer Company
13*350ffdd5SRobert Mustacchi.\"
14*350ffdd5SRobert Mustacchi.Dd October 31, 2020
15*350ffdd5SRobert Mustacchi.Dt UPANIC 2
16*350ffdd5SRobert Mustacchi.Os
17*350ffdd5SRobert Mustacchi.Sh NAME
18*350ffdd5SRobert Mustacchi.Nm upanic
19*350ffdd5SRobert Mustacchi.Nd user process panic
20*350ffdd5SRobert Mustacchi.Sh SYNOPSIS
21*350ffdd5SRobert Mustacchi.In upanic.h
22*350ffdd5SRobert Mustacchi.Ft void noreturn
23*350ffdd5SRobert Mustacchi.Fo upanic
24*350ffdd5SRobert Mustacchi.Fa "const char *msg"
25*350ffdd5SRobert Mustacchi.Fa "size_t len"
26*350ffdd5SRobert Mustacchi.Fc
27*350ffdd5SRobert Mustacchi.Sh DESCRIPTION
28*350ffdd5SRobert MustacchiThe
29*350ffdd5SRobert Mustacchi.Fn upanic
30*350ffdd5SRobert Mustacchisystem call terminates the calling process and generates a core file in
31*350ffdd5SRobert Mustacchithe process, subject to the current core file settings as described in
32*350ffdd5SRobert Mustacchi.Xr core 4
33*350ffdd5SRobert Mustacchiand controlled by
34*350ffdd5SRobert Mustacchi.Xr coreadm 1M .
35*350ffdd5SRobert Mustacchi.Pp
36*350ffdd5SRobert MustacchiUnlike
37*350ffdd5SRobert Mustacchi.Xr abort 3C ,
38*350ffdd5SRobert Mustacchisignals are not generated, which avoids two related challenges:
39*350ffdd5SRobert Mustacchi.Bl -enum
40*350ffdd5SRobert Mustacchi.It
41*350ffdd5SRobert MustacchiA signal handler attempting to catch a
42*350ffdd5SRobert Mustacchi.Dv SIGABRT .
43*350ffdd5SRobert Mustacchi.It
44*350ffdd5SRobert MustacchiNeeding to make multiple system calls and potentially unmasking the
45*350ffdd5SRobert Mustacchisignal.
46*350ffdd5SRobert Mustacchi.El
47*350ffdd5SRobert Mustacchi.Pp
48*350ffdd5SRobert MustacchiThe
49*350ffdd5SRobert Mustacchi.Fn upanic
50*350ffdd5SRobert Mustacchisystem call allows an optional message to be transmitted that will be
51*350ffdd5SRobert Mustacchiput in a
52*350ffdd5SRobert Mustacchi.Dv NT_UPANIC
53*350ffdd5SRobert Mustacchielf note in the resulting core file.
54*350ffdd5SRobert MustacchiIf a message is not desired, then one should pass
55*350ffdd5SRobert Mustacchi.Dv NULL
56*350ffdd5SRobert Mustacchifor
57*350ffdd5SRobert Mustacchi.Fa msg .
58*350ffdd5SRobert MustacchiIn general, it is expected that
59*350ffdd5SRobert Mustacchi.Fa msg
60*350ffdd5SRobert Mustacchiis a character string with a human-readable message; however, it may
61*350ffdd5SRobert Mustacchiinclude binary data.
62*350ffdd5SRobert MustacchiThe system will copy
63*350ffdd5SRobert Mustacchi.Fa len
64*350ffdd5SRobert Mustacchibytes regardless of whether the string has a NUL character to terminate
65*350ffdd5SRobert Mustacchiit or not.
66*350ffdd5SRobert MustacchiIf
67*350ffdd5SRobert Mustacchi.Fa msg
68*350ffdd5SRobert Mustacchipoints to an invalid value or
69*350ffdd5SRobert Mustacchi.Fa len
70*350ffdd5SRobert Mustacchiis a size that is larger than the system's internal maximum size, then
71*350ffdd5SRobert Mustacchithe process will still terminate; however, this will be noted in the
72*350ffdd5SRobert Mustacchi.Dv NT_UPANIC
73*350ffdd5SRobert Mustacchielf note.
74*350ffdd5SRobert Mustacchi.Pp
75*350ffdd5SRobert MustacchiThe
76*350ffdd5SRobert Mustacchi.Fn upanic
77*350ffdd5SRobert Mustacchisystem call is illumos-specific and not portable to other systems.
78*350ffdd5SRobert MustacchiFor portable applications, instead use
79*350ffdd5SRobert Mustacchi.Xr abort 3C .
80*350ffdd5SRobert Mustacchi.Sh RETURN VALUES
81*350ffdd5SRobert MustacchiThe
82*350ffdd5SRobert Mustacchi.Fn upanic
83*350ffdd5SRobert Mustacchisystem call does not return.
84*350ffdd5SRobert MustacchiIt always terminates the process.
85*350ffdd5SRobert Mustacchi.Sh INTERFACE STABILITY
86*350ffdd5SRobert Mustacchi.Sy Committed
87*350ffdd5SRobert Mustacchi.Sh MT-LEVEL
88*350ffdd5SRobert Mustacchi.Sy Async-Signal-Safe
89*350ffdd5SRobert Mustacchi.Sh SEE ALSO
90*350ffdd5SRobert Mustacchi.Xr elfdump 1 ,
91*350ffdd5SRobert Mustacchi.Xr mdb 1 ,
92*350ffdd5SRobert Mustacchi.Xr coreadm 1M ,
93*350ffdd5SRobert Mustacchi.Xr abort 3 ,
94*350ffdd5SRobert Mustacchi.Xr upanic.h 3HEAD ,
95*350ffdd5SRobert Mustacchi.Xr core 4
96