Annotation of coherent/f/usr/include/common/_signal.h, revision 1.1.1.1

1.1       root        1: #ifndef        __COMMON__SIGNAL_H__
                      2: #define        __COMMON__SIGNAL_H__
                      3: 
                      4: #include <common/ccompat.h>
                      5: #include <common/_limits.h>
                      6: #include <common/_tricks.h>
                      7: 
                      8: /*
                      9:  * This header file contains a number of definitions for signal-related data
                     10:  * types which are variously used by kernel and user-level mechanisms to
                     11:  * support the variety of existing binary interfacs.
                     12:  */
                     13: 
                     14: /*
                     15:  * The following constant gives the number of signals for which kernel storage
                     16:  * is actually made available; this number is traditionally made available to
                     17:  * user code though the NSIG constant, although neither Standard C nor POSIX.1
                     18:  * applications can use this.
                     19:  */
                     20: 
                     21: #define        _SIGNAL_MAX             31
                     22: 
                     23: 
                     24: /*
                     25:  * Be aware that while ISO C and POSIX.1 specify the signature of a signal-
                     26:  * catching function as "void (*) (int sig)", extra parameters to the signal
                     27:  * functions are supported.
                     28:  */
                     29: 
                     30: typedef        void (* __sigfunc_t)    __PROTO ((__ANY_ARGS__));
                     31: 
                     32: 
                     33: /*
                     34:  * For dealing with signal actions. For maximum efficiency, we deal with
                     35:  * signals as collections of bit-vectors; various user-level binary
                     36:  * compatibility standards specify the lengths of the vectors, while the
                     37:  * kernel internally allocates exactly as much as is really needed.
                     38:  */
                     39: 
                     40: typedef        unsigned long           __sigmask_t;
                     41: 
                     42: typedef        struct {
                     43:        __sigmask_t     _sigbits [4];
                     44: } n_sigset_t;
                     45: 
                     46: typedef        struct {
                     47:        __sigmask_t     _sigbits [1];
                     48: } o_sigset_t;
                     49: 
                     50: typedef struct {
                     51:        __sigmask_t     _sigbits [__DIVIDE_ROUNDUP_CONST (_SIGNAL_MAX,
                     52:                                   __CHAR_BIT * sizeof (__sigmask_t))];
                     53: } __sigset_t;
                     54: 
                     55: /*
                     56:  * Signal-action flags that are relevant for all signals.
                     57:  */
                     58: 
                     59: enum {
                     60:        __SA_ONSTACK    = 1,
                     61:        __SA_RESETHAND  = 2,
                     62:        __SA_RESTART    = 4,
                     63:        __SA_SIGINFO    = 8,
                     64:        __SA_NODEFER    = 16
                     65: };
                     66: typedef        unsigned short  __sigactfl_t;
                     67: 
                     68: 
                     69: /*
                     70:  * Signal-action flags that are only relevant for particular signals.
                     71:  */
                     72: 
                     73: enum {
                     74:        __SF_NOCLDWAIT  = 1,
                     75:        __SF_NOCLDSTOP  = 2
                     76: };
                     77: 
                     78: typedef        unsigned short  __sigmiscfl_t;
                     79: 
                     80: 
                     81: /*
                     82:  * Some simple macros for dealing with the bit-set operations on sigset_t's.
                     83:  */
                     84: 
                     85: #define        __SIGSET_UNIT(ss,n)     \
                     86:        (sizeof ((ss)._sigbits) == sizeof (__sigmask_t) ? 0 : \
                     87:         (unsigned) ((n) - 1) / (sizeof (__sigmask_t) * __CHAR_BIT))
                     88: 
                     89: #define        __SIGSET_EMPTY(ss)      memset ((ss)._sigbits, 0, sizeof (ss))
                     90: #define        __SIGSET_FILL(ss)       memset ((ss)._sigbits, 0xFF, sizeof (ss));
                     91: 
                     92: #define        __SIGSET_MASK(n)        (1UL << ((unsigned) ((n) - 1) & \
                     93:                                  (sizeof (__sigmask_t) * __CHAR_BIT - 1)))
                     94: 
                     95: #define        __SIGSET_ADDBIT(ss,n)   \
                     96:                ((ss)._sigbits [__SIGSET_UNIT (ss, n)] |= __SIGSET_MASK (n))
                     97: #define        __SIGSET_CLRBIT(ss,n)   \
                     98:                ((ss)._sigbits [__SIGSET_UNIT (ss, n)] &= ~ __SIGSET_MASK (n))
                     99: #define        __SIGSET_TSTBIT(ss,n)   \
                    100:                (((ss)._sigbits [__SIGSET_UNIT (ss, n)] & \
                    101:                 __SIGSET_MASK (n)) != 0)
                    102: #define        __SIGSET_ADDMASK(ss,n,m)        \
                    103:                ((ss)._sigbits [__SIGSET_UNIT (ss, n)] |= (m))
                    104: #define        __SIGSET_CLRMASK(ss,n,m)        \
                    105:                ((ss)._sigbits [__SIGSET_UNIT (ss, n)] &= ~ (m))
                    106: #define        __SIGSET_TSTMASK(ss,n,m)        \
                    107:                (((ss)._sigbits [__SIGSET_UNIT (ss, n)] & (m)) != 0)
                    108: #define        __SIGSET_FIRSTBIT(mask)         (__LEAST_BIT_ULONG (mask) + 1)
                    109: 
                    110: 
                    111: #endif /* ! defined (__COMMON__SIGNAL_H__) */

unix.superglobalmegacorp.com

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