1 /*------------------------------------------------------------------------- 2 * 3 * pqsignal.h 4 * Backend signal(2) support (see also src/port/pqsignal.c) 5 * 6 * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group 7 * Portions Copyright (c) 1994, Regents of the University of California 8 * 9 * src/include/libpq/pqsignal.h 10 * 11 *------------------------------------------------------------------------- 12 */ 13 #ifndef PQSIGNAL_H 14 #define PQSIGNAL_H 15 16 #include <signal.h> 17 18 #ifndef WIN32 19 #define PG_SETMASK(mask) sigprocmask(SIG_SETMASK, mask, NULL) 20 #else 21 /* Emulate POSIX sigset_t APIs on Windows */ 22 typedef int sigset_t; 23 24 extern int pqsigsetmask(int mask); 25 26 #define PG_SETMASK(mask) pqsigsetmask(*(mask)) 27 #define sigemptyset(set) (*(set) = 0) 28 #define sigfillset(set) (*(set) = ~0) 29 #define sigaddset(set, signum) (*(set) |= (sigmask(signum))) 30 #define sigdelset(set, signum) (*(set) &= ~(sigmask(signum))) 31 #endif /* WIN32 */ 32 33 extern sigset_t UnBlockSig, 34 BlockSig, 35 StartupBlockSig; 36 37 extern void pqinitmask(void); 38 39 /* pqsigfunc is declared in src/include/port.h */ 40 extern pqsigfunc pqsignal_pm(int signo, pqsigfunc func); 41 42 #endif /* PQSIGNAL_H */ 43