PostgreSQL Source Code  git master
pqsignal.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * pqsignal.h
4  * Backend signal(2) support (see also src/port/pqsignal.c)
5  *
6  * Portions Copyright (c) 1996-2022, 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 PGDLLIMPORT sigset_t UnBlockSig;
34 extern PGDLLIMPORT sigset_t BlockSig;
35 extern PGDLLIMPORT sigset_t 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 */
#define PGDLLIMPORT
Definition: c.h:1342
void(* pqsigfunc)(int signo)
Definition: port.h:535
void pqinitmask(void)
Definition: pqsignal.c:41
PGDLLIMPORT sigset_t BlockSig
Definition: pqsignal.c:23
pqsigfunc pqsignal_pm(int signo, pqsigfunc func)
Definition: pqsignal.c:120
PGDLLIMPORT sigset_t UnBlockSig
Definition: pqsignal.c:22
PGDLLIMPORT sigset_t StartupBlockSig
Definition: pqsignal.c:24
int pqsigsetmask(int mask)
Definition: signal.c:157