c - waitpid returns pid=0 and WIFEXITED=1 how to get pid? -


steps:

fork , start process in different program group
stop process sigtstp
restart process sigcont
process ends

problem: sigchld handler has:

waitpid(-1, &status, wnohang | wuntraced); 

upon return pid=0 , wifexited=1 so, process exited, can't pid? need pid.

man page: "if wnohang specified , 1 or more child(ren) specified pid exist, have not yet changed state, 0 returned"
but seems status has changed exited.

the status meaningless if pid returned 0. think it. return of 0 means have 1 or more children have yet change state. state of child has yet change state be? if there multiple children, child status code referencing?

this analogous checking errno on successful call. previous call can in errno has nothing recent successful call because errno not set on success.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -