sysdecode_sigcode(3)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸ’… 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, or NULL if si_code is not a known signal code.

So yeah β€” pointer on success, NULL when it's giving "who is that". Periodt.


🌈 SEE ALSO 🌈


✨ 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