strsignal(3)
π strsignal(3) β bestie, let's talk about signal strings π
okay so this one lives in the Library Functions Manual, section 3, and it's all about turning those scary little signal numbers into actual words you can read. no cap, it's lowkey one of the most useful things in <string.h> π¦
β¨ NAME β¨
strsignal, sigabbrev_np, sigdescr_np, sys_siglist β the whole squad that gives you a string signal description. π
π LIBRARY π
Standard C library (libc, -lc). your classic, your icon, your everyday bestie.
π SYNOPSIS π
#include <string.h>
char *strsignal(int sig);
const char *sigdescr_np(int sig);
const char *sigabbrev_np(int sig);
[[deprecated]] extern const char *const sys_siglist[];
πΈ Feature Test Macro Requirements for glibc πΈ
(peep feature_test_macros(7) for the full lore, bestie)
sigabbrev_np(), sigdescr_np():
_GNU_SOURCE
strsignal():
- From glibc 2.10 to glibc 2.31:
_POSIX_C_SOURCE >= 200809L
- Before glibc 2.10:
_GNU_SOURCE
sys_siglist:
- Since glibc 2.19:
_DEFAULT_SOURCE
- glibc 2.19 and earlier:
_BSD_SOURCE
no fr, the macros matter. define the wrong one and the compiler will simply not see your fave function. sad but true π
π« DESCRIPTION π«
The strsignal() function returns a string describing the signal number passed in the argument sig. and here's the tea: that string can be used only until the next call to strsignal() β it's not yours forever, it's yours for one moment, main character energy, blink and it's gone. π Also, the string returned by strsignal() is localized according to the LC_MESSAGES category in the current locale. so it speaks your language, literally.
The sigdescr_np() function also returns a string describing the signal number passed in the argument sig. BUT β and this is the plot twist β unlike strsignal(), this string is not influenced by the current locale. no translation, just facts. π
The sigabbrev_np() function returns the abbreviated name of the signal, sig. For example, given the value SIGINT, it returns the string "INT". cute, short, iconic. β¨
The (deprecated) array sys_siglist holds the signal description strings indexed by signal number. The strsignal() or the sigdescr_np() function should be used instead of this array; see also VERSIONS.
β οΈ deprecated means deprecated bestie. the array is giving "2010 called and wants its code back." use the functions. π«Ά
π₯ RETURN VALUE π₯
The strsignal() function returns the appropriate description string, or an unknown signal message if the signal number is invalid. On some systems (but not on Linux), NULL may instead be returned for an invalid signal number. so on Linux: you get words. elsewhere: maybe NULL. vibe check accordingly. π
The sigdescr_np() and sigabbrev_np() functions return the appropriate description string. The returned string is statically allocated and valid for the lifetime of the program. These functions return NULL for an invalid signal number.
π ATTRIBUTES π
For an explanation of the terms used in this section, see attributes(7). (the original ships a whole table, so here it is as a list, but every cell is intact, promise π€)
strsignal()β Thread safety:MT-Unsafe race:strsignal localesigdescr_np(),sigabbrev_np()β Thread safety:MT-Safe
likeβ¦ strsignal() is out here racing and reading your locale at the same time. the np girlies are built different. π
β STANDARDS β
strsignal()β POSIX.1-2008.sigdescr_np()sigabbrev_np()β GNU.sys_siglistβ None.
π¦ HISTORY π¦
strsignal()β POSIX.1-2008. Solaris, BSD.sigdescr_np()sigabbrev_np()β glibc 2.32.sys_siglistβ Removed in glibc 2.32.
rip sys_siglist, you had a good run π―οΈ
πΈ NOTES πΈ
sigdescr_np() and sigabbrev_np() are thread-safe and async-signal-safe. slay. π
π SEE ALSO π
that's the whole page bestie, every flag, macro, NULL, and deprecation intact, periodt. π
signing off with the receipts: this is from Linux man-pages 6.20, dated 2026-07-26, and the page itself is literally called strsignal(3). π₯°
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: Linux-man-pages-copyleft
- Copyright 1993, David Metcalfe <david@prism.demon.co.uk>
- Copyright 2020, Michael Kerrisk <mtk.manpages@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms