VirtualBox

Changeset 3438 in kBuild for trunk/src/kash/trap.c


Ignore:
Timestamp:
Sep 9, 2020 8:01:39 PM (4 years ago)
Author:
bird
Message:

kash: Hammering on threaded mode.

File:
1 edited

Legend:

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

    r3435 r3438  
    8080static int getsigaction(shinstance *, int, shsig_t *);
    8181
     82#ifndef SH_FORKED_MODE
     83void
     84subshellinittrap(shinstance *psh, shinstance *inherit)
     85{
     86        /* The forkchild calls clear_traps(), we have to emulate that here. */
     87        unsigned i;
     88        memcpy(psh->sigmode, inherit->sigmode, sizeof(psh->sigmode));
     89        for (i = 0; i < K_ELEMENTS(inherit->trap); i++) {
     90                const char *src = inherit->trap[i];
     91                if (!src) {
     92                } else if (i > 0) {
     93                        setsignal(psh, i);
     94                }
     95        }
     96}
     97#endif
     98
     99
    82100/*
    83101 * return the signal number described by `p' (as a number or a name)
     
    210228                if (*tp && **tp) {      /* trap not NULL or SIG_IGN */
    211229                        INTOFF;
    212                         ckfree(psh, *tp);
    213                         *tp = NULL;
     230                        ckfree(psh, *tp);
     231                        *tp = NULL;
    214232                        if (tp != &psh->trap[0])
    215233                                setsignal(psh, (int)(tp - psh->trap));
     
    417435 */
    418436
    419 SH_NORETURN_1 void
    420 exitshell(shinstance *psh, int status)
     437int
     438exitshell2(shinstance *psh, int status)
    421439{
    422440        struct jmploc loc1, loc2;
    423441        char *p;
    424442
    425         TRACE((psh, "pid %d, exitshell(%d)\n", sh_getpid(psh), status));
     443        TRACE((psh, "pid %" SHPID_PRI ", exitshell(%d)\n", sh_getpid(psh), status));
    426444        if (setjmp(loc1.loc)) {
    427445                goto l1;
     
    435453                evalstring(psh, p, 0);
    436454        }
    437 l1:   psh->handler = &loc2;                     /* probably unnecessary */
     455l1:
     456        psh->handler = &loc2;                   /* probably unnecessary */
    438457        output_flushall(psh);
    439458#if JOBS
    440459        setjobctl(psh, 0);
    441460#endif
    442 l2: sh__exit(psh, status);
     461l2:
     462        return status;
     463}
     464
     465SH_NORETURN_1 void
     466exitshell(shinstance *psh, int status)
     467{
     468        sh__exit(psh, exitshell2(psh, status));
    443469        /* NOTREACHED */
    444470}
     471
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette