Back to index

glibc  2.9
sigaction.h
Go to the documentation of this file.
00001 /* Copyright (C) 1991,92,96,97,98,2001 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #ifndef _SIGNAL_H
00020 # error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
00021 #endif
00022 
00023 /* These definitions match those used by the 4.4 BSD kernel.
00024    If the operating system has a `sigaction' system call that correctly
00025    implements the POSIX.1 behavior, there should be a system-dependent
00026    version of this file that defines `struct sigaction' and the `SA_*'
00027    constants appropriately.  */
00028 
00029 /* Structure describing the action to be taken when a signal arrives.  */
00030 struct sigaction
00031   {
00032     /* Signal handler.  */
00033 #ifdef __USE_POSIX199309
00034     union
00035       {
00036        /* Used if SA_SIGINFO is not set.  */
00037        __sighandler_t sa_handler;
00038        /* Used if SA_SIGINFO is set.  */
00039        void (*sa_sigaction) (int, siginfo_t *, void *);
00040       }
00041     __sigaction_handler;
00042 # define sa_handler  __sigaction_handler.sa_handler
00043 # define sa_sigaction       __sigaction_handler.sa_sigaction
00044 #else
00045     __sighandler_t sa_handler;
00046 #endif
00047 
00048     /* Additional set of signals to be blocked.  */
00049     __sigset_t sa_mask;
00050 
00051     /* Special flags.  */
00052     int sa_flags;
00053   };
00054 
00055 /* Bits in `sa_flags'.  */
00056 #if defined __USE_UNIX98 || defined __USE_MISC
00057 # define SA_ONSTACK  0x0001 /* Take signal on signal stack.  */
00058 # define SA_RESTART  0x0002 /* Restart syscall on signal return.  */
00059 # define SA_NODEFER  0x0010 /* Don't automatically block the signal when
00060                                 its handler is being executed.  */
00061 # define SA_RESETHAND       0x0004 /* Reset to SIG_DFL on entry to handler.  */
00062 #endif
00063 #define       SA_NOCLDSTOP  0x0008 /* Don't send SIGCHLD when children stop.  */
00064 
00065 #ifdef __USE_MISC
00066 # define SA_INTERRUPT       0      /* Historical no-op ("not SA_RESTART").  */
00067 
00068 /* Some aliases for the SA_ constants.  */
00069 # define SA_NOMASK    SA_NODEFER
00070 # define SA_ONESHOT   SA_RESETHAND
00071 # define SA_STACK     SA_ONSTACK
00072 #endif
00073 
00074 
00075 /* Values for the HOW argument to `sigprocmask'.  */
00076 #define       SIG_BLOCK     1      /* Block signals.  */
00077 #define       SIG_UNBLOCK   2      /* Unblock signals.  */
00078 #define       SIG_SETMASK   3      /* Set the set of blocked signals.  */