Let's assume that our process creates a child and then calls wait()
.
When I try to send signal() or do
kill -SIGCHLD <PID>
nothing happens at all.
So the question is: How does the process in Linux determine that signal SIGCHLD
hadn't been sent by the child? Or, maybe, there is some another mechanism?
The kernel takes care of this.
wait()
is not a signal handler listening for (any) SIGCHLD
sent to a process, as it might be established via sigaction()
or signal()
.
From wait()
's POSIX spec (emphasis by me):
The wait() and waitpid() functions shall obtain status information pertaining to one of the caller's child processes.