summaryrefslogtreecommitdiff
path: root/usr/src/man/man2
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/man/man2')
-rw-r--r--usr/src/man/man2/Makefile1
-rw-r--r--usr/src/man/man2/upanic.295
2 files changed, 96 insertions, 0 deletions
diff --git a/usr/src/man/man2/Makefile b/usr/src/man/man2/Makefile
index 8f664a56fc..60ed81daad 100644
--- a/usr/src/man/man2/Makefile
+++ b/usr/src/man/man2/Makefile
@@ -155,6 +155,7 @@ MANFILES= Intro.2 \
umount.2 \
uname.2 \
unlink.2 \
+ upanic.2 \
ustat.2 \
utime.2 \
utimes.2 \
diff --git a/usr/src/man/man2/upanic.2 b/usr/src/man/man2/upanic.2
new file mode 100644
index 0000000000..351b7939d0
--- /dev/null
+++ b/usr/src/man/man2/upanic.2
@@ -0,0 +1,95 @@
+.\"
+.\" 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 Computer Company
+.\"
+.Dd October 31, 2020
+.Dt UPANIC 2
+.Os
+.Sh NAME
+.Nm upanic
+.Nd user process panic
+.Sh SYNOPSIS
+.In upanic.h
+.Ft void noreturn
+.Fo upanic
+.Fa "const char *msg"
+.Fa "size_t len"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn upanic
+system call terminates the calling process and generates a core file in
+the process, subject to the current core file settings as described in
+.Xr core 4
+and controlled by
+.Xr coreadm 1M .
+.Pp
+Unlike
+.Xr abort 3C ,
+signals are not generated, which avoids two related challenges:
+.Bl -enum
+.It
+A signal handler attempting to catch a
+.Dv SIGABRT .
+.It
+Needing to make multiple system calls and potentially unmasking the
+signal.
+.El
+.Pp
+The
+.Fn upanic
+system call allows an optional message to be transmitted that will be
+put in a
+.Dv NT_UPANIC
+elf note in the resulting core file.
+If a message is not desired, then one should pass
+.Dv NULL
+for
+.Fa msg .
+In general, it is expected that
+.Fa msg
+is a character string with a human-readable message; however, it may
+include binary data.
+The system will copy
+.Fa len
+bytes regardless of whether the string has a NUL character to terminate
+it or not.
+If
+.Fa msg
+points to an invalid value or
+.Fa len
+is a size that is larger than the system's internal maximum size, then
+the process will still terminate; however, this will be noted in the
+.Dv NT_UPANIC
+elf note.
+.Pp
+The
+.Fn upanic
+system call is illumos-specific and not portable to other systems.
+For portable applications, instead use
+.Xr abort 3C .
+.Sh RETURN VALUES
+The
+.Fn upanic
+system call does not return.
+It always terminates the process.
+.Sh INTERFACE STABILITY
+.Sy Committed
+.Sh MT-LEVEL
+.Sy Async-Signal-Safe
+.Sh SEE ALSO
+.Xr elfdump 1 ,
+.Xr mdb 1 ,
+.Xr coreadm 1M ,
+.Xr abort 3 ,
+.Xr upanic.h 3HEAD ,
+.Xr core 4