mirror of
https://github.com/apple/container.git
synced 2026-09-23 16:15:37 +00:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user