#ifndef __SIGNAL_LOADED #define __SIGNAL_LOADED 1 /**************************************************************************** ** ** - Signal Handling ** ***************************************************************************** ** Header introduced by the ANSI C Standard ***************************************************************************** ** ** Copyright 2000 Compaq Computer Corporation ** ** Compaq and the Compaq logo Registered in U.S. Patent and Trademark Office. ** ** Confidential computer software. Valid license from Compaq 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. ** ****************************************************************************** */ #pragma __nostandard #include #ifdef __cplusplus extern "C" { #endif #if __INITIAL_POINTER_SIZE # pragma __pointer_size __save # pragma __pointer_size 32 #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, wher the function is: ** unsigned int f(void *sigarr, void *mecharr) ** ** These definition are private to this header and subject to change. */ 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) typedef int sig_atomic_t; /* ** 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 struct sigaction { __sighnd_t sa_handler; __sigset_t sa_mask; int sa_flags; }; # 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 # endif #endif /* ** Enable 64 bit pointers */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size 64 #endif /* ** Function prototypes (ANSI). */ __sighnd_t signal( int __sig, __sighnd_t __func ); /* ** 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 /* ** 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); int sigaction (int __sig, const struct sigaction * __act, struct sigaction * __oact); 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 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 __bsd_sighnd_t ssignal (int __sig, __bsd_sighnd_t __action); 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 # ifdef __ALPHA 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 /* ** Restore pointer size context */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size __restore #endif #ifdef __cplusplus } #endif #pragma __member_alignment __restore #pragma __standard #endif /* __SIGNAL_LOADED */