FreeBSD/usr.bin/mail/popen.c
/*
 * Wait for a specific child to die.
 */
Wait for a specific child to die.
Wait for a specific child to die .
int
wait_child(int pid)
{
	sigset_t nset, oset;
	struct child *cp;
	(void)sigemptyset(&nset);
	(void)sigaddset(&nset, SIGCHLD);
	(void)sigprocmask(SIG_BLOCK, &nset, &oset);	
	cp = findchild(pid);
	while (!cp->done)
		(void)sigsuspend(&oset);
	wait_status = cp->status;
	delchild(cp);
	(void)sigprocmask(SIG_SETMASK, &oset, NULL);
	return ((WIFEXITED(wait_status) && WEXITSTATUS(wait_status)) ? -1 : 0);
}
int wait_child ( int pid ) { sigset_t nset , oset ; struct child * cp ; ( void ) sigemptyset ( & nset ) ; ( void ) sigaddset ( & nset , SIGCHLD ) ; ( void ) sigprocmask ( SIG_BLOCK , & nset , & oset ) ; cp = findchild ( pid ) ; while ( ! cp -> done ) ( void ) sigsuspend ( & oset ) ; wait_status = cp -> status ; delchild ( cp ) ; ( void ) sigprocmask ( SIG_SETMASK , & oset , NULL ) ; return ( ( WIFEXITED ( wait_status ) && WEXITSTATUS ( wait_status ) ) ? -1 : 0 ) ; }
Wait for a specific child to die.
Wait for a specific child to die .