Source to include/signal.h


0001  #ifndef _SIGNAL_H
0002  #define _SIGNAL_H
0003  /*
0004   * signal.h
0005   *	A hokey little mapping from VSTa events into numbered signals
0006   */
0007  #include <sys/types.h>
0008  
0009  /*
0010   * Default and ignore signal "handlers"
0011   */
0012  typedef voidfun sig_t;
0013  #define SIG_DFL ((voidfun)(-1))
0014  #define SIG_IGN ((voidfun)(-2))
0015  #define SIG_ERR ((voidfun)(-3))
0016  
0017  /*
0018   * Some of these are not yet used in VSTa, but are included for completeness
0019   */
0020  #define SIGHUP 1	/* Hangup */
0021  #define SIGINT 2	/* Keyboard interrupt */
0022  #define SIGQUIT 3	/* Keyboard abort */
0023  #define SIGILL 4	/* Illegal instruction */
0024  #define SIGTRAP 5
0025  #define SIGABRT 6
0026  #define SIGIOT SIGABRT
0027  #define SIGUNUSED 7
0028  #define SIGFPE 8	/* Floating point exception */
0029  #define SIGKILL 9	/* Unmaskable kill */
0030  #define SIGUSR1 10
0031  #define SIGSEGV 11	/* Segmentation violation */
0032  #define SIGUSR2 12
0033  #define SIGPIPE 13
0034  #define SIGALRM 14
0035  #define SIGTERM 15	/* Software termination */
0036  #define SIGSTKFLT 16
0037  #define SIGCHLD 17
0038  #define SIGCLD SIGCHLD
0039  /* #define SIGCONT 18	These make us appear to support job control */
0040  /* #define SIGSTOP 19 */
0041  /* #define SIGTSTP 20 */
0042  /* #define SIGTTIN 21 */
0043  /* #define SIGTTOU 22 */
0044  #define SIGIO 23
0045  #define SIGPOLL SIGIO
0046  #define SIGURG SIGIO
0047  #define SIGXCPU 24
0048  #define SIGXFSZ 25
0049  #define SIGVTALRM 26
0050  #define SIGPROF 27
0051  #define SIGWINCH 28
0052  #define SIGLOST 29
0053  #define SIGPWR 30
0054  #define SIGBUS 31
0055  
0056  #define _NSIG 32	/* Max # emulated signals */
0057  
0058  /*
0059   * Standard C signal functions
0060   */
0061  extern voidfun signal(int, voidfun);
0062  extern int kill(pid_t, int);
0063  extern int raise(int);
0064  
0065  /*
0066   * Function shared between waitpid() emulation and signal emulation
0067   */
0068  extern void wait_child(void);
0069  
0070  /*
0071   * Mask of signals, must have at least _NSIG bits (viva POSIX)
0072   */
0073  typedef uint sigset_t;
0074  
0075  /*
0076   * Signal handling description
0077   */
0078  struct sigaction {
0079  	voidfun sa_handler;	/* Handler function, SIG_DFL or SIG_IGN */
0080  	sigset_t sa_mask;	/* Additional set of signals to be blocked */
0081  	uint sa_flags;		/* Flags to affect behavior of signal */
0082  };
0083  
0084  /*
0085   * Bits in sa_flags
0086   */
0087  #define SA_NOCLDSTOP 1	/* Do not generate SIGCHLD when children stop */
0088  
0089  /*
0090   * Values for sigprocmask
0091   */
0092  #define SIG_BLOCK 1	/* Block signals in 'set', other signals unaffected */
0093  #define SIG_UNBLOCK 2   /* Unblock signals in 'set',  ,, */
0094  #define SIG_SETMASK 3   /* New mask is 'set' */
0095  
0096  /*
0097   * POSIX functions
0098   */
0099  extern int sigemptyset(sigset_t *),
0100  	sigfillset(sigset_t *),
0101  	sigaddset(sigset_t *, int),
0102  	sigdelset(sigset_t *, int),
0103  	sigismember(sigset_t *, int),
0104  	sigaction(int, struct sigaction *, struct sigaction *),
0105  	sigprocmask(int, sigset_t *, sigset_t *),
0106  	sigpending(sigset_t *),
0107  	sigsuspend(sigset_t *);
0108  
0109  /*
0110   * Other functions
0111   */
0112  extern const char *strsignal(int);
0113  
0114  /*
0115   * Internal infrastructure
0116   */
0117  extern void __signal_save(char *);
0118  extern char *__signal_restore(char *);
0119  extern int __signal_size(void), __strtosig(const char *);
0120  
0121  #endif /* _SIGNAL_H */