/* Copyright (c) 1993 Xerox Corporation. All rights reserved. */ /* $Id$ $Date$ * * PCR signal types */ #ifndef __PCR_SigTypes_h #define __PCR_SigTypes_h 1 #include #include /* * Unix/POSIX signals fall into two classes: * * - asynchronous signals, or "interrupts". * - synchronous signals, or "traps". * * In addition, every signal * * - is either resumable or not. * - has a default action. * * A trap is delivered to the thread that caused it. * An externally-generated interrupt (sent from another POSIX * process using kill(2)) is simply recorded; it is available * to any thread calling PCR_Sig_GetExternalInterrupts(). * The procedure PCR_Th_T_SendSigs (in th/PCR_Th.h) can be used to * deliver signals to individual threads. * Unlike POSIX, PCR allows any signal or (resumable) trap to be ignored * or blocked. This feature is admittedly dangerous. The POSIX * signal handling emulation enforces the standard semantics. * The meaning of SIG_DFL is as in POSIX (or the host OS, for non-POSIX * signals). * * ??? TODO: fix this comment!!! ??? */ typedef unsigned long PCR_sigset_t; #define PCR_sigset_t_null ((PCR_sigset_t)(0)) #define PCR_sigset_t_empty ((PCR_sigset_t)(0)) #define PCR_sigset_t_full ((PCR_sigset_t)(-1)) #define PCR_sigset_t_FromSig(sig) ((PCR_sigset_t)(01 << (sig))) #define PCR_sigset_t_Complement(set) \ ((PCR_sigset_t)(~((unsigned long)(set)))) #define PCR_sigset_t__Add(mask,signo) (((*(mask)) |= (01 << (signo))), 0) #define PCR_sigset_t_Add PCR_sigset_t__Add #define PCR_sigset_t__Del(mask,signo) (((*(mask)) &= (~(01 << (signo)))), 0) #define PCR_sigset_t_Del PCR_sigset_t__Del #define PCR_sigset_t__SetEmpty(mask) ((*(mask) = PCR_sigset_t_empty), 0) #define PCR_sigset_t_SetEmpty PCR_sigset_t__SetEmpty #define PCR_sigset_t__SetFull(mask) ((*(mask) = PCR_sigset_t_full), 0) #define PCR_sigset_t_SetFull PCR_sigset_t__SetFull #define PCR_sigset_t__IsMember(mask,signo) \ (((*(mask)) & (01 << (signo))) != 0) #define PCR_sigset_t_IsMember PCR_sigset_t__IsMember /* POSIX required signals */ #define PCR_SIGABRT 1 #define PCR_SIGALRM 2 #define PCR_SIGFPE 3 #define PCR_SIGHUP 4 #define PCR_SIGILL 5 #define PCR_SIGINT 6 #define PCR_SIGKILL 7 #define PCR_SIGPIPE 8 #define PCR_SIGQUIT 9 #define PCR_SIGSEGV 10 #define PCR_SIGTERM 11 #define PCR_SIGUSR1 12 #define PCR_SIGUSR2 13 /* POSIX job control signals -- not necessarily supported */ #define PCR_SIGCHLD 14 #define PCR_SIGCONT 15 #define PCR_SIGSTOP 16 #define PCR_SIGTSTP 17 #define PCR_SIGTTIN 18 #define PCR_SIGTTOU 19 #define PCR_LASTSIGPOSIX 19 #define PCR_NSIGPOSIX PCR_LASTSIGPOSIX /* PCR private signals */ # define PCR_BASESIGPVT PCR_NSIGPOSIX # define PCR_SIGALERT (1+PCR_BASESIGPVT) # define PCR_LASTSIGPVT PCR_SIGALERT /* OS-specific signals */ # define PCR_BASESIGOSDEP PCR_LASTSIGPVT #if defined(PCR_OS_SUNOS4) # define PCR_SIGXCPU (1+PCR_BASESIGOSDEP) # define PCR_SIGXFSZ (2+PCR_BASESIGOSDEP) # define PCR_SIGWINCH (3+PCR_BASESIGOSDEP) # define PCR_SIGLOST (4+PCR_BASESIGOSDEP) # define PCR_SIGSYS (5+PCR_BASESIGOSDEP) # define PCR_SIGTRAP (6+PCR_BASESIGOSDEP) # define PCR_SIGEMT (7+PCR_BASESIGOSDEP) # define PCR_LASTSIGOSDEP PCR_SIGEMT #elif defined(PCR_OS_SUNOS5) # define PCR_SIGXCPU (1+PCR_BASESIGOSDEP) # define PCR_SIGXFSZ (2+PCR_BASESIGOSDEP) # define PCR_SIGWINCH (3+PCR_BASESIGOSDEP) # define PCR_SIGSYS (4+PCR_BASESIGOSDEP) # define PCR_SIGTRAP (5+PCR_BASESIGOSDEP) # define PCR_SIGEMT (6+PCR_BASESIGOSDEP) # define PCR_LASTSIGOSDEP PCR_SIGEMT #elif defined(PCR_OS_IRIX4) # define PCR_SIGXCPU (1+PCR_BASESIGOSDEP) # define PCR_SIGXFSZ (2+PCR_BASESIGOSDEP) # define PCR_SIGWINCH (3+PCR_BASESIGOSDEP) # define PCR_SIGSYS (4+PCR_BASESIGOSDEP) # define PCR_SIGTRAP (5+PCR_BASESIGOSDEP) # define PCR_SIGEMT (6+PCR_BASESIGOSDEP) # define PCR_LASTSIGOSDEP PCR_SIGEMT #elif defined(PCR_OS_OS2) # define PCR_SIGBREAK (1+PCR_BASESIGOSDEP) # define PCR_LASTSIGOSDEP PCR_SIGBREAK #else # error os traps #endif # define PCR_NSIG PCR_LASTSIGOSDEP #if (PCR_NSIG > 30) # error too many sigs #endif /* * Types for PCR signal handling */ typedef void PCR_Sig_Handler(int sig, PCR_Any osData, PCR_Any data); struct PCR_Sig_ActionRep { PCR_Sig_Handler * sa_handler; PCR_Any sa_data; PCR_sigset_t sa_mask; int sa_flags; }; typedef struct PCR_Sig_ActionRep PCR_Sig_Action; #endif /* !__PCR_SigTypes_h */ /* $Log$ */