bin/csh/proc.c
/*
 * pwait - wait for current job to terminate, maintaining integrity
 *	of current and previous job indicators.
 */
wait for current job to terminate, maintaining integrity
of current and previous job indicators.
wait for current job to terminate maintaining integrity of current and previous job indicators .
void
pwait()
{
    register struct process *fp, *pp;
    sigset_t sigset, osigset;
    sigemptyset(&sigset);
    sigaddset(&sigset, SIGCHLD);
    sigprocmask(SIG_BLOCK, &sigset, &osigset);
    for (pp = (fp = &proclist)->p_next; pp != NULL; pp = (fp = pp)->p_next)
	if (pp->p_pid == 0) {
	    fp->p_next = pp->p_next;
	    xfree((ptr_t) pp->p_command);
	    if (pp->p_cwd && --pp->p_cwd->di_count == 0)
		if (pp->p_cwd->di_next == 0)
		    dfree(pp->p_cwd);
	    xfree((ptr_t) pp);
	    pp = fp;
	}
    sigprocmask(SIG_SETMASK, &osigset, NULL);
    pjwait(pcurrjob);
}
void pwait ( ) { register struct process * fp , * pp ; sigset_t sigset , osigset ; sigemptyset ( & sigset ) ; sigaddset ( & sigset , SIGCHLD ) ; sigprocmask ( SIG_BLOCK , & sigset , & osigset ) ; for ( pp = ( fp = & proclist ) -> p_next ; pp != NULL ; pp = ( fp = pp ) -> p_next ) if ( pp -> p_pid == 0 ) { fp -> p_next = pp -> p_next ; xfree ( ( ptr_t ) pp -> p_command ) ; if ( pp -> p_cwd && -- pp -> p_cwd -> di_count == 0 ) if ( pp -> p_cwd -> di_next == 0 ) dfree ( pp -> p_cwd ) ; xfree ( ( ptr_t ) pp ) ; pp = fp ; } sigprocmask ( SIG_SETMASK , & osigset , NULL ) ; pjwait ( pcurrjob ) ; }
pwait - wait for current job to terminate, maintaining integrity
      of current and previous job indicators.
pwait - wait for current job to terminate maintaining integrity of current and previous job indicators .
/*
     * Here's where dead procs get flushed.
     */