From 1e5ad493fee821f7f96423c03b436da15a4efe60 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Thu, 4 Apr 2024 10:59:46 +0200 Subject: add syscall wrapper for prctl(PR_SET_PDEATHSIG, ...) --- linuxnamespaces/syscalls.py | 8 ++++++++ 1 file changed, 8 insertions(+) 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: -- cgit v1.2.3