Commit b63b967a authored by Peter Eisentraut's avatar Peter Eisentraut

If there is no sigdelset(), define it as a macro.

This removes some duplicate code that recreated the identical workaround
when the newer signal API is missing.
parent 52fc0075
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/bgwriter.c,v 1.63 2009/07/31 20:26:22 tgl Exp $ * $PostgreSQL: pgsql/src/backend/postmaster/bgwriter.c,v 1.64 2009/12/16 22:55:33 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -244,11 +244,7 @@ BackgroundWriterMain(void) ...@@ -244,11 +244,7 @@ BackgroundWriterMain(void)
pqsignal(SIGWINCH, SIG_DFL); pqsignal(SIGWINCH, SIG_DFL);
/* We allow SIGQUIT (quickdie) at all times */ /* We allow SIGQUIT (quickdie) at all times */
#ifdef HAVE_SIGPROCMASK
sigdelset(&BlockSig, SIGQUIT); sigdelset(&BlockSig, SIGQUIT);
#else
BlockSig &= ~(sigmask(SIGQUIT));
#endif
/* /*
* Initialize so that first time-driven event happens at the correct time. * Initialize so that first time-driven event happens at the correct time.
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/walwriter.c,v 1.8 2009/07/31 20:26:23 tgl Exp $ * $PostgreSQL: pgsql/src/backend/postmaster/walwriter.c,v 1.9 2009/12/16 22:55:33 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -126,11 +126,7 @@ WalWriterMain(void) ...@@ -126,11 +126,7 @@ WalWriterMain(void)
pqsignal(SIGWINCH, SIG_DFL); pqsignal(SIGWINCH, SIG_DFL);
/* We allow SIGQUIT (quickdie) at all times */ /* We allow SIGQUIT (quickdie) at all times */
#ifdef HAVE_SIGPROCMASK
sigdelset(&BlockSig, SIGQUIT); sigdelset(&BlockSig, SIGQUIT);
#else
BlockSig &= ~(sigmask(SIGQUIT));
#endif
/* /*
* Create a resource owner to keep track of our resources (not clear that * Create a resource owner to keep track of our resources (not clear that
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.576 2009/12/15 04:57:47 rhaas Exp $ * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.577 2009/12/16 22:55:33 petere Exp $
* *
* NOTES * NOTES
* this is the "main" module of the postgres backend and * this is the "main" module of the postgres backend and
...@@ -3292,11 +3292,7 @@ PostgresMain(int argc, char *argv[], const char *username) ...@@ -3292,11 +3292,7 @@ PostgresMain(int argc, char *argv[], const char *username)
if (IsUnderPostmaster) if (IsUnderPostmaster)
{ {
/* We allow SIGQUIT (quickdie) at all times */ /* We allow SIGQUIT (quickdie) at all times */
#ifdef HAVE_SIGPROCMASK
sigdelset(&BlockSig, SIGQUIT); sigdelset(&BlockSig, SIGQUIT);
#else
BlockSig &= ~(sigmask(SIGQUIT));
#endif
} }
PG_SETMASK(&BlockSig); /* block everything except SIGQUIT */ PG_SETMASK(&BlockSig); /* block everything except SIGQUIT */
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/libpq/pqsignal.h,v 1.34 2009/08/29 19:26:51 tgl Exp $ * $PostgreSQL: pgsql/src/include/libpq/pqsignal.h,v 1.35 2009/12/16 22:55:34 petere Exp $
* *
* NOTES * NOTES
* This shouldn't be in libpq, but the monitor and some other * This shouldn't be in libpq, but the monitor and some other
...@@ -26,7 +26,7 @@ extern sigset_t UnBlockSig, ...@@ -26,7 +26,7 @@ extern sigset_t UnBlockSig,
StartupBlockSig; StartupBlockSig;
#define PG_SETMASK(mask) sigprocmask(SIG_SETMASK, mask, NULL) #define PG_SETMASK(mask) sigprocmask(SIG_SETMASK, mask, NULL)
#else #else /* not HAVE_SIGPROCMASK */
extern int UnBlockSig, extern int UnBlockSig,
BlockSig, BlockSig,
StartupBlockSig; StartupBlockSig;
...@@ -37,7 +37,9 @@ extern int UnBlockSig, ...@@ -37,7 +37,9 @@ extern int UnBlockSig,
#define PG_SETMASK(mask) pqsigsetmask(*((int*)(mask))) #define PG_SETMASK(mask) pqsigsetmask(*((int*)(mask)))
int pqsigsetmask(int mask); int pqsigsetmask(int mask);
#endif #endif
#endif
#define sigdelset(set, signum) (*(set) &= ~(sigmask(signum)))
#endif /* not HAVE_SIGPROCMASK */
typedef void (*pqsigfunc) (int); typedef void (*pqsigfunc) (int);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment