Changeset 3435 for trunk/src/kash/trap.c


Ignore:
Timestamp:
Sep 2, 2020, 10:30:54 PM (5 years ago)
Author:
bird
Message:

kash: Remove vfork code, we've never used it and we wont need it if we replace fork() with pthreads.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kash/trap.c

    r3409 r3435  
    187187
    188188                if (signo != 0)
    189                         setsignal(psh, signo, 0);
     189                        setsignal(psh, signo);
    190190                INTON;
    191191                ap++;
     
    203203
    204204void
    205 clear_traps(shinstance *psh, int vforked)
     205clear_traps(shinstance *psh)
    206206{
    207207        char **tp;
     
    210210                if (*tp && **tp) {      /* trap not NULL or SIG_IGN */
    211211                        INTOFF;
    212                         if (!vforked) {
    213                                 ckfree(psh, *tp);
    214                                 *tp = NULL;
    215                         }
     212                        ckfree(psh, *tp);
     213                        *tp = NULL;
    216214                        if (tp != &psh->trap[0])
    217                                 setsignal(psh, (int)(tp - psh->trap), vforked);
     215                                setsignal(psh, (int)(tp - psh->trap));
    218216                        INTON;
    219217                }
     
    229227
    230228void
    231 setsignal(shinstance *psh, int signo, int vforked)
     229setsignal(shinstance *psh, int signo)
    232230{
    233231        int action;
     
    241239        else
    242240                action = S_IGN;
    243         if (psh->rootshell && !vforked && action == S_DFL) {
     241        if (psh->rootshell && action == S_DFL) {
    244242                switch (signo) {
    245243                case SIGINT:
     
    298296                case S_IGN:     sigact = SH_SIG_IGN;    break;
    299297        }
    300         if (!vforked)
    301                 *t = action;
     298        *t = action;
    302299        sh_siginterrupt(psh, signo, 1);
    303300        sh_signal(psh, signo, sigact);
     
    323320
    324321void
    325 ignoresig(shinstance *psh, int signo, int vforked)
     322ignoresig(shinstance *psh, int signo)
    326323{
    327324        if (psh->sigmode[signo - 1] != S_IGN && psh->sigmode[signo - 1] != S_HARD_IGN) {
    328325                sh_signal(psh, signo, SH_SIG_IGN);
    329326        }
    330         if (!vforked)
    331                 psh->sigmode[signo - 1] = S_HARD_IGN;
     327        psh->sigmode[signo - 1] = S_HARD_IGN;
    332328}
    333329
     
    340336        char *sm;
    341337
    342         clear_traps(psh, 0);
     338        clear_traps(psh);
    343339        for (sm = psh->sigmode ; sm < psh->sigmode + NSIG ; sm++) {
    344340                if (*sm == S_IGN)
     
    409405        if (on == is_interactive)
    410406                return;
    411         setsignal(psh, SIGINT, 0);
    412         setsignal(psh, SIGQUIT, 0);
    413         setsignal(psh, SIGTERM, 0);
     407        setsignal(psh, SIGINT);
     408        setsignal(psh, SIGQUIT);
     409        setsignal(psh, SIGTERM);
    414410        is_interactive = on;
    415411}
Note: See TracChangeset for help on using the changeset viewer.