summaryrefslogtreecommitdiff
path: root/linuxnamespaces
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2024-04-04 10:59:46 +0200
committerHelmut Grohne <helmut@subdivi.de>2024-04-04 10:59:46 +0200
commit1e5ad493fee821f7f96423c03b436da15a4efe60 (patch)
tree306453e1e76ba9e64595d7465130e4aa4a399491 /linuxnamespaces
parent48f9486a2daa1e43f13dc87e71ddc7e0e63ba7c2 (diff)
downloadpython-linuxnamespaces-1e5ad493fee821f7f96423c03b436da15a4efe60.tar.gz
add syscall wrapper for prctl(PR_SET_PDEATHSIG, ...)
Diffstat (limited to 'linuxnamespaces')
-rw-r--r--linuxnamespaces/syscalls.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/linuxnamespaces/syscalls.py b/linuxnamespaces/syscalls.py
index be49632..d7154fc 100644
--- a/linuxnamespaces/syscalls.py
+++ b/linuxnamespaces/syscalls.py
@@ -343,6 +343,7 @@ class OpenTreeFlags(enum.IntFlag):
class PrctlOption(enum.IntEnum):
"""This value may be supplied to prctl(2) as option."""
+ PR_SET_PDEATHSIG = 1
PR_CAP_AMBIENT = 47
@@ -657,6 +658,13 @@ def prctl_raise_ambient_capabilities(capabilities: int) -> None:
)
+def prctl_set_pdeathsig(signum: int) -> None:
+ """Set the parent-death signal of the calling process."""
+ if signum < 0:
+ raise ValueError("invalid signal number")
+ prctl(PrctlOption.PR_SET_PDEATHSIG, signum)
+
+
def setns(fd: int, nstype: CloneFlags = CloneFlags.NONE) -> None:
"""Python wrapper for setns(2)."""
if fd < 0: