Respect user-defined exit signal in clone() and clone3()

When calling clone() and clone3(), the user is allowed to specify a
signal to be sent to the parent process on exit. Respect this value by
storing it in the Process struct and sending the signal on exit.

Add a test as well to verify that the signal is properly delivered to
the parent.
This commit is contained in:
Carlos López
2024-09-24 21:33:10 +02:00
committed by Tate, Hongliang Tian
parent 130a0f7030
commit 0a36760f7a
7 changed files with 122 additions and 14 deletions

View File

@ -345,6 +345,10 @@ fn clone_child_process(
process_builder.build()?
};
if let Some(sig) = clone_args.exit_signal {
child.set_exit_signal(sig);
};
// Deals with clone flags
let child_thread = thread_table::get_thread(child_tid).unwrap();
let child_posix_thread = child_thread.as_posix_thread().unwrap();