mod.rs |
Unix handling of child processes.
Right now the only "fancy" thing about this is how we implement the
`Future` implementation on `Child` to get the exit status. Unix offers
no way to register a child with epoll, and the only real way to get a
notification when a process exits is the SIGCHLD signal.
Signal handling in general is *super* hairy and complicated, and it's even
more complicated here with the fact that signals are coalesced, so we may
not get a SIGCHLD-per-child.
Our best approximation here is to check *all spawned processes* for all
SIGCHLD signals received. To do that we create a `Signal`, implemented in
the `tokio-net` crate, which is a stream over signals being received.
Later when we poll the process's exit status we simply check to see if a
SIGCHLD has happened since we last checked, and while that returns "yes" we
keep trying.
Note that this means that this isn't really scalable, but then again
processes in general aren't scalable (e.g. millions) so it shouldn't be that
bad in theory... |
10486 |
orphan.rs |
|
10270 |
pidfd_reaper.rs |
|
8446 |
reap.rs |
|
8531 |