Implement pdeathSignal handling in Runc (#431)

Add support for parent death signal (pdeathSignal) to ensure child
processes receive a signal when the parent process dies. This addresses
the FIXME comment in Runc.execute().

## Changes
- Add pdeathSignal field to exec_command_attrs C struct
- Implement prctl(PR_SET_PDEATHSIG) in child process handler (Linux
only)
- Expose pdeathSignal through Command.Attrs Swift API
- Wire up pdeathSignal in Runc.execute() to remove FIXME

## Implementation Details
The implementation uses Linux-specific prctl() to set the parent death
signal, ensuring proper cleanup when parent processes terminate. The
feature is conditionally compiled for Linux only, maintaining
compatibility with other platforms.
This commit is contained in:
GAUTAM RAJU
2025-12-01 02:35:09 -08:00
committed by GitHub
parent 4a8f945f87
commit 031cd72e2a
4 changed files with 27 additions and 2 deletions
+2
View File
@@ -38,6 +38,8 @@ struct exec_command_attrs {
gid_t gid;
/// signal mask for the child process
int mask;
/// parent death signal (Linux only, 0 to disable)
int pdeathSignal;
};
void exec_command_attrs_init(struct exec_command_attrs *attrs);