ABORT2(2)
π ABORT2(2) π
okay bestie, welcome to the System Calls Manual β we're doing abort2(2) today and honestly? she's dramatic, she's final, she does not do second acts. π
β¨ NAME β¨
abort2 β abort process with diagnostics
like, aborting, but make it informative π
π LIBRARY π
Standard C Library (libc, -lc) β the classic, the icon, the one you already linked π«Ά
πΈ SYNOPSIS πΈ
#include <stdlib.h>
void
abort2(const char *why, int nargs, void **args);
π¦ DESCRIPTION π¦
so here's the tea: the abort2() system call kills your process and hands the diagnostic message you wrote (plus its arguments) straight to the kernel, which delivers it to the syslogd(8) daemon. no cap, the kernel is the messenger here. π
the why argument points to a NUL-terminated string that says why your program is terminating (max 128 characters long, so keep it cute and keep it short). the args array holds pointers that get logged numerically β the kernel uses its β%pβ printf(9) format for them, so don't expect pretty strings, expect addresses. the nargs argument says how many pointers are in args (max 16).
when is this the move? The abort2() system call is intended for situations where continuing the process is impossible, or where continuing is unwanted for other definitive reasons β and where your normal diagnostic channels cannot be trusted to deliver the message. like, if you can't trust the messenger, you go straight to the source. periodt. β¨
π«Ά RETURN VALUES π«Ά
abort2() never returns. literally never. she does not come back. π
The process is killed with SIGABRT β unless the arguments to abort2() are invalid, in which case SIGKILL is used instead. so either way, you're gone, but the exit vibe differs depending on whether you gave her good arguments. π
π EXAMPLES π
#include <stdlib.h>
if (weight_kg > max_load) {
void *ptrs[3];
ptrs[0] = (void *)(intptr_t)weight_kg;
ptrs[1] = (void *)(intptr_t)max_load;
ptrs[2] = haystack;
abort2("Camel overloaded", 3, ptrs);
}
not the camel being overloaded π the way that this is genuinely the most iconic example in the whole manual. "Camel overloaded" β she said what she said and then logged three pointers about it. main character energy fr fr πͺπ
π SEE ALSO π
iykyk, go read those next π
β HISTORY β
The abort2() system call first appeared in FreeBSD 7.0. a legend was born β¨
π AUTHORS π
The abort2() system call was designed by Poul-Henning Kamp <phk@FreeBSD.org>.
It was implemented by Wojciech A. Koszek <dunstan@freebsd.czest.pl>.
two icons, one syscall, we love to see it π«ΆπΈ
heads up bestie: once you callabort2(), there is no coming back. no return value, no cleanup arc, no redemption episode. the arguments you pass had better be valid, or the kernel upgrades you fromSIGABRTtoSIGKILL. choose wisely π
and that's the whole page!! this one came from the Debian crew, dated September 30, 2006 β yeah, she's been serving this energy for a minute. slay. bye bestie, don't abort anything important πβ¨π¦
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2005 Wojciech A. Koszek <dunstan@FreeBSD.czest.pl>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms