Debian Codegraph @

upstream/debian-unstable/man2/PR_SET_PDEATHSIG.2const

raw
1 .\" Copyright 1998, Andries E. Brouwer <[email protected]>
2 .\" Copyright 2002-2015, Michael Kerrisk <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH PR_SET_PDEATHSIG 2const 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 PR_SET_PDEATHSIG
10 \-
11 set the parent-death signal of the calling process
12 .SH LIBRARY
13 Standard C library
14 .RI ( libc ,\~ \-lc )
15 .SH SYNOPSIS
16 .nf
17 .BR "#include <linux/prctl.h>" " /* Definition of " PR_* " constants */"
18 .B #include <sys/prctl.h>
19 .P
20 .BI "int prctl(PR_SET_PDEATHSIG, long " sig );
21 .fi
22 .SH DESCRIPTION
23 Set the parent-death signal
24 of the calling process to
25 .I sig
26 (either a signal value
27 in the range
28 .RB [ 1 ,
29 .IR NSIG\~\-\~1 ],
30 or
31 .B 0
32 to clear).
33 This is the signal that the calling process will get when its
34 parent dies.
35 .P
36 The parent-death signal is sent
37 upon subsequent termination of the parent thread
38 and also upon termination of each subreaper process
39 (see
40 .BR PR_SET_CHILD_SUBREAPER (2const))
41 to which the caller is subsequently reparented.
42 If the parent thread and all ancestor subreapers have already terminated
43 by the time of the
44 .B PR_SET_PDEATHSIG
45 operation, then no parent-death signal is sent to the caller.
46 .P
47 The parent-death signal is process-directed (see
48 .BR signal (7))
49 and, if the child installs a handler using the
50 .BR sigaction (2)
51 .B SA_SIGINFO
52 flag, the
53 .I si_pid
54 field of the
55 .I siginfo_t
56 argument of the handler contains the PID of the terminating parent process.
57 .P
58 The parent-death signal setting is cleared for the child of a
59 .BR fork (2).
60 It is also
61 (since Linux 2.4.36 / 2.6.23)
62 .\" commit d2d56c5f51028cb9f3d800882eb6f4cbd3f9099f
63 cleared when executing a set-user-ID or set-group-ID binary,
64 or a binary that has associated capabilities (see
65 .BR capabilities (7));
66 otherwise, this value is preserved across
67 .BR execve (2).
68 The parent-death signal setting is also cleared upon changes to
69 any of the following thread credentials:
70 .\" FIXME capability changes can also trigger this; see
71 .\" kernel/cred.c::commit_creds in the Linux 5.6 source.
72 effective user ID, effective group ID, filesystem user ID,
73 or filesystem group ID.
74 .SH RETURN VALUE
75 On success,
76 0 is returned.
77 On error, \-1 is returned, and
78 .I errno
79 is set to indicate the error.
80 .SH ERRORS
81 .TP
82 .B EINVAL
83 .I sig
84 is not a valid signal number.
85 .SH STANDARDS
86 Linux.
87 .SH HISTORY
88 Linux 2.1.57.
89 .SH CAVEATS
90 .\" https://bugzilla.kernel.org/show_bug.cgi?id=43300
91 The "parent" in this case is considered to be the
92 .I thread
93 that created this process.
94 In other words, the signal will be sent when that thread terminates
95 (via, for example,
96 .BR pthread_exit (3)),
97 rather than after all of the threads in the parent process terminate.
98 .SH SEE ALSO
99 .BR prctl (2),
100 .BR PR_GET_PDEATHSIG (2const)