sysdecode_sigcode(3)
π sysdecode_sigcode β lookup name of signal code
Okay bestie, so this one lives in the library libsysdecode and it's basically the friend who knows everyone's name at the party. You give it a signal code, it tells you which C macro that code actually is. Iconic behavior, honestly.
β¨ SYNOPSIS β¨
#include <sysdecode.h>
const char *
sysdecode_sigcode(int signal, int si_code);
π¦ DESCRIPTION π¦
So the sysdecode_sigcode() function returns a text description of the si_code field of the siginfo_t object associated with an instance of signal sig. Like, you hand it the messy number, it hands you back the glow-up version with a name.
The text description contains the name of the C macro whose value matches si_code. That's the whole vibe β macro name, matching value, done.
And it's not picky either! General purpose signal codes such as SI_USER are handled as well as signal-specific codes for SIGBUS, SIGCHLD, SIGFPE, SIGILL, SIGSEGV and SIGTRAP. Six whole signal-specific families, all covered π
But lowkey, if si_code does not represent a known signal code, sysdecode_sigcode() returns NULL. No cap β unknown code, no name, that's the deal. Don't come for her, she's just being honest π
π RETURN VALUES π
- The
sysdecode_sigcode()function returns a pointer to a signal code description, orNULLifsi_codeis not a known signal code.
So yeah β pointer on success, NULL when it's giving "who is that". Periodt.
π SEE ALSO π
sysdecode_sigbus_code(3)sysdecode_sigchld_code(3)sysdecode_sigfpe_code(3)sysdecode_sigill_code(3)sysdecode_sigsegv_code(3)sysdecode_sigtrap_code(3)
β¨ Friendly reminder: this page is from the Debian crew and it's dated October 17, 2016 β oldie but a goodie, fr fr π«Ά
Stay curious, read your man pages, and remember: the si_code field is not mysterious, it's just waiting for someone to ask π§π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2016 John Baldwin <jhb@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms