1/* NAME: 2 * sigact.h - sigaction et al 3 * 4 * SYNOPSIS: 5 * #include "sigact.h" 6 * 7 * DESCRIPTION: 8 * This header is the interface to a fake sigaction(2) 9 * implementation. It provides a POSIX compliant interface 10 * to whatever signal handling mechanisms are available. 11 * It also provides a Signal() function that is implemented 12 * in terms of sigaction(). 13 * If not using signal(2) as part of the underlying 14 * implementation (USE_SIGNAL or USE_SIGMASK), and 15 * NO_SIGNAL is not defined, it also provides a signal() 16 * function that calls Signal(). 17 * 18 * SEE ALSO: 19 * sigact.c 20 */ 21/* 22 * RCSid: 23 * $Id: sigact.h,v 1.4 2021/10/14 19:39:17 sjg Exp $ 24 */ 25#ifndef _SIGACT_H 26#define _SIGACT_H 27 28#include <sys/cdefs.h> 29 30/* 31 * most modern systems use void for signal handlers but 32 * not all. 33 */ 34#ifndef SIG_HDLR 35# define SIG_HDLR void 36#endif 37 38/* 39 * if you want to install this header as signal.h, 40 * modify this to pick up the original signal.h 41 */ 42#ifndef SIGKILL 43# include <signal.h> 44#endif 45#ifndef SIGKILL 46# include <sys/signal.h> 47#endif 48 49#ifndef SIG_ERR 50# define SIG_ERR (SIG_HDLR (*)())-1 51#endif 52#ifndef BADSIG 53# define BADSIG SIG_ERR 54#endif 55 56#ifndef SA_NOCLDSTOP 57/* we assume we need the fake sigaction */ 58/* sa_flags */ 59#define SA_NOCLDSTOP 1 /* don't send SIGCHLD on child stop */ 60#define SA_RESTART 2 /* re-start I/O */ 61 62/* sigprocmask flags */ 63#define SIG_BLOCK 1 64#define SIG_UNBLOCK 2 65#define SIG_SETMASK 4 66 67/* 68 * this is a bit untidy 69 */ 70#ifdef _SIGSET_T_ 71typedef _SIGSET_T_ sigset_t; 72#endif 73 74/* 75 * POSIX sa_handler should return void, but since we are 76 * implementing in terms of something else, it may 77 * be appropriate to use the normal SIG_HDLR return type 78 */ 79struct sigaction 80{ 81 SIG_HDLR (*sa_handler)(); 82 sigset_t sa_mask; 83 int sa_flags; 84}; 85 86 87int sigaction ( int /*sig*/, const struct sigaction */*act*/, struct sigaction */*oact*/ ); 88int sigaddset ( sigset_t */*mask*/, int /*sig*/ ); 89int sigdelset ( sigset_t */*mask*/, int /*sig*/ ); 90int sigemptyset ( sigset_t */*mask*/ ); 91int sigfillset ( sigset_t */*mask*/ ); 92int sigismember ( const sigset_t */*mask*/, int /*sig*/ ); 93int sigpending ( sigset_t */*set*/ ); 94int sigprocmask ( int how, const sigset_t */*set*/, sigset_t */*oset*/ ); 95int sigsuspend ( sigset_t */*mask*/ ); 96 97#ifndef sigmask 98# define sigmask(s) (1<<((s)-1) & (32 - 1)) /* convert SIGnum to mask */ 99#endif 100#if !defined(NSIG) && defined(_NSIG) 101# define NSIG _NSIG 102#endif 103#endif /* ! SA_NOCLDSTOP */ 104#endif /* _SIGACT_H */ 105