Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b63b967

Browse files
committed
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.
1 parent 52fc007 commit b63b967

File tree

4 files changed

+8
-18
lines changed

4 files changed

+8
-18
lines changed

src/backend/postmaster/bgwriter.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
*
3939
*
4040
* IDENTIFICATION
41-
* $PostgreSQL: pgsql/src/backend/postmaster/bgwriter.c,v 1.63 2009/07/31 20:26:22 tgl Exp $
41+
* $PostgreSQL: pgsql/src/backend/postmaster/bgwriter.c,v 1.64 2009/12/16 22:55:33 petere Exp $
4242
*
4343
*-------------------------------------------------------------------------
4444
*/
@@ -244,11 +244,7 @@ BackgroundWriterMain(void)
244244
pqsignal(SIGWINCH, SIG_DFL);
245245

246246
/* We allow SIGQUIT (quickdie) at all times */
247-
#ifdef HAVE_SIGPROCMASK
248247
sigdelset(&BlockSig, SIGQUIT);
249-
#else
250-
BlockSig &= ~(sigmask(SIGQUIT));
251-
#endif
252248

253249
/*
254250
* Initialize so that first time-driven event happens at the correct time.

src/backend/postmaster/walwriter.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
*
3535
*
3636
* IDENTIFICATION
37-
* $PostgreSQL: pgsql/src/backend/postmaster/walwriter.c,v 1.8 2009/07/31 20:26:23 tgl Exp $
37+
* $PostgreSQL: pgsql/src/backend/postmaster/walwriter.c,v 1.9 2009/12/16 22:55:33 petere Exp $
3838
*
3939
*-------------------------------------------------------------------------
4040
*/
@@ -126,11 +126,7 @@ WalWriterMain(void)
126126
pqsignal(SIGWINCH, SIG_DFL);
127127

128128
/* We allow SIGQUIT (quickdie) at all times */
129-
#ifdef HAVE_SIGPROCMASK
130129
sigdelset(&BlockSig, SIGQUIT);
131-
#else
132-
BlockSig &= ~(sigmask(SIGQUIT));
133-
#endif
134130

135131
/*
136132
* Create a resource owner to keep track of our resources (not clear that

src/backend/tcop/postgres.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.576 2009/12/15 04:57:47 rhaas Exp $
11+
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.577 2009/12/16 22:55:33 petere Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -3292,11 +3292,7 @@ PostgresMain(int argc, char *argv[], const char *username)
32923292
if (IsUnderPostmaster)
32933293
{
32943294
/* We allow SIGQUIT (quickdie) at all times */
3295-
#ifdef HAVE_SIGPROCMASK
32963295
sigdelset(&BlockSig, SIGQUIT);
3297-
#else
3298-
BlockSig &= ~(sigmask(SIGQUIT));
3299-
#endif
33003296
}
33013297

33023298
PG_SETMASK(&BlockSig); /* block everything except SIGQUIT */

src/include/libpq/pqsignal.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/libpq/pqsignal.h,v 1.34 2009/08/29 19:26:51 tgl Exp $
10+
* $PostgreSQL: pgsql/src/include/libpq/pqsignal.h,v 1.35 2009/12/16 22:55:34 petere Exp $
1111
*
1212
* NOTES
1313
* This shouldn't be in libpq, but the monitor and some other
@@ -26,7 +26,7 @@ extern sigset_t UnBlockSig,
2626
StartupBlockSig;
2727

2828
#define PG_SETMASK(mask) sigprocmask(SIG_SETMASK, mask, NULL)
29-
#else
29+
#else /* not HAVE_SIGPROCMASK */
3030
extern int UnBlockSig,
3131
BlockSig,
3232
StartupBlockSig;
@@ -37,7 +37,9 @@ extern int UnBlockSig,
3737
#define PG_SETMASK(mask) pqsigsetmask(*((int*)(mask)))
3838
int pqsigsetmask(int mask);
3939
#endif
40-
#endif
40+
41+
#define sigdelset(set, signum) (*(set) &= ~(sigmask(signum)))
42+
#endif /* not HAVE_SIGPROCMASK */
4143

4244
typedef void (*pqsigfunc) (int);
4345

0 commit comments

Comments
 (0)