]> granicus.if.org Git - postgresql/blob - src/include/libpq/pqsignal.h
Move pqsignal() to libpgport.
[postgresql] / src / include / libpq / pqsignal.h
1 /*-------------------------------------------------------------------------
2  *
3  * pqsignal.h
4  *        Backend signal(2) support (see also src/port/pqsignal.c)
5  *
6  * Portions Copyright (c) 1996-2013, 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 #ifdef HAVE_SIGPROCMASK
19 extern sigset_t UnBlockSig,
20                         BlockSig,
21                         StartupBlockSig;
22
23 #define PG_SETMASK(mask)        sigprocmask(SIG_SETMASK, mask, NULL)
24 #else                                                   /* not HAVE_SIGPROCMASK */
25 extern int      UnBlockSig,
26                         BlockSig,
27                         StartupBlockSig;
28
29 #ifndef WIN32
30 #define PG_SETMASK(mask)        sigsetmask(*((int*)(mask)))
31 #else
32 #define PG_SETMASK(mask)                pqsigsetmask(*((int*)(mask)))
33 int                     pqsigsetmask(int mask);
34 #endif
35
36 #define sigaddset(set, signum)  (*(set) |= (sigmask(signum)))
37 #define sigdelset(set, signum)  (*(set) &= ~(sigmask(signum)))
38 #endif   /* not HAVE_SIGPROCMASK */
39
40 extern void pqinitmask(void);
41
42 #endif   /* PQSIGNAL_H */