#ifndef __SIGNAL_LOADED #define __SIGNAL_LOADED 1 #ifndef __SIGNAL_PROCESSED #define __SIGNAL_PROCESSED /**************************************************************************** ** ** - Signal Handling ** ***************************************************************************** ** Header introduced by the ANSI C Standard ***************************************************************************** ** ** Copyright 2008 Hewlett-Packard Development Company, L.P. ** ** Confidential computer software. Valid license from HP and/or ** its subsidiaries required for possession, use, or copying. ** ** Consistent with FAR 12.211 and 12.212, Commercial Computer Software, ** Computer Software Documentation, and Technical Data for Commercial ** Items are licensed to the U.S. Government under vendor's standard ** commercial license. ** ** Neither HP nor any of its subsidiaries shall be liable for technical ** or editorial errors or omissions contained herein. The information ** in this document is provided "as is" without warranty of any kind and ** is subject to change without notice. The warranties for HP products ** are set forth in the express limited warranty statements accompanying ** such products. Nothing herein should be construed as constituting an ** additional warranty. ** ***************************************************************************** */ #pragma __nostandard #include #if defined _XOPEN_SOURCE_EXTENDED || !defined _ANSI_C_SOURCE # include /* for siginfo_t */ #endif #ifdef __cplusplus extern "C" { #endif #if __INITIAL_POINTER_SIZE # pragma __pointer_size __save #endif /* ** Naturally align data structures */ #pragma __member_alignment __save #pragma __member_alignment /* ** Private definitions */ /* ** __sighnd_t is a pointer to function, where the function is declared ** void f(int code); ** ** __bsd_sighnd_t is a pointer to function, where the function is: ** void f(int code, ... ); ** ** __vms_handler is a pointer to function, where the function is: ** unsigned int f(void *sigarr, void *mecharr) ** ** These definition are private to this header and subject to change. */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size 64 #endif typedef void (*__sighnd64_t) (int); typedef void (*__bsd_sighnd64_t)(int, ... ); #if __INITIAL_POINTER_SIZE # pragma __pointer_size 32 #endif typedef void (*__sighnd_t) (int); typedef void (*__bsd_sighnd_t)(int, ... ); typedef unsigned int (*__vms_handler) ( void *__sigarr, void *__mecharr ); #if __CRTL_VER >= 70000000 # ifndef ____SIGSET_T # define ____SIGSET_T 1 typedef struct {unsigned int _set[2];} __sigset_t; # endif #endif # define _SIG_MIN 1 #if __CRTL_VER >= 70000000 # define _SIG_MAX 64 #elif __CRTL_VER >= 60200000 # define _SIG_MAX 17 #else # define _SIG_MAX 15 # endif /* ** ANSI C Public data definitions and declarations */ #define SIG_ERR ((__sighnd_t)(-1)) #define SIG_DFL ((__sighnd_t)0) #define SIG_IGN ((__sighnd_t)1) #ifdef __NAMESPACE_STD namespace std { #endif typedef int sig_atomic_t; #ifdef __NAMESPACE_STD } /* namespace std */ #endif /* ** ISO POSIX-1 public data definitions and declarations */ #if defined _POSIX_C_SOURCE || !defined _ANSI_C_SOURCE # if __CRTL_VER >= 70000000 # define SIG_UNBLOCK 0 # define SIG_BLOCK 1 # define SIG_SETMASK 2 # define SA_NOCLDSTOP 0x20 # if !defined __SIGSET_T && !defined _SIGSET_T_ && !defined _DECC_V4_SOURCE # define __SIGSET_T 1 # define _SIGSET_T_ 1 /* uses this symbol */ typedef __sigset_t sigset_t; # endif # pragma __extern_model __save # pragma __extern_model __common_block noshr static const __sigset_t _SIG_EMPTY_SET = {0x00000000, 0x00000000}, _SIG_FULL_SET = {0xFFFFFFFF, 0xFFFFFFFF}; # pragma __extern_model __restore #define __SIGACT64 (__CRTL_VER >= 80200000 && __INITIAL_POINTER_SIZE == 64) /* ** Members for sigaction struct. This is complex due to "sigaction" being ** both a struct and a function, can't use typedef to map general type ** onto 32/64 bit specific type. */ #define __SIGACTION32_MEMBERS \ __sighnd_t sa_handler; /* Signal-catching function or macro */ \ __sigset_t sa_mask; /* Set of signals to be blocked */ \ int sa_flags; /* Special flags */ #define __SIGACTION64_MEMBERS \ __sighnd64_t sa_handler; /* Signal-catching function or macro */ \ __sigset_t sa_mask; /* Set of signals to be blocked */ \ int sa_flags; /* Special flags */ #if __CRTL_VER >= 80200000 && __INITIAL_POINTER_SIZE struct __sigaction32 { __SIGACTION32_MEMBERS }; struct __sigaction64 { __SIGACTION64_MEMBERS }; #endif #if __SIGACT64 struct sigaction { __SIGACTION64_MEMBERS }; #else struct sigaction { __SIGACTION32_MEMBERS }; #endif # endif #endif /* ** XPG4 public data definitions and declarations */ #if defined _XOPEN_SOURCE || !defined _ANSI_C_SOURCE # if !defined __PID_T && !defined _DECC_V4_SOURCE # define __PID_T 1 typedef __pid_t pid_t; # endif #endif /* ** XPG4 V2 public data definitions and declarations */ #if defined _XOPEN_SOURCE_EXTENDED || !defined _ANSI_C_SOURCE struct sigstack { char *ss_sp; /* signal stack pointer */ int ss_onstack; /* current status */ }; # if __CRTL_VER >= 70000000 # define SA_ONSTACK 0x01 # define SA_RESETHAND 0x02 # define SA_NODEFER 0x08 # endif #endif /* ** DEC C extensions -- public data definitions and declarations */ #ifndef _ANSI_C_SOURCE struct sigvec { void (*sv_handler)(); /* handler address */ int sv_mask; /* mask of signals to be blocked */ int sv_onstack; /* flag to indicate signal stack */ }; struct sigcontext { int sc_onstack; /* signal stack flag to restore */ int sc_mask; /* signal mask to restore */ int sc_sp; /* stack pointerto restore */ int sc_pc; /* pc to return to */ int sc_ps; /* psl to restore */ }; #endif /* ** The following signals are defined by the ANSI C standard (ISO/IEC 9899:1990) */ #define SIGABRT 6 /* Abnormal termination signal */ #define SIGFPE 8 /* Erroneous arithmetic operation */ #define SIGILL 4 /* Detection of an invalid hardware instr. */ #define SIGINT 2 /* Interactive attention signal */ #define SIGSEGV 11 /* segmentation violation */ #define SIGTERM 15 /* External termination signal */ /* ** The following signals are defined by ISO POSIX-1 (ISO/IEC 9945-1:1990) */ #if defined _POSIX_C_SOURCE || !defined _ANSI_C_SOURCE # define SIGALRM 14 /* Timeout signal */ # define SIGHUP 1 /* Hangup detected on controlling terminal */ # define SIGKILL 9 /* External termination signal */ # define SIGPIPE 13 /* Write on a pipe with no readers */ # define SIGQUIT 3 /* Interactive termination signal */ # if __CRTL_VER >= 60200000 # define SIGUSR1 16 /* Application-defined signal 1 */ # define SIGUSR2 17 /* Application-defined signal 2 */ # endif # if __CRTL_VER >= 70000000 # define SIGCHLD 20 /* Child process terminated or stopped */ # define SIGCONT 21 /* Continue if stopped */ # define SIGSTOP 22 /* Job control stop signal */ # define SIGTSTP 23 /* Interactive stop signal */ # define SIGTTIN 24 /* Terminal read by background process */ # define SIGTTOU 25 /* Terminal write by background process */ # endif # if __CRTL_VER >= 70300000 # define SIGWINCH 28 /* Window size changed */ # endif #endif /* ** Defined by XPG4 V2 */ #if defined _XOPEN_SOURCE_EXTENDED || !defined _ANSI_C_SOURCE # define SIGTRAP 5 /* TBIT trace trap or BPT instruction */ # define SIGSYS 12 /* Bad arguments to system call */ #endif /* ** DEC C Extensions */ #ifndef _ANSI_C_SOURCE # define SIGIOT 6 /* Obsolete name - 6 reused as SIGABRT */ # define SIGEMT 7 /* Opcode reserved to customer */ # define SIGBUS 10 /* invalid access to memory objects */ # if __CRTL_VER >= 70000000 # define SIGSPARE18 18 /* Reserved for future expansions */ # define SIGSPARE19 19 /* Reserved for future expansions */ # define SIGDEBUG 26 /* Permanently reserved to Digital */ # define SIGSPARE27 27 /* Reserved for future expansions */ # define SIGSPARE28 28 /* Reserved for future expansions */ # define SIGSPARE29 29 /* Reserved for future expansions */ # define SIGSPARE30 30 /* Reserved for future expansions */ # define SIGSPARE31 31 /* Reserved for future expansions */ # define SIGSPARE32 32 /* Reserved for future expansions */ # define SIGRTMIN 33 /* First realtime signal (1003.1b) */ # define SIGRTMAX 64 /* Last realtime signal (1003.1b) */ # endif # define NSIG _SIG_MAX # define BADSIG SIG_ERR # define ILL_RESAD_FAULT 0x0 /* reserved addressing mode fault */ # define ILL_PRIVIN_FAULT 0x1 /* privilidged instruction fault */ # define ILL_RESOP_FAULT 0x2 /* reserved operand fault */ # define FPE_INTOVF_TRAP 0x1 # define FPE_INTDIV_TRAP 0x2 # define FPE_FLTOVF_TRAP 0x3 # define FPE_FLTDIV_TRAP 0x4 # define FPE_FLTUND_TRAP 0x5 # define FPE_DECOVF_TRAP 0x6 # ifdef __VAX # define FPE_SUBRNG_TRAP 0x7 # else # define FPE_INXRES_TRAP 0x7 # endif # define FPE_FLTOVF_FAULT 0x8 # define FPE_FLTDIV_FAULT 0x9 # define FPE_FLTUND_FAULT 0x0a # ifndef __VAX # define FPE_INVOPR_TRAP 0x0b # define FPE_DECDIV_TRAP 0x0c # define FPE_DECINV_TRAP 0x0d # define FPE_SUBRNG_TRAP 0x0e # define FPE_SUBRNG1_TRAP 0x0f # define FPE_SUBRNG2_TRAP 0x10 # define FPE_SUBRNG3_TRAP 0x11 # define FPE_SUBRNG4_TRAP 0x12 # define FPE_SUBRNG5_TRAP 0x13 # define FPE_SUBRNG6_TRAP 0x14 # define FPE_SUBRNG7_TRAP 0x15 # ifdef __ia64 # define FPE_FLTINE_TRAP 0x16 # define FPE_FLTINV_TRAP 0x17 # define FPE_FLTINV_FAULT 0x18 # define FPE_FLTDENORMAL_FAULT 0x19 # endif # endif #endif /* ** Enable 64 bit pointers */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size 64 #endif #ifdef __NAMESPACE_STD namespace std { #endif /* ** Function prototypes (ANSI). */ #if __SIGACT64 # pragma __extern_prefix __save # pragma __extern_prefix "__64_" # define __SIGRETTYP __sighnd64_t #else # define __SIGRETTYP __sighnd_t #endif __SIGRETTYP signal( int __sig, __sighnd64_t __func ); #if __SIGACT64 # pragma __extern_prefix __restore # undef __SIGRETTYP #endif /* ** In strict ANSI mode, raise has a signal parameter. As ** a DEC C extension, it accepts a subcode as well. */ #ifndef _ANSI_C_SOURCE int raise (int __sig, ...); /* 2nd parameter is the subcode */ #else int raise (int __sig); #endif #ifdef __NAMESPACE_STD } /* namespace std */ #endif /* ** ISO POSIX-1 signal handling */ #if defined _POSIX_C_SOURCE || !defined _ANSI_C_SOURCE # if defined(_POSIX_EXIT) # if __USE_LONG_GID_T # pragma __extern_prefix __save # pragma __extern_prefix "__posix_long_gid_" # elif __CRTL_VER >= 70000000 # if __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix __save # pragma __extern_prefix "__posix_" # else # define kill(__p1,__p2) __posix_kill(__p1,__p2) # endif # endif # endif int kill (__pid_t __pid, int __sig); # if defined(_POSIX_EXIT) # if __USE_LONG_GID_T # pragma __extern_prefix __restore # elif __CRTL_VER >= 70000000 # if __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix __restore # endif # endif # endif # if __CRTL_VER >= 70000000 int sigaddset (__sigset_t * __set, int __sig); int sigdelset (__sigset_t * __set, int __sig); int sigismember (const __sigset_t * __set, int __sig); # if __SIGACT64 # pragma __extern_prefix __save # pragma __extern_prefix "__64_" # endif int sigaction(int __sig, const struct sigaction* __act, struct sigaction* __oact); # if __SIGACT64 # pragma __extern_prefix __restore # endif #if __CRTL_VER >= 80200000 && __INITIAL_POINTER_SIZE int __64_sigaction(int, const struct __sigaction64 *, struct __sigaction64 *); int __32_sigaction(int, const struct __sigaction32 *, struct __sigaction32 *); __sighnd64_t __64_signal(int, __sighnd64_t); __sighnd_t __32_signal(int, __sighnd64_t); __bsd_sighnd64_t __64_ssignal(int, __bsd_sighnd64_t); __bsd_sighnd_t __32_ssignal(int, __bsd_sighnd64_t); #endif int sigprocmask (int __how, const __sigset_t * __set, __sigset_t * __oset); int sigpending (__sigset_t * __set); int sigsuspend (const __sigset_t * __set); # if __cplusplus && !__NO_MACROS && !(defined(__ia64) && (__INITIAL_POINTER_SIZE == 32)) inline int sigemptyset (__sigset_t *__set) { *__set =_SIG_EMPTY_SET; return 0; } inline int sigfillset (__sigset_t *__set) { *__set =_SIG_FULL_SET; return 0; } # else int sigemptyset (__sigset_t * __set); int sigfillset (__sigset_t * __set); # if !__NO_MACROS # define sigemptyset(set) (*(__sigset_t*)(set)=_SIG_EMPTY_SET, 0) # define sigfillset(set) (*(__sigset_t*)(set)=_SIG_FULL_SET, 0) # endif # endif # endif #endif /* ** XPG4 V2 function prototypes */ #if defined _XOPEN_SOURCE_EXTENDED || !defined _ANSI_C_SOURCE int sigpause (int __mask); int sigstack (struct sigstack *__ss, struct sigstack *__oss); #endif /* ** DEC C extensions */ #ifndef _ANSI_C_SOURCE # if __SIGACT64 # pragma __extern_prefix __save # pragma __extern_prefix "__64_" # define __SSIGRETTYP __bsd_sighnd64_t # else # define __SSIGRETTYP __bsd_sighnd_t # endif __SSIGRETTYP ssignal (int __sig, __bsd_sighnd64_t __action); # if __SIGACT64 # pragma __extern_prefix __restore # undef __SSIGRETTYP # endif int sigvec (int __sigveca, struct sigvec *__sv, struct sigvec *__osv); int sigblock (int __mask); int sigsetmask (int __mask); int gsignal (int __sig, ...); void VAXC$ESTABLISH (__vms_handler __f); void VAXC$CRTL_INIT (void); # ifndef __cplusplus void DECC$CRTL_INIT (void); # endif # ifndef __VAX void c$$establish(__void_ptr32, unsigned short); # define VAXC$CRTL_INIT() ( c$$establish(0,32), (VAXC$CRTL_INIT)()) # ifndef __cplusplus # define DECC$CRTL_INIT() (c$$establish(0,32), (DECC$CRTL_INIT)()) # endif # endif /* ** ISO POSIX-1 defines alarm, sleep as being in . For ** compatibility with DEC C V4, the old prototypes are supported. */ # ifndef _DECC_V4_SOURCE unsigned int alarm (unsigned int __seconds); unsigned int sleep (unsigned __seconds); # else int alarm (unsigned int __seconds); int sleep (unsigned __seconds); # endif /* ** ISO POSIX-1 defines pause in */ int pause (void); /* ** XPG4 V2 removed sigmask from signal.h in a corrigenda to ** that specification. */ # if __CRTL_VER >= 70000000 int sigmask (int __sig); # define sigmask(m) (1L << ((m)-1)) # endif #endif #if defined _XOPEN_SOURCE_EXTENDED || !defined _ANSI_C_SOURCE /* ** XPG5 extentions */ # if __CRTL_VER >= 70320000 # if (!defined __TIMESPEC && !defined _TIMESPEC_T_) # define __TIMESPEC struct timespec { unsigned long tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ }; # endif int sigwait(const __sigset_t *__set, int *__sig); int sigwaitinfo(const __sigset_t *__set, siginfo_t *__info); int sigtimedwait(const __sigset_t *__set, siginfo_t *__info, const struct timespec *__timeout); int sighold(int __sig); int sigrelse(int __sig); int sigignore(int __sig); # endif #endif #if __CRTL_VER >= 80400000 && !defined _ANSI_C_SOURCE unsigned int decc$find_signal_value(unsigned int __cond_value, int *__subcode_p); unsigned int decc$find_condition_value(int __sig_num, int __subcode); #endif /* ** Restore pointer size context */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size __restore #endif #pragma __member_alignment __restore #ifdef __cplusplus } #endif #pragma __standard #endif /* __SIGNAL_PROCESSED */ #if defined(__NAMESPACE_STD) && !defined(__NAMESPACE_STD_ONLY) # ifndef __USING_SIGNAL_NAMES # define __USING_SIGNAL_NAMES using std::raise; using std::sig_atomic_t; using std::signal; # endif #endif #endif /* __SIGNAL_LOADED */