mirror of
https://github.com/postgres/postgres.git
synced 2025-05-12 16:21:30 +03:00
Actually, it's not that hard to merge the Windows pqsignal code ...
... just need to typedef sigset_t and provide sigemptyset/sigfillset, which are easy enough.
This commit is contained in:
parent
2c713d6ea2
commit
f333204bbc
@ -18,15 +18,10 @@
|
|||||||
#include "libpq/pqsignal.h"
|
#include "libpq/pqsignal.h"
|
||||||
|
|
||||||
|
|
||||||
#ifndef WIN32
|
/* Global variables */
|
||||||
sigset_t UnBlockSig,
|
sigset_t UnBlockSig,
|
||||||
BlockSig,
|
BlockSig,
|
||||||
StartupBlockSig;
|
StartupBlockSig;
|
||||||
#else
|
|
||||||
int UnBlockSig,
|
|
||||||
BlockSig,
|
|
||||||
StartupBlockSig;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -45,8 +40,6 @@ int UnBlockSig,
|
|||||||
void
|
void
|
||||||
pqinitmask(void)
|
pqinitmask(void)
|
||||||
{
|
{
|
||||||
#ifndef WIN32
|
|
||||||
|
|
||||||
sigemptyset(&UnBlockSig);
|
sigemptyset(&UnBlockSig);
|
||||||
|
|
||||||
/* First set all signals, then clear some. */
|
/* First set all signals, then clear some. */
|
||||||
@ -101,19 +94,4 @@ pqinitmask(void)
|
|||||||
#ifdef SIGALRM
|
#ifdef SIGALRM
|
||||||
sigdelset(&StartupBlockSig, SIGALRM);
|
sigdelset(&StartupBlockSig, SIGALRM);
|
||||||
#endif
|
#endif
|
||||||
#else /* WIN32 */
|
|
||||||
/* Set the signals we want. */
|
|
||||||
UnBlockSig = 0;
|
|
||||||
BlockSig = sigmask(SIGQUIT) |
|
|
||||||
sigmask(SIGTERM) | sigmask(SIGALRM) |
|
|
||||||
/* common signals between two */
|
|
||||||
sigmask(SIGHUP) |
|
|
||||||
sigmask(SIGINT) | sigmask(SIGUSR1) |
|
|
||||||
sigmask(SIGUSR2) | sigmask(SIGCHLD) |
|
|
||||||
sigmask(SIGWINCH) | sigmask(SIGFPE);
|
|
||||||
StartupBlockSig = sigmask(SIGHUP) |
|
|
||||||
sigmask(SIGINT) | sigmask(SIGUSR1) |
|
|
||||||
sigmask(SIGUSR2) | sigmask(SIGCHLD) |
|
|
||||||
sigmask(SIGWINCH) | sigmask(SIGFPE);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
@ -16,27 +16,24 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
extern sigset_t UnBlockSig,
|
|
||||||
BlockSig,
|
|
||||||
StartupBlockSig;
|
|
||||||
|
|
||||||
#define PG_SETMASK(mask) sigprocmask(SIG_SETMASK, mask, NULL)
|
#define PG_SETMASK(mask) sigprocmask(SIG_SETMASK, mask, NULL)
|
||||||
#else /* WIN32 */
|
#else
|
||||||
/*
|
/* Emulate POSIX sigset_t APIs on Windows */
|
||||||
* Windows doesn't provide the POSIX signal API, so we use something
|
typedef int sigset_t;
|
||||||
* approximating the old BSD signal API.
|
|
||||||
*/
|
|
||||||
extern int UnBlockSig,
|
|
||||||
BlockSig,
|
|
||||||
StartupBlockSig;
|
|
||||||
|
|
||||||
extern int pqsigsetmask(int mask);
|
extern int pqsigsetmask(int mask);
|
||||||
|
|
||||||
#define PG_SETMASK(mask) pqsigsetmask(*(mask))
|
#define PG_SETMASK(mask) pqsigsetmask(*(mask))
|
||||||
|
#define sigemptyset(set) (*(set) = 0)
|
||||||
|
#define sigfillset(set) (*(set) = ~0)
|
||||||
#define sigaddset(set, signum) (*(set) |= (sigmask(signum)))
|
#define sigaddset(set, signum) (*(set) |= (sigmask(signum)))
|
||||||
#define sigdelset(set, signum) (*(set) &= ~(sigmask(signum)))
|
#define sigdelset(set, signum) (*(set) &= ~(sigmask(signum)))
|
||||||
#endif /* WIN32 */
|
#endif /* WIN32 */
|
||||||
|
|
||||||
|
extern sigset_t UnBlockSig,
|
||||||
|
BlockSig,
|
||||||
|
StartupBlockSig;
|
||||||
|
|
||||||
extern void pqinitmask(void);
|
extern void pqinitmask(void);
|
||||||
|
|
||||||
#endif /* PQSIGNAL_H */
|
#endif /* PQSIGNAL_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user