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

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -