2
0

pqsignal.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. #include <signal.h>
  16. #ifndef WIN32
  17. #define PG_SETMASK(mask) sigprocmask(SIG_SETMASK, mask, NULL)
  18. #else
  19. /* Emulate POSIX sigset_t APIs on Windows */
  20. typedef int sigset_t;
  21. extern int pqsigsetmask(int mask);
  22. #define PG_SETMASK(mask) pqsigsetmask(*(mask))
  23. #define sigemptyset(set) (*(set) = 0)
  24. #define sigfillset(set) (*(set) = ~0)
  25. #define sigaddset(set, signum) (*(set) |= (sigmask(signum)))
  26. #define sigdelset(set, signum) (*(set) &= ~(sigmask(signum)))
  27. #endif /* WIN32 */
  28. extern PGDLLIMPORT sigset_t UnBlockSig;
  29. extern PGDLLIMPORT sigset_t BlockSig;
  30. extern PGDLLIMPORT sigset_t StartupBlockSig;
  31. extern void pqinitmask(void);
  32. /* pqsigfunc is declared in src/include/port.h */
  33. extern pqsigfunc pqsignal_pm(int signo, pqsigfunc func);
  34. #endif /* PQSIGNAL_H */