Lines Matching refs:shp
63 register Shell_t *shp = sh_getinterp(); in sh_fault() local
66 register struct checkpt *pp = (struct checkpt*)shp->jmplist; in sh_fault()
82 shp->winch++; in sh_fault()
85 if(shp->savesig) in sh_fault()
88 shp->savesig = sig; in sh_fault()
91 trap = shp->st.trapcom[sig]; in sh_fault()
92 if(sig==SIGALRM && shp->bltinfun==b_sleep) in sh_fault()
96 shp->trapnote |= SH_SIGTRAP; in sh_fault()
97 shp->sigflag[sig] |= SH_SIGTRAP; in sh_fault()
101 if(shp->subshell && sig!=SIGINT && sig!=SIGQUIT && sig!=SIGWINCH && sig!=SIGCONT) in sh_fault()
103 shp->exitval = SH_EXITSIG|sig; in sh_fault()
105 shp->exitval = 0; in sh_fault()
111 flag = shp->sigflag[sig]&~SH_SIGOFF; in sh_fault()
114 if(sig==SIGINT && (shp->trapnote&SH_SIGIGNORE)) in sh_fault()
121 …if((flag&SH_SIGINTERACTIVE) && sh_isstate(SH_INTERACTIVE) && !sh_isstate(SH_FORKED) && ! shp->subs… in sh_fault()
125 shp->trapnote |= SH_SIGTERM; in sh_fault()
128 shp->lastsig = sig; in sh_fault()
138 if(!shp->subshell) in sh_fault()
139 sh_done(shp,sig); in sh_fault()
143 shp->trapnote |= SH_SIGSET; in sh_fault()
144 if(sig <= shp->sigmax) in sh_fault()
145 shp->sigflag[sig] |= SH_SIGSET; in sh_fault()
161 shp->lastsig = sig; in sh_fault()
173 shp->lastsig = sig; in sh_fault()
178 shp->trapnote |= SH_SIGTSTP; in sh_fault()
189 if((error_info.flags&ERROR_NOTIFY) && shp->bltinfun) in sh_fault()
190 action = (*shp->bltinfun)(-sig,(char**)0,(void*)0); in sh_fault()
194 if(shp->bltinfun && shp->bltindata.notify) in sh_fault()
196 shp->bltindata.sigset = 1; in sh_fault()
199 shp->trapnote |= flag; in sh_fault()
200 if(sig <= shp->sigmax) in sh_fault()
201 shp->sigflag[sig] |= flag; in sh_fault()
216 Shell_t *shp = (Shell_t*)ptr; in sh_siginit() local
224 shp->sigruntime[SH_SIGRTMIN] = n; in sh_siginit()
225 shp->sigruntime[SH_SIGRTMAX] = sig; in sh_siginit()
235 sig = shp->sigruntime[sig]; in sh_siginit()
241 shp->sigmax = n++; in sh_siginit()
242 shp->st.trapcom = (char**)calloc(n,sizeof(char*)); in sh_siginit()
243 shp->sigflag = (unsigned char*)calloc(n,1); in sh_siginit()
244 shp->sigmsg = (char**)calloc(n,sizeof(char*)); in sh_siginit()
248 if((sig &= ((1<<SH_SIGBITS)-1)) > (shp->sigmax+1)) in sh_siginit()
252 sig = shp->sigruntime[sig]; in sh_siginit()
255 shp->sigflag[sig] = n; in sh_siginit()
257 shp->sigmsg[sig] = (char*)tp->sh_value; in sh_siginit()
437 Shell_t *shp = sh_getinterp(); in sh_trap() local
438 int jmpval, savxit = shp->exitval; in sh_trap()
447 memcpy(ifstable,shp->ifstable,sizeof(ifstable)); in sh_trap()
450 shp->intrap++; in sh_trap()
474 savxit = shp->exitval; in sh_trap()
479 shp->intrap--; in sh_trap()
480 sfsync(shp->outpool); in sh_trap()
481 if(!shp->indebug && jmpval!=SH_JMPEXIT && jmpval!=SH_JMPFUN) in sh_trap()
482 shp->exitval=savxit; in sh_trap()
485 memcpy(shp->ifstable,ifstable,sizeof(ifstable)); in sh_trap()
491 …if(jmpval>SH_JMPTRAP && (((struct checkpt*)shp->jmpbuffer)->prev || ((struct checkpt*)shp->jmpbuff… in sh_trap()
492 siglongjmp(*shp->jmplist,jmpval); in sh_trap()
493 return(shp->exitval); in sh_trap()
501 Shell_t *shp = &sh; in sh_exit() local
502 register struct checkpt *pp = (struct checkpt*)shp->jmplist; in sh_exit()
505 shp->exitval=xno; in sh_exit()
507 shp->exitval |= (sig=shp->lastsig); in sh_exit()
509 if(shp->trapnote&SH_SIGTSTP) in sh_exit()
512 shp->trapnote = 0; in sh_exit()
513 shp->sigflag[SIGTSTP] = 0; in sh_exit()
514 if(!shp->subshell && sh_isstate(SH_MONITOR) && !sh_isstate(SH_STOPOK)) in sh_exit()
519 shp->lastsig = 0; in sh_exit()
522 shp->trapnote = 0; in sh_exit()
523 if(!shp->subshell && (sig=sh_fork(0,NIL(int*)))) in sh_exit()
529 shp->sigflag[SIGTSTP] = 0; in sh_exit()
531 shp->exitval = (SH_EXITSIG|SIGTSTP); in sh_exit()
537 if(shp->subshell) in sh_exit()
542 shp->sigflag[SIGTSTP] = 0; in sh_exit()
547 shp->forked = 1; in sh_exit()
548 shp->exitval = (xno&SH_EXITMASK); in sh_exit()
555 if(!(pool=sfpool(NIL(Sfio_t*),shp->outpool,SF_WRITE))) in sh_exit()
556 pool = shp->outpool; /* can't happen? */ in sh_exit()
559 if(shp->lastsig==SIGPIPE) in sh_exit()
564 sh_done(shp,sig); in sh_exit()
565 shp->prefix = 0; in sh_exit()
567 shp->mktype = 0; in sh_exit()
570 sh_done(shp,sig); in sh_exit()
589 Shell_t *shp = (Shell_t*)ptr; in sh_done() local
591 register int savxit = shp->exitval; in sh_done()
592 shp->trapnote = 0; in sh_done()
596 if(shp->userinit) in sh_done()
597 (*shp->userinit)(shp, -1); in sh_done()
598 if(t=shp->st.trapcom[0]) in sh_done()
600 shp->st.trapcom[0]=0; /*should free but not long */ in sh_done()
601 shp->oldexit = savxit; in sh_done()
603 savxit = shp->exitval; in sh_done()
611 nv_scan(shp->var_tree,array_notify,(void*)0,NV_ARRAY,NV_ARRAY); in sh_done()
612 sh_freeup(shp); in sh_done()
621 …if((sh_isoption(SH_INTERACTIVE) && shp->login_sh) || (!sh_isoption(SH_INTERACTIVE) && (sig==SIGHUP… in sh_done()
624 job_close(shp); in sh_done()
625 if(nv_search("VMTRACE", shp->var_tree,0)) in sh_done()
628 sfsync((Sfio_t*)shp->outpool); in sh_done()
642 kiaclose((Lex_t*)shp->lex_context); in sh_done()