Search code examples
csignalschild-processkillwaitpid

Is this interpretation of signals correct?


We are in a parent process, and pid holds the child process ID. My question is, in this piece of code, are we just waiting for a stopped(WUNTRACED) / resumed(WCONTINUED) signal for the child process? Or we can accept a kill/stop signal as well?

waitpid(pid, &status, WUNTRACED | WCONTINUED);

Solution

  • waitpid() always returns when the process has exited. Those flags make it also return when one of the specified conditions has occurred to the process.