gonzui


Format: Advanced Search

t2ex/bsd_source/lib/libc/src_bsd/include/sys/signal.hbare sourcepermlink (0.02 seconds)

Search this content:

    1: /*      $OpenBSD: signal.h,v 1.23 2011/11/22 21:13:30 guenther Exp $ */
    2: /*      $NetBSD: signal.h,v 1.21 1996/02/09 18:25:32 christos Exp $  */
    3: 
    4: /*
    5:  * Copyright (c) 1982, 1986, 1989, 1991, 1993
    6:  *      The Regents of the University of California.  All rights reserved.
    7:  * (c) UNIX System Laboratories, Inc.
    8:  * All or some portions of this file are derived from material licensed
    9:  * to the University of California by American Telephone and Telegraph
   10:  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
   11:  * the permission of UNIX System Laboratories, Inc.
   12:  *
   13:  * Redistribution and use in source and binary forms, with or without
   14:  * modification, are permitted provided that the following conditions
   15:  * are met:
   16:  * 1. Redistributions of source code must retain the above copyright
   17:  *    notice, this list of conditions and the following disclaimer.
   18:  * 2. Redistributions in binary form must reproduce the above copyright
   19:  *    notice, this list of conditions and the following disclaimer in the
   20:  *    documentation and/or other materials provided with the distribution.
   21:  * 3. Neither the name of the University nor the names of its contributors
   22:  *    may be used to endorse or promote products derived from this software
   23:  *    without specific prior written permission.
   24:  *
   25:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   26:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   27:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   28:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   29:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   30:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   31:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   32:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   33:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   34:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   35:  * SUCH DAMAGE.
   36:  *
   37:  *      @(#)signal.h 8.2 (Berkeley) 1/21/94
   38:  */
   39: 
   40: #ifndef _SYS_SIGNAL_H_
   41: #define _SYS_SIGNAL_H_
   42: 
   43: #include <sys/cdefs.h>
   44: #include <machine/signal.h>     /* sigcontext; codes for SIGILL, SIGFPE */
   45: 
   46: #define _NSIG   33                /* counting 0 (mask is 1-32) */
   47: 
   48: #if __BSD_VISIBLE
   49: #define NSIG _NSIG
   50: #endif
   51: 
   52: #define SIGHUP  1        /* hangup */
   53: #define SIGINT  2        /* interrupt */
   54: #define SIGQUIT 3       /* quit */
   55: #define SIGILL  4        /* illegal instruction (not reset when caught) */
   56: #define SIGTRAP 5       /* trace trap (not reset when caught) */
   57: #define SIGABRT 6       /* abort() */
   58: #if __BSD_VISIBLE
   59: #define SIGIOT  SIGABRT  /* compatibility */
   60: #define SIGEMT  7        /* EMT instruction */
   61: #endif
   62: #define SIGFPE  8        /* floating point exception */
   63: #define SIGKILL 9       /* kill (cannot be caught or ignored) */
   64: #define SIGBUS  10       /* bus error */
   65: #define SIGSEGV 11      /* segmentation violation */
   66: #define SIGSYS  12       /* bad argument to system call */
   67: #define SIGPIPE 13      /* write on a pipe with no one to read it */
   68: #define SIGALRM 14      /* alarm clock */
   69: #define SIGTERM 15      /* software termination signal from kill */
   70: #define SIGURG  16       /* urgent condition on IO channel */
   71: #define SIGSTOP 17      /* sendable stop signal not from tty */
   72: #define SIGTSTP 18      /* stop signal from tty */
   73: #define SIGCONT 19      /* continue a stopped process */
   74: #define SIGCHLD 20      /* to parent on child stop or exit */
   75: #define SIGTTIN 21      /* to readers pgrp upon background tty read */
   76: #define SIGTTOU 22      /* like TTIN for output if (tp->t_local&LTOSTOP) */
   77: #if __BSD_VISIBLE
   78: #define SIGIO   23        /* input/output possible signal */
   79: #endif
   80: #define SIGXCPU 24      /* exceeded CPU time limit */
   81: #define SIGXFSZ 25      /* exceeded file size limit */
   82: #define SIGVTALRM 26    /* virtual time alarm */
   83: #define SIGPROF 27      /* profiling time alarm */
   84: #if __BSD_VISIBLE
   85: #define SIGWINCH 28     /* window size changes */
   86: #define SIGINFO 29      /* information request */
   87: #endif
   88: #define SIGUSR1 30      /* user defined signal 1 */
   89: #define SIGUSR2 31      /* user defined signal 2 */
   90: #if __BSD_VISIBLE
   91: #define SIGTHR  32      /* thread library AST */
   92: #endif
   93: 
   94: /*
   95:  * Language spec says we must list exactly one parameter, even though we
   96:  * actually supply three.  Ugh!
   97:  */
   98: #define SIG_DFL         (void (*)(int))0
   99: #define SIG_IGN         (void (*)(int))1
  100: #define SIG_ERR         (void (*)(int))-1
  101: 
  102: #if __POSIX_VISIBLE || __XPG_VISIBLE
  103: typedef unsigned int sigset_t;
  104: 
  105: #include <sys/siginfo.h>
  106: 
  107: /*
  108:  * Signal vector "template" used in sigaction call.
  109:  */
  110: struct  sigaction {
  111:         union {                /* signal handler */
  112:                 void  (*__sa_handler)(int);
  113:                 void  (*__sa_sigaction)(int, siginfo_t *, void *);
  114:         } __sigaction_u;
  115:         sigset_t sa_mask;              /* signal mask to apply */
  116:         int    sa_flags;          /* see signal options below */
  117: };
  118: 
  119: /* if SA_SIGINFO is set, sa_sigaction is to be used instead of sa_handler. */
  120: #define sa_handler      __sigaction_u.__sa_handler
  121: #define sa_sigaction    __sigaction_u.__sa_sigaction
  122: 
  123: #if __XPG_VISIBLE >= 500
  124: #define SA_ONSTACK      0x0001       /* take signal on signal stack */
  125: #define SA_RESTART      0x0002       /* restart system on signal return */
  126: #define SA_RESETHAND    0x0004     /* reset to SIG_DFL when taking signal */
  127: #define SA_NODEFER      0x0010       /* don't mask the signal we're delivering */
  128: #define SA_NOCLDWAIT    0x0020     /* don't create zombies (assign to pid 1) */
  129: #endif /* __XPG_VISIBLE >= 500 */
  130: #define SA_NOCLDSTOP    0x0008     /* do not generate SIGCHLD on child stop */
  131: #if __POSIX_VISIBLE >= 199309 || __XPG_VISIBLE >= 500
  132: #define SA_SIGINFO      0x0040       /* generate siginfo_t */
  133: #endif
  134: 
  135: /*
  136:  * Flags for sigprocmask:
  137:  */
  138: #define SIG_BLOCK       1     /* block specified signal set */
  139: #define SIG_UNBLOCK     2   /* unblock specified signal set */
  140: #define SIG_SETMASK     3   /* set specified signal set */
  141: #endif  /* __POSIX_VISIBLE || __XPG_VISIBLE */
  142: 
  143: #if __BSD_VISIBLE
  144: typedef void (*sig_t)(int);     /* type of signal function */
  145: 
  146: /*
  147:  * 4.3 compatibility:
  148:  * Signal vector "template" used in sigvec call.
  149:  */
  150: struct  sigvec {
  151:         void   (*sv_handler)(int);       /* signal handler */
  152:         int    sv_mask;           /* signal mask to apply */
  153:         int    sv_flags;          /* see signal options below */
  154: };
  155: #define SV_ONSTACK      SA_ONSTACK
  156: #define SV_INTERRUPT    SA_RESTART /* same bit, opposite sense */
  157: #define SV_RESETHAND    SA_RESETHAND
  158: #define sv_onstack      sv_flags     /* isn't compatibility wonderful! */
  159: 
  160: /*
  161:  * Macro for converting signal number to a mask suitable for
  162:  * sigblock().
  163:  */
  164: #define sigmask(m)      (1U << ((m)-1))
  165: 
  166: #define BADSIG          SIG_ERR
  167: 
  168: #endif  /* __BSD_VISIBLE */
  169: 
  170: #if __BSD_VISIBLE || __XPG_VISIBLE >= 420
  171: /*
  172:  * Structure used in sigaltstack call.
  173:  */
  174: typedef struct sigaltstack {
  175:         void   *ss_sp;                   /* signal stack base */
  176:         size_t ss_size;                /* signal stack length */
  177:         int    ss_flags;          /* SS_DISABLE and/or SS_ONSTACK */
  178: } stack_t;
  179: #define SS_ONSTACK      0x0001       /* take signals on alternate stack */
  180: #define SS_DISABLE      0x0004       /* disable taking signals on alternate stack */
  181: #define MINSIGSTKSZ     8192                        /* minimum allowable stack */
  182: #define SIGSTKSZ        (MINSIGSTKSZ + 32768)  /* recommended stack size */
  183: 
  184: typedef struct sigcontext ucontext_t;
  185: #endif /* __BSD_VISIBLE || __XPG_VISIBLE >= 420 */
  186: 
  187: /*
  188:  * For historical reasons; programs expect signal's return value to be
  189:  * defined by <sys/signal.h>.
  190:  */
  191: __BEGIN_DECLS
  192: void    (*signal(int, void (*)(int)))(int);
  193: __END_DECLS
  194: #endif  /* !_SYS_SIGNAL_H_ */