diff options
| author | Thomas Munro | 2022-07-16 04:07:45 +0000 |
|---|---|---|
| committer | Thomas Munro | 2022-07-16 05:03:38 +0000 |
| commit | c94ae9d827a360d74da6a304692d34a4dc8b6445 (patch) | |
| tree | 491e7d2ab3499968d9d32978d23bdc7701124859 /src/include/libpq | |
| parent | 3b8d23a3e14f05890f1f306902cd4b992beeee71 (diff) | |
Emulate sigprocmask(), not sigsetmask(), on Windows.
Since commit a65e0864, we've required Unix systems to have
sigprocmask(). As noted in that commit's message, we were still
emulating the historical pre-standard sigsetmask() function in our
Windows support code. Emulate standard sigprocmask() instead, for
consistency.
The PG_SETMASK() abstraction is now redundant and all calls could in
theory be replaced by plain sigprocmask() calls, but that isn't done by
this commit.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/3153247.1657834482%40sss.pgh.pa.us
Diffstat (limited to 'src/include/libpq')
| -rw-r--r-- | src/include/libpq/pqsignal.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/include/libpq/pqsignal.h b/src/include/libpq/pqsignal.h index 41227a30e24..d17ddb787e7 100644 --- a/src/include/libpq/pqsignal.h +++ b/src/include/libpq/pqsignal.h @@ -15,15 +15,18 @@ #include <signal.h> -#ifndef WIN32 #define PG_SETMASK(mask) sigprocmask(SIG_SETMASK, mask, NULL) -#else + +#ifdef WIN32 /* Emulate POSIX sigset_t APIs on Windows */ typedef int sigset_t; -extern int pqsigsetmask(int mask); +extern int pqsigprocmask(int how, const sigset_t *set, sigset_t *oset); -#define PG_SETMASK(mask) pqsigsetmask(*(mask)) +#define SIG_BLOCK 1 +#define SIG_UNBLOCK 2 +#define SIG_SETMASK 3 +#define sigprocmask(how, set, oset) pqsigprocmask((how), (set), (oset)) #define sigemptyset(set) (*(set) = 0) #define sigfillset(set) (*(set) = ~0) #define sigaddset(set, signum) (*(set) |= (sigmask(signum))) |
