PR_SET_PDEATHSIG(2const)
π PR_SET_PDEATHSIG π
okay bestie, welcome to PR_SET_PDEATHSIG(2const) β it's a Linux thing, it lives in the prctl family, and it's honestly giving "your parent died so here's a signal, no cap". let's get into it π«Ά
β¨ NAME β¨
PR_SET_PDEATHSIG β set the parent-death signal of the calling process π
π LIBRARY π
Standard C library (libc, -lc) β the classic, the icon, the one you already have π
πΈ SYNOPSIS πΈ
#include <linux/prctl.h> /* Definition of PR_* constants */
#include <sys/prctl.h>
int prctl(PR_SET_PDEATHSIG, long sig);
π« DESCRIPTION π«
so basically, this sets the parent-death signal of the calling process to sig. and sig can be either a signal value in the range [1, NSIG - 1], or 0 to clear the whole thing. this is, literally, the signal that the calling process will get when its parent dies π
the parent-death signal gets sent upon subsequent termination of the parent thread, and also upon termination of each subreaper process (peep PR_SET_CHILD_SUBREAPER(2const)) to which the caller is subsequently reparented. and if the parent thread and all ancestor subreapers have already terminated by the time of the PR_SET_PDEATHSIG operation? then no parent-death signal is sent to the caller. nothing. radio silence. periodt π
the parent-death signal is process-directed (see signal(7)), and if the child installs a handler using the sigaction(2) SA_SIGINFO flag, then the si_pid field of the siginfo_t argument of the handler contains the PID of the terminating parent process. like, the receipts are right there in the struct π
now the part you gotta remember or you WILL get got: the parent-death signal setting is cleared for the child of a fork(2). it's also (since Linux 2.4.36 / 2.6.23) cleared when executing a set-user-ID or set-group-ID binary, or a binary that has associated capabilities (see capabilities(7)); otherwise, this value is preserved across execve(2). and it ALSO gets cleared upon changes to any of these thread credentials: effective user ID, effective group ID, filesystem user ID, or filesystem group ID. so many little ways to lose it, bestie, stay woke π
π₯ RETURN VALUE π₯
- On success,
0is returned π₯³ - On error,
-1is returned, anderrnois set to indicate the error π
π ERRORS π
EINVALβsigis not a valid signal number. not a vibe. fix it.
π STANDARDS π
Linux. that's it, that's the whole section. main character energy only π
π¦ HISTORY π¦
Linux 2.1.57 β an elder, an ancestor, iconic since day one β
β οΈ CAVEATS β οΈ
okay this is the important one, read it twice π
the "parent" in this case is considered to be the thread that created this process. in other words? the signal will be sent when that thread terminates (via, for example, pthread_exit(3)), rather than after all of the threads in the parent process terminate. so it's not "the whole parent process is gone" β it's "that specific thread dipped" π ngl this trips people up every single time.
π SEE ALSO π
that's the whole page bestie, go forth and set your parent-death signals responsibly π β¨
signing off with love β this was the Linux man-pages version 6.20, dated 2026-02-08, for PR_SET_PDEATHSIG(2const) π«ΆπΈ
π¦ 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 1998, Andries E. Brouwer <aeb@cwi.nl>
- Copyright 2002-2015, 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