pid_t pgrp;
forkchild(struct job *jp, union node *n, int mode){	int oldlvl;	pid_t pgrp;	TRACE(("Child shell %d\n", getpid()));	oldlvl = shlvl;	shlvl++;	closescript();	clear_traps();#if JOBS	/* do job control only in root shell */	jobctl = 0;	if (mode != FORK_NOJOB && jp->jobctl && !oldlvl) {		if (jp->nprocs == 0)			pgrp = getpid();		else			pgrp = jp->ps[0].pid;		/* This can fail because we are doing it in the parent also */		(void)setpgid(0, pgrp);		if (mode == FORK_FG)			xtcsetpgrp(ttyfd, pgrp);		setsignal(SIGTSTP);		setsignal(SIGTTOU);	} else#endif	if (mode == FORK_BG) {		ignoresig(SIGINT);		ignoresig(SIGQUIT);		if (jp->nprocs == 0) {			close(0);			if (open(_PATH_DEVNULL, O_RDONLY) != 0)				sh_error("Can't open %s", _PATH_DEVNULL);		}	}	if (!oldlvl && iflag) {		setsignal(SIGINT);		setsignal(SIGQUIT);		setsignal(SIGTERM);	}	for (jp = curjob; jp; jp = jp->prev_job)		freejob(jp);	jobless = 0;}