Lines Matching refs:shp

198 void job_chldtrap(Shell_t *shp, const char *trap, int unpost)
204 shp->sigflag[SIGCHLD] &= ~SH_SIGTRAP;
205 trapnote = shp->trapnote;
206 shp->trapnote = 0;
213 bckpid = shp->bckpid;
214 oldexit = shp->savexit;
215 shp->bckpid = pw->p_pid;
216 shp->savexit = pw->p_exit;
218 shp->savexit |= SH_EXITSIG;
222 shp->savexit = oldexit;
223 shp->bckpid = bckpid;
225 shp->trapnote = trapnote;
263 char *sh_pid2str(Shell_t *shp,pid_t pid)
276 sfprintf(shp->strbuf,"%s.%d%c",csp->name,pid&0xff,0);
278 sfprintf(shp->strbuf,"%d%c",pid,0);
279 return(sfstruse(shp->strbuf));
284 Shell_t *shp = sh_getinterp();
324 shp->exitval = fun?1:ERROR_NOENT;
326 shp->exitval = r;
338 Shell_t *shp = sh_getinterp();
345 Waitevent_f waitevent = shp->gd->waitevent;
375 shp->gd->waitevent = 0;
419 sh_sigcheck(shp);
480 if(pid==shp->cpid)
487 else if(shp->subshell)
519 if(shp->st.trapcom[SIGCHLD])
521 shp->sigflag[SIGCHLD] |= SH_SIGTRAP;
523 job_chldtrap(shp,shp->st.trapcom[SIGCHLD],0);
525 shp->trapnote |= SH_SIGTRAP;
555 if(!shp->intrap && shp->st.trapcom[SIGCHLD] && pid>0 && (pwfg!=job_bypid(pid)))
557 shp->sigflag[SIGCHLD] |= SH_SIGTRAP;
558 shp->trapnote |= SH_SIGTRAP;
570 shp->gd->waitevent = waitevent;
601 void job_init(Shell_t *shp, int lflag)
642 setpgid(0,shp->gd->pid);
650 sh_iorenumber(shp,fd,JOBTTY);
651 job.mypgid = shp->gd->pid;
653 tcsetpgrp(JOBTTY,shp->gd->pid);
654 setpgid(0,shp->gd->pid);
668 kill(shp->gd->pid,SIGTTIN);
709 setpgid(0,shp->gd->pid);
723 tcsetpgrp(JOBTTY,shp->gd->pid);
736 job.mypid = shp->gd->pid;
746 int job_close(Shell_t* shp)
778 else if(running && shp->login_sh)
825 Shell_t *shp = pw->p_shp;
834 if((pw->p_flag&P_STOPPED) || tcgetpgrp(job.fd) == shp->gd->pid)
837 if(!shp->forked)
839 shp->forked = 0;
997 Shell_t *shp = sh_getinterp();
1004 if(pw->p_env != shp->jobenv)
1011 sfprintf(outfile,"%s\n",sh_pid2str(shp,px->p_pgrp?px->p_pgrp:px->p_pid));
1035 sfprintf(outfile,"%s\t",sh_pid2str(shp,px->p_pid));
1114 Shell_t *shp = pw->p_shp;
1138 if(sig==SIGSTOP && pid==shp->gd->pid && shp->gd->ppid==1)
1252 Shell_t *shp = sh_getinterp();
1255 register int j = BYTE(shp->gd->lim.child_max);
1295 int job_post(Shell_t *shp,pid_t pid, pid_t join)
1298 register History_t *hp = shp->gd->hist_ptr;
1304 shp->jobenv = shp->curenv;
1361 if(shp->coshell && (pid&COPID_BIT))
1363 pw->p_cojob = ((struct cosh*)shp->coshell)->cojob;
1368 pw->p_shp = shp;
1369 pw->p_env = shp->curenv;
1371 if(!shp->outpipe || shp->cpid==pid)
1373 pw->p_exitmin = shp->xargexit;
1487 Shell_t *shp = sh_getinterp();
1512 if(pid==shp->spid)
1513 shp->spid = 0;
1517 if((shp->exitval = job_chksave(pid)) < 0)
1518 shp->exitval = ERROR_NOENT;
1523 else if(intr && pw->p_env!=shp->curenv)
1525 shp->exitval = ERROR_NOENT;
1542 if(shp->coutpipe>=0 && lastpid && shp->cpid==lastpid)
1544 sh_close(shp->coutpipe);
1545 sh_close(shp->cpipe[1]);
1546 shp->cpipe[1] = shp->coutpipe = -1;
1604 shp->exitval=px->p_exit;
1606 shp->exitval |= SH_EXITSIG;
1625 if(shp->sigflag[SIGALRM]&SH_SIGTRAP)
1626 sh_timetraps(shp);
1627 if((intr && shp->trapnote) || (pid==1 && !intr))
1630 if(intr && shp->trapnote)
1631 shp->exitval = 1;
1643 if((pw->p_flag&P_SIGNALLED) && pw->p_exit==SIGINT && !(shp->sigflag[SIGINT]&SH_SIGOFF))
1666 if(!shp->intrap)