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  *  os_signal.h,v 1.21 2006/05/30 11:40:31 jwillemsen Exp
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__)
00161 #  define ACE_NSIG (NSIG + 1)
00162 #elif defined (__rtems__)
00163 #  define ACE_NSIG (SIGRTMAX)
00164 #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x600)
00165 #  define ACE_NSIG _NSIG
00166 #else
00167    // All other platforms set NSIG to one greater than the
00168    // highest-numbered signal.
00169 #  define ACE_NSIG NSIG
00170 #endif /* __Lynx__ */
00171 
00172 #if defined (ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES)
00173    // Prototypes for both signal() and struct sigaction are consistent..
00174   //#  if defined (ACE_HAS_SIG_C_FUNC)
00175   //   extern "C" {
00176   //#  endif /* ACE_HAS_SIG_C_FUNC */
00177   typedef void (*ACE_SignalHandler)(int);
00178   typedef void (*ACE_SignalHandlerV)(int);
00179   //#  if defined (ACE_HAS_SIG_C_FUNC)
00180   //   }
00181   //#  endif /* ACE_HAS_SIG_C_FUNC */
00182 #elif defined (ACE_HAS_LYNXOS_SIGNALS)
00183    typedef void (*ACE_SignalHandler)(...);
00184    typedef void (*ACE_SignalHandlerV)(...);
00185 #elif defined (ACE_HAS_TANDEM_SIGNALS)
00186    typedef void (*ACE_SignalHandler)(...);
00187    typedef void (*ACE_SignalHandlerV)(...);
00188 #elif defined (ACE_HAS_IRIX_53_SIGNALS)
00189    typedef void (*ACE_SignalHandler)(...);
00190    typedef void (*ACE_SignalHandlerV)(...);
00191 #elif defined (ACE_HAS_SPARCWORKS_401_SIGNALS)
00192    typedef void (*ACE_SignalHandler)(int, ...);
00193    typedef void (*ACE_SignalHandlerV)(int,...);
00194 #elif defined (ACE_HAS_SUNOS4_SIGNAL_T)
00195    typedef void (*ACE_SignalHandler)(...);
00196    typedef void (*ACE_SignalHandlerV)(...);
00197 #elif defined (ACE_HAS_SVR4_SIGNAL_T)
00198    // SVR4 Signals are inconsistent (e.g., see struct sigaction)..
00199    typedef void (*ACE_SignalHandler)(int);
00200 #  if !defined (m88k)     /*  with SVR4_SIGNAL_T */
00201      typedef void (*ACE_SignalHandlerV)(void);
00202 #  else
00203      typedef void (*ACE_SignalHandlerV)(int);
00204 #  endif  /*  m88k */       /*  with SVR4_SIGNAL_T */
00205 #elif defined (ACE_WIN32)
00206    typedef void (__cdecl *ACE_SignalHandler)(int);
00207    typedef void (__cdecl *ACE_SignalHandlerV)(int);
00208 #elif defined (ACE_HAS_UNIXWARE_SVR4_SIGNAL_T)
00209    typedef void (*ACE_SignalHandler)(int);
00210    typedef void (*ACE_SignalHandlerV)(...);
00211 #elif defined (INTEGRITY)
00212    typedef void (*ACE_SignalHandler)();
00213    typedef void (*ACE_SignalHandlerV)(int);
00214 #else /* This is necessary for some older broken version of cfront */
00215 #  if defined (SIG_PF)
00216 #    define ACE_SignalHandler SIG_PF
00217 #  else
00218      typedef void (*ACE_SignalHandler)(int);
00219 #  endif /* SIG_PF */
00220    typedef void (*ACE_SignalHandlerV)(...);
00221 #endif /* ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES */
00222 
00223 #if defined (ACE_LACKS_SIGACTION)
00224    struct sigaction
00225    {
00226      int sa_flags;
00227      ACE_SignalHandlerV sa_handler;
00228      sigset_t sa_mask;
00229    };
00230 #endif /* ACE_LACKS_SIGACTION */
00231 
00232 // Defining POSIX4 real-time signal range.
00233 #if defined(ACE_HAS_POSIX_REALTIME_SIGNALS)
00234 #define ACE_SIGRTMIN SIGRTMIN
00235 #define ACE_SIGRTMAX SIGRTMAX
00236 
00237 #else /* !ACE_HAS_POSIX_REALTIME_SIGNALS */
00238 
00239 #ifndef ACE_SIGRTMIN
00240 #define ACE_SIGRTMIN 0
00241 #endif /* ACE_SIGRTMIN */
00242 
00243 #ifndef ACE_SIGRTMAX
00244 #define ACE_SIGRTMAX 0
00245 #endif /* ACE_SIGRTMAX */
00246 
00247 #endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */
00248 
00249 #if defined (DIGITAL_UNIX)
00250    // sigwait is yet another macro on Digital UNIX 4.0, just causing
00251    // trouble when introducing member functions with the same name.
00252    // Thanks to Thilo Kielmann" <kielmann@informatik.uni-siegen.de> for
00253    // this fix.
00254 #  if defined  (__DECCXX_VER)
00255 #    undef sigwait
00256      // cxx on Digital Unix 4.0 needs this declaration.  With it,
00257      // <::_Psigwait> works with cxx -pthread.  g++ does _not_ need
00258      // it.
00259      int _Psigwait __((const sigset_t *set, int *sig));
00260 #  endif /* __DECCXX_VER */
00261 #elif !defined (ACE_HAS_SIGWAIT)
00262 #  if defined(__rtems__)
00263      int sigwait (const sigset_t *set, int *sig);
00264 #  else
00265      int sigwait (sigset_t *set);
00266 #  endif /* __rtems__ */
00267 #endif /* ! DIGITAL_UNIX && ! ACE_HAS_SIGWAIT */
00268 
00269 #if !defined (ACE_HAS_PTHREAD_SIGMASK_PROTO)
00270   int pthread_sigmask(int, const sigset_t *, sigset_t *);
00271 #endif /*!ACE_HAS_PTHREAD_SIGMASK_PROTO */
00272 
00273 #ifdef __cplusplus
00274 }
00275 #endif /* __cplusplus */
00276 
00277 #include "ace/os_include/os_ucontext.h"
00278 
00279 #include /**/ "ace/post.h"
00280 #endif /* ACE_OS_INCLUDE_OS_SIGNAL_H */

Generated on Thu Nov 9 09:41:58 2006 for ACE by doxygen 1.3.6