[OT] poll() vs. AIO
Timo Teräs
timo.teras at iki.fi
Mon Aug 22 06:39:31 UTC 2011
On 08/22/2011 09:33 AM, Laurent Bercot wrote:
> - it isn't a very satisfactory API, because the termination notification
> (SIGCHLD) is too generic, and identification of the event (wait/waitpid)
> is messy. It would be much better if the signal could carry a payload
> containing both the pid of the dead process and its exit status, and
> could be requeued after examination. Or if a simple EOF could also
> carry this information.
>
> - It requires a convention between the main caller and the libraries;
> notably, libraries should never waitpid(), and thus should detect their
> subprocesses' termination via EOF, which means that they cannot read an
> exit status.
Just to note that POSIX does specify sigaction().
Signal handler set using this will get additional siginfo_t structure
where you get all that info for SIGCHLD: child's PID, uid, exit code, etc.
You can also specify SA_NOCLDWAIT so the child is never turned to zombie
(but you still get the signal with the details), and call to waitpid()
is not needed.
- Timo
More information about the busybox
mailing list