os_signal.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    os_signal.h
00006  *
00007  *  signals
00008  *
00009  *  $Id: os_signal.h 80826 2008-03-04 14:51:23Z wotte $
00010  *
00011  *  @author Don Hinton <dhinton@dresystems.com>
00012  *  @author This code was originally in various places including ace/OS.h.
00013  */
00014 //=============================================================================
00015 
00016 #ifndef ACE_OS_INCLUDE_OS_SIGNAL_H
00017 #define ACE_OS_INCLUDE_OS_SIGNAL_H
00018 
00019 #include /**/ "ace/pre.h"
00020 
00021 #include "ace/config-lite.h"
00022 
00023 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00024 # pragma once
00025 #endif /* ACE_LACKS_PRAGMA_ONCE */
00026 
00027 #include "ace/os_include/sys/os_types.h"
00028 
00029 #if !defined (ACE_LACKS_SIGNAL_H)
00030    extern "C" {
00031 #  include /**/ <signal.h>
00032    }
00033 #endif /* !ACE_LACKS_SIGNAL_H */
00034 
00035 // This must come after signal.h is #included.
00036 #if defined (SCO)
00037 #  define SIGIO SIGPOLL
00038 #  include /**/ <sys/regset.h>
00039 #endif /* SCO */
00040 
00041 #if defined (ACE_HAS_SIGINFO_T)
00042 #  if !defined (ACE_LACKS_SIGINFO_H)
00043 #    if defined (__QNX__) || defined (__OpenBSD__) || defined (__INTERIX)
00044 #      include /**/ <sys/siginfo.h>
00045 #    else  /* __QNX__ || __OpenBSD__ */
00046 #      include /**/ <siginfo.h>
00047 #    endif /* __QNX__ || __OpenBSD__ */
00048 #  endif /* ACE_LACKS_SIGINFO_H */
00049 #endif /* ACE_HAS_SIGINFO_T */
00050 
00051 #if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) && !defined (__RTP__)
00052 #  include /**/ <sigLib.h>
00053 #endif /* ACE_VXWORKS */
00054 
00055 // Place all additions (especially function declarations) within extern "C" {}
00056 #ifdef __cplusplus
00057 extern "C"
00058 {
00059 #endif /* __cplusplus */
00060 
00061 #if defined (ACE_LACKS_SIGSET)
00062   typedef u_int sigset_t;
00063 #endif /* ACE_LACKS_SIGSET */
00064 
00065 #if defined (ACE_HAS_SIG_MACROS)
00066 #  undef sigemptyset
00067 #  undef sigfillset
00068 #  undef sigaddset
00069 #  undef sigdelset
00070 #  undef sigismember
00071 #endif /* ACE_HAS_SIG_MACROS */
00072 
00073 // This must come after signal.h is #included.  It's to counteract
00074 // the sigemptyset and sigfillset #defines, which only happen
00075 // when __OPTIMIZE__ is #defined (really!) on Linux.
00076 #if defined (linux) && defined (__OPTIMIZE__)
00077 #  undef sigemptyset
00078 #  undef sigfillset
00079 #endif /* linux && __OPTIMIZE__ */
00080 
00081 #if !defined (ACE_HAS_SIG_ATOMIC_T)
00082    typedef int sig_atomic_t;
00083 #endif /* !ACE_HAS_SIG_ATOMIC_T */
00084 
00085 # if !defined (SA_SIGINFO)
00086 #   define SA_SIGINFO 0
00087 # endif /* SA_SIGINFO */
00088 
00089 # if !defined (SA_RESTART)
00090 #   define SA_RESTART 0
00091 # endif /* SA_RESTART */
00092 
00093 #if !defined (SIGHUP)
00094 #  define SIGHUP 0
00095 #endif /* SIGHUP */
00096 
00097 #if !defined (SIGINT)
00098 #  define SIGINT 0
00099 #endif /* SIGINT */
00100 
00101 #if !defined (SIGSEGV)
00102 #  define SIGSEGV 0
00103 #endif /* SIGSEGV */
00104 
00105 #if !defined (SIGIO)
00106 #  define SIGIO 0
00107 #endif /* SIGSEGV */
00108 
00109 #if !defined (SIGUSR1)
00110 #  define SIGUSR1 0
00111 #endif /* SIGUSR1 */
00112 
00113 #if !defined (SIGUSR2)
00114 #  define SIGUSR2 0
00115 #endif /* SIGUSR2 */
00116 
00117 #if !defined (SIGCHLD)
00118 #  define SIGCHLD 0
00119 #endif /* SIGCHLD */
00120 
00121 #if !defined (SIGCLD)
00122 #  define SIGCLD SIGCHLD
00123 #endif /* SIGCLD */
00124 
00125 #if !defined (SIGQUIT)
00126 #  define SIGQUIT 0
00127 #endif /* SIGQUIT */
00128 
00129 #if !defined (SIGPIPE)
00130 #  define SIGPIPE 0
00131 #endif /* SIGPIPE */
00132 
00133 #if !defined (SIGALRM)
00134 #  define SIGALRM 0
00135 #endif /* SIGALRM */
00136 
00137 #if !defined (SIG_DFL)
00138 #  define SIG_DFL ((__sighandler_t) 0)
00139 #endif /* SIG_DFL */
00140 
00141 #if !defined (SIG_IGN)
00142 #  define SIG_IGN ((__sighandler_t) 1)     /* ignore signal */
00143 #endif /* SIG_IGN */
00144 
00145 #if !defined (SIG_ERR)
00146 #  define SIG_ERR ((__sighandler_t) -1)    /* error return from signal */
00147 #endif /* SIG_ERR */
00148 
00149 // These are used by the <ACE_IPC_SAP::enable> and
00150 // <ACE_IPC_SAP::disable> methods.  They must be unique and cannot
00151 // conflict with the value of <ACE_NONBLOCK>.  We make the numbers
00152 // negative here so they won't conflict with other values like SIGIO,
00153 // etc.
00154 # define ACE_SIGIO -1
00155 # define ACE_SIGURG -2
00156 # define ACE_CLOEXEC -3
00157 
00158 #if defined (ACE_VXWORKS)
00159 #  define ACE_NSIG (_NSIGS + 1)
00160 #elif defined (__Lynx__) || defined (ACE_HAS_RTEMS)
00161 #  define ACE_NSIG (NSIG + 1)
00162 #else
00163    // All other platforms set NSIG to one greater than the
00164    // highest-numbered signal.
00165 #  define ACE_NSIG NSIG
00166 #endif /* __Lynx__ */
00167 
00168 #if defined (ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES)
00169    // Prototypes for both signal() and struct sigaction are consistent..
00170   typedef void (*ACE_SignalHandler)(int);
00171   typedef void (*ACE_SignalHandlerV)(int);
00172 #elif defined (ACE_HAS_LYNXOS_SIGNALS) || defined (ACE_HAS_TANDEM_SIGNALS)
00173    typedef void (*ACE_SignalHandler)(...);
00174    typedef void (*ACE_SignalHandlerV)(...);
00175 #elif defined (ACE_HAS_SVR4_SIGNAL_T)
00176    // SVR4 Signals are inconsistent (e.g., see struct sigaction)..
00177    typedef void (*ACE_SignalHandler)(int);
00178    typedef void (*ACE_SignalHandlerV)(void);
00179 #elif defined (ACE_WIN32)
00180    typedef void (__cdecl *ACE_SignalHandler)(int);
00181    typedef void (__cdecl *ACE_SignalHandlerV)(int);
00182 #elif defined (ACE_HAS_UNIXWARE_SVR4_SIGNAL_T)
00183    typedef void (*ACE_SignalHandler)(int);
00184    typedef void (*ACE_SignalHandlerV)(...);
00185 #elif defined (INTEGRITY)
00186    typedef void (*ACE_SignalHandler)();
00187    typedef void (*ACE_SignalHandlerV)(int);
00188 #elif defined (ACE_HAS_RTEMS)
00189    typedef void (*ACE_SignalHandler)();
00190    typedef void (*ACE_SignalHandlerV)();
00191 #else /* This is necessary for some older broken version of cfront */
00192 #  if defined (SIG_PF)
00193 #    define ACE_SignalHandler SIG_PF
00194 #  else
00195      typedef void (*ACE_SignalHandler)(int);
00196 #  endif /* SIG_PF */
00197    typedef void (*ACE_SignalHandlerV)(...);
00198 #endif /* ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES */
00199 
00200 #if defined (ACE_LACKS_SIGACTION)
00201    struct sigaction
00202    {
00203      int sa_flags;
00204      ACE_SignalHandlerV sa_handler;
00205      sigset_t sa_mask;
00206    };
00207 #endif /* ACE_LACKS_SIGACTION */
00208 
00209 // Defining POSIX4 real-time signal range.
00210 #if defined(ACE_HAS_POSIX_REALTIME_SIGNALS)
00211 #  define ACE_SIGRTMIN SIGRTMIN
00212 #  define ACE_SIGRTMAX SIGRTMAX
00213 #else /* !ACE_HAS_POSIX_REALTIME_SIGNALS */
00214 #  ifndef ACE_SIGRTMIN
00215 #    define ACE_SIGRTMIN 0
00216 #  endif /* ACE_SIGRTMIN */
00217 #  ifndef ACE_SIGRTMAX
00218 #    define ACE_SIGRTMAX 0
00219 #  endif /* ACE_SIGRTMAX */
00220 #endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */
00221 
00222 #if defined (DIGITAL_UNIX)
00223    // sigwait is yet another macro on Digital UNIX 4.0, just causing
00224    // trouble when introducing member functions with the same name.
00225    // Thanks to Thilo Kielmann" <kielmann@informatik.uni-siegen.de> for
00226    // this fix.
00227 #  if defined  (__DECCXX_VER)
00228 #    undef sigwait
00229      // cxx on Digital Unix 4.0 needs this declaration.  With it,
00230      // <::_Psigwait> works with cxx -pthread.  g++ does _not_ need
00231      // it.
00232      int _Psigwait __((const sigset_t *set, int *sig));
00233 #  endif /* __DECCXX_VER */
00234 #elif !defined (ACE_HAS_SIGWAIT)
00235 #  if defined(ACE_HAS_RTEMS)
00236      int sigwait (const sigset_t *set, int *sig);
00237 #  else
00238      int sigwait (sigset_t *set);
00239 #  endif /* ACE_HAS_RTEMS */
00240 #endif /* ! DIGITAL_UNIX && ! ACE_HAS_SIGWAIT */
00241 
00242 #if !defined (ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE)
00243   int pthread_sigmask(int, const sigset_t *, sigset_t *);
00244 #endif /*!ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE */
00245 
00246 #ifdef __cplusplus
00247 }
00248 #endif /* __cplusplus */
00249 
00250 #include "ace/os_include/os_ucontext.h"
00251 
00252 #include /**/ "ace/post.h"
00253 #endif /* ACE_OS_INCLUDE_OS_SIGNAL_H */

Generated on Tue Feb 2 17:18:41 2010 for ACE by  doxygen 1.4.7