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-2024, 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 WIN32
19 /* Emulate POSIX sigset_t APIs on Windows */
20 typedef int sigset_t;
21 
22 #define SA_RESTART 1
23 #define SA_NODEFER 2
24 
25 struct sigaction
26 {
27  void (*sa_handler) (int);
28  /* sa_sigaction not yet implemented */
29  sigset_t sa_mask;
30  int sa_flags;
31 };
32 
33 extern int pqsigprocmask(int how, const sigset_t *set, sigset_t *oset);
34 extern int pqsigaction(int signum, const struct sigaction *act,
35  struct sigaction *oldact);
36 
37 #define SIG_BLOCK 1
38 #define SIG_UNBLOCK 2
39 #define SIG_SETMASK 3
40 #define sigprocmask(how, set, oset) pqsigprocmask((how), (set), (oset))
41 #define sigaction(signum, act, oldact) pqsigaction((signum), (act), (oldact))
42 #define sigemptyset(set) (*(set) = 0)
43 #define sigfillset(set) (*(set) = ~0)
44 #define sigaddset(set, signum) (*(set) |= (sigmask(signum)))
45 #define sigdelset(set, signum) (*(set) &= ~(sigmask(signum)))
46 #endif /* WIN32 */
47 
48 extern PGDLLIMPORT sigset_t UnBlockSig;
49 extern PGDLLIMPORT sigset_t BlockSig;
50 extern PGDLLIMPORT sigset_t StartupBlockSig;
51 
52 extern void pqinitmask(void);
53 
54 #endif /* PQSIGNAL_H */
#define PGDLLIMPORT
Definition: c.h:1305
void pqinitmask(void)
Definition: pqsignal.c:41
PGDLLIMPORT sigset_t BlockSig
Definition: pqsignal.c:23
PGDLLIMPORT sigset_t UnBlockSig
Definition: pqsignal.c:22
PGDLLIMPORT sigset_t StartupBlockSig
Definition: pqsignal.c:24
int pqsigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
Definition: signal.c:210
int pqsigprocmask(int how, const sigset_t *set, sigset_t *oset)
Definition: signal.c:171