.\" Copyright, the authors of the Linux man-pages project .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" .TH PR_SET_PDEATHSIG 2const 2025-05-17 "Linux man-pages 6.16" .SH NAME PR_SET_PDEATHSIG \- set the parent-death signal of the calling process .SH LIBRARY Standard C library .RI ( libc ,\~ \-lc ) .SH SYNOPSIS .nf .BR "#include " " /* Definition of " PR_* " constants */" .B #include .P .BI "int prctl(PR_SET_PDEATHSIG, long " sig ); .fi .SH DESCRIPTION Set the parent-death signal of the calling process to .I sig (either a signal value in the range .RB [ 1 , .IR NSIG\~\-\~1 ], or .B 0 to clear). This is the signal that the calling process will get when its parent dies. .P The parent-death signal is sent upon subsequent termination of the parent thread and also upon termination of each subreaper process (see .BR PR_SET_CHILD_SUBREAPER (2const)) to which the caller is subsequently reparented. If the parent thread and all ancestor subreapers have already terminated by the time of the .B PR_SET_PDEATHSIG operation, then no parent-death signal is sent to the caller. .P The parent-death signal is process-directed (see .BR signal (7)) and, if the child installs a handler using the .BR sigaction (2) .B SA_SIGINFO flag, the .I si_pid field of the .I siginfo_t argument of the handler contains the PID of the terminating parent process. .P The parent-death signal setting is cleared for the child of a .BR fork (2). It is also (since Linux 2.4.36 / 2.6.23) .\" commit d2d56c5f51028cb9f3d800882eb6f4cbd3f9099f cleared when executing a set-user-ID or set-group-ID binary, or a binary that has associated capabilities (see .BR capabilities (7)); otherwise, this value is preserved across .BR execve (2). The parent-death signal setting is also cleared upon changes to any of the following thread credentials: .\" FIXME capability changes can also trigger this; see .\" kernel/cred.c::commit_creds in the Linux 5.6 source. effective user ID, effective group ID, filesystem user ID, or filesystem group ID. .SH RETURN VALUE On success, 0 is returned. On error, \-1 is returned, and .I errno is set to indicate the error. .SH ERRORS .TP .B EINVAL .I sig is not a valid signal number. .SH STANDARDS Linux. .SH HISTORY Linux 2.1.57. .SH CAVEATS .\" https://bugzilla.kernel.org/show_bug.cgi?id=43300 The "parent" in this case is considered to be the .I thread that created this process. In other words, the signal will be sent when that thread terminates (via, for example, .BR pthread_exit (3)), rather than after all of the threads in the parent process terminate. .SH SEE ALSO .BR prctl (2), .BR PR_GET_PDEATHSIG (2const)