Annotation of 43BSDReno/sys/tahoe/signal.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
        !             3:  * All rights reserved.  The Berkeley software License Agreement
        !             4:  * specifies the terms and conditions for redistribution.
        !             5:  *
        !             6:  *     %W% (Berkeley) %G%
        !             7:  */
        !             8: 
        !             9: #ifndef        NSIG
        !            10: #define NSIG   32              /* counting 0; could be 33 (mask is 1-32) */
        !            11: 
        !            12: #ifndef _POSIX_SOURCE
        !            13: #ifdef KERNEL
        !            14: #include "machine/trap.h"      /* codes for SIGILL, SIGFPE */
        !            15: #else
        !            16: #include <machine/trap.h>      /* codes for SIGILL, SIGFPE */
        !            17: #endif
        !            18: #endif /* _POSIX_SOURCE */
        !            19: 
        !            20: #define        SIGHUP  1       /* hangup */
        !            21: #define        SIGINT  2       /* interrupt */
        !            22: #define        SIGQUIT 3       /* quit */
        !            23: #define        SIGILL  4       /* illegal instruction (not reset when caught) */
        !            24: #ifndef _POSIX_SOURCE
        !            25: #define        SIGTRAP 5       /* trace trap (not reset when caught) */
        !            26: #endif
        !            27: #define        SIGABRT 6       /* abort() */
        !            28: #ifndef _POSIX_SOURCE
        !            29: #define        SIGIOT  SIGABRT /* compatibility */
        !            30: #define        SIGEMT  7       /* EMT instruction */
        !            31: #endif
        !            32: #define        SIGFPE  8       /* floating point exception */
        !            33: #define        SIGKILL 9       /* kill (cannot be caught or ignored) */
        !            34: #ifndef _POSIX_SOURCE
        !            35: #define        SIGBUS  10      /* bus error */
        !            36: #endif
        !            37: #define        SIGSEGV 11      /* segmentation violation */
        !            38: #ifndef _POSIX_SOURCE
        !            39: #define        SIGSYS  12      /* bad argument to system call */
        !            40: #endif
        !            41: #define        SIGPIPE 13      /* write on a pipe with no one to read it */
        !            42: #define        SIGALRM 14      /* alarm clock */
        !            43: #define        SIGTERM 15      /* software termination signal from kill */
        !            44: #ifndef _POSIX_SOURCE
        !            45: #define        SIGURG  16      /* urgent condition on IO channel */
        !            46: #endif
        !            47: #define        SIGSTOP 17      /* sendable stop signal not from tty */
        !            48: #define        SIGTSTP 18      /* stop signal from tty */
        !            49: #define        SIGCONT 19      /* continue a stopped process */
        !            50: #define        SIGCHLD 20      /* to parent on child stop or exit */
        !            51: #define        SIGTTIN 21      /* to readers pgrp upon background tty read */
        !            52: #define        SIGTTOU 22      /* like TTIN for output if (tp->t_local&LTOSTOP) */
        !            53: #ifndef _POSIX_SOURCE
        !            54: #define        SIGIO   23      /* input/output possible signal */
        !            55: #define        SIGXCPU 24      /* exceeded CPU time limit */
        !            56: #define        SIGXFSZ 25      /* exceeded file size limit */
        !            57: #define        SIGVTALRM 26    /* virtual time alarm */
        !            58: #define        SIGPROF 27      /* profiling time alarm */
        !            59: #define SIGWINCH 28    /* window size changes */
        !            60: #define SIGINFO        29      /* information request */
        !            61: #endif
        !            62: #define SIGUSR1 30     /* user defined signal 1 */
        !            63: #define SIGUSR2 31     /* user defined signal 2 */
        !            64: 
        !            65: #ifndef _POSIX_SOURCE
        !            66: typedef        void (*sig_t)();
        !            67: #endif /* _POSIX_SOURCE */
        !            68: #ifndef KERNEL
        !            69: void   (*signal())();
        !            70: #endif /* KERNEL */
        !            71: 
        !            72: typedef unsigned int sigset_t;
        !            73: 
        !            74: #define sigemptyset(set)       ( *(set) = 0 )
        !            75: #define sigfillset(set)                ( *(set) = ~(sigset_t)0 )
        !            76: #define sigaddset(set, signo)  ( *(set) |= 1 << ((signo) - 1), 0)
        !            77: #define sigdelset(set, signo)  ( *(set) &= ~(1 << ((signo) - 1)), 0)
        !            78: #define sigismember(set, signo)        ( (*(set) & (1 << ((signo) - 1))) != 0)
        !            79: 
        !            80: /*
        !            81:  * Signal vector "template" used in sigaction call.
        !            82:  */
        !            83: struct sigaction {
        !            84:        void    (*sa_handler)();        /* signal handler */
        !            85:        sigset_t sa_mask;               /* signal mask to apply */
        !            86:        int     sa_flags;               /* see signal options below */
        !            87: };
        !            88: #ifndef _POSIX_SOURCE
        !            89: #define SA_ONSTACK     0x0001  /* take signal on signal stack */
        !            90: #define SA_RESTART     0x0002  /* do not restart system on signal return */
        !            91: #endif /* _POSIX_SOURCE */
        !            92: #define SA_NOCLDSTOP   0x0004  /* do not generate SIGCHLD on child stop */
        !            93: 
        !            94: /*
        !            95:  * Flags for sigprocmask:
        !            96:  */
        !            97: #define        SIG_BLOCK       1       /* block specified signal set */
        !            98: #define        SIG_UNBLOCK     2       /* unblock specified signal set */
        !            99: #define        SIG_SETMASK     3       /* set specified signal set */
        !           100: 
        !           101: #ifndef _POSIX_SOURCE
        !           102: /*
        !           103:  * 4.3 compatibility:
        !           104:  * Signal vector "template" used in sigvec call.
        !           105:  */
        !           106: struct sigvec {
        !           107:        void    (*sv_handler)();        /* signal handler */
        !           108:        int     sv_mask;                /* signal mask to apply */
        !           109:        int     sv_flags;               /* see signal options below */
        !           110: };
        !           111: #define SV_ONSTACK     SA_ONSTACK
        !           112: #define SV_INTERRUPT   SA_RESTART      /* same bit, opposite sense */
        !           113: #define sv_onstack sv_flags    /* isn't compatibility wonderful! */
        !           114: 
        !           115: /*
        !           116:  * Structure used in sigstack call.
        !           117:  */
        !           118: struct sigstack {
        !           119:        char    *ss_sp;                 /* signal stack pointer */
        !           120:        int     ss_onstack;             /* current status */
        !           121: };
        !           122: 
        !           123: /*
        !           124:  * Information pushed on stack when a signal is delivered.
        !           125:  * This is used by the kernel to restore state following
        !           126:  * execution of the signal handler.  It is also made available
        !           127:  * to the handler to allow it to restore state properly if
        !           128:  * a non-standard exit is performed.
        !           129:  */
        !           130: struct sigcontext {
        !           131:        int     sc_onstack;             /* sigstack state to restore */
        !           132:        int     sc_mask;                /* signal mask to restore */
        !           133:        int     sc_sp;                  /* sp to restore */
        !           134:        int     sc_fp;                  /* fp to restore */
        !           135:        int     sc_ap;                  /* ap to restore */
        !           136:        int     sc_pc;                  /* pc to restore */
        !           137:        int     sc_ps;                  /* psl to restore */
        !           138: };
        !           139: 
        !           140: /*
        !           141:  * Macro for converting signal number to a mask suitable for
        !           142:  * sigblock().
        !           143:  */
        !           144: #define sigmask(m)     (1 << ((m)-1))
        !           145: 
        !           146: #define        BADSIG          (void (*)())-1
        !           147: #endif /* _POSIX_SOURCE */
        !           148: 
        !           149: #define        SIG_DFL         (void (*)())0
        !           150: #define        SIG_IGN         (void (*)())1
        !           151: 
        !           152: #ifdef KERNEL
        !           153: #define        SIG_CATCH       (void (*)())2
        !           154: #define        SIG_HOLD        (void (*)())3
        !           155: 
        !           156: #define        sigcantmask     (sigmask(SIGKILL)|sigmask(SIGSTOP))
        !           157: /*
        !           158:  * get signal action for process and signal; currently only for current process
        !           159:  */
        !           160: #define SIGACTION(p, sig)      (u.u_signal[(sig)])
        !           161: 
        !           162: /*
        !           163:  * Determine signal that should be delivered to process,
        !           164:  * 0 if none.
        !           165:  */
        !           166: #define        CURSIG(p) \
        !           167:        (((p)->p_sig == 0 || \
        !           168:            ((p)->p_flag&STRC) == 0 && ((p)->p_sig &~ (p)->p_sigmask) == 0) ? \
        !           169:            0 : issig())
        !           170: 
        !           171: #endif
        !           172: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.