diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2008-12-09 14:28:20 +0000 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2008-12-09 14:28:20 +0000 |
commit | 7b05b3fa3996c6b7795c22757a31e2348378209d (patch) | |
tree | acfe73e103dc5291a7c61d7b90b476c9c1e27a35 /src/backend/tcop/postgres.c | |
parent | 9edd720050a2979c684b514f7d5118a8a0d45dff (diff) | |
download | postgresql-7b05b3fa3996c6b7795c22757a31e2348378209d.tar.gz postgresql-7b05b3fa3996c6b7795c22757a31e2348378209d.zip |
Provide support for multiplexing SIGUSR1 signal. The upcoming synchronous
replication patch needs a signal, but we've already used SIGUSR1 and
SIGUSR2 in normal backends. This patch allows reusing SIGUSR1 for that,
and for other purposes too if the need arises.
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r-- | src/backend/tcop/postgres.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index f262b8014ef..6df02a3f795 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.558 2008/11/30 20:51:25 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.559 2008/12/09 14:28:20 heikki Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -2437,6 +2437,23 @@ drop_unnamed_stmt(void) */ /* + * proc_sigusr1_handler - handle SIGUSR1 signal. + * + * SIGUSR1 is multiplexed to handle multiple different events. The signalFlags + * array in PGPROC indicates which events have been signaled. + */ +void +proc_sigusr1_handler(SIGNAL_ARGS) +{ + int save_errno = errno; + + if (CheckProcSignal(PROCSIG_CATCHUP_INTERRUPT)) + HandleCatchupInterrupt(); + + errno = save_errno; +} + +/* * quickdie() occurs when signalled SIGQUIT by the postmaster. * * Some backend has bought the farm, @@ -3180,7 +3197,7 @@ PostgresMain(int argc, char *argv[], const char *username) * of output during who-knows-what operation... */ pqsignal(SIGPIPE, SIG_IGN); - pqsignal(SIGUSR1, CatchupInterruptHandler); + pqsignal(SIGUSR1, proc_sigusr1_handler); pqsignal(SIGUSR2, NotifyInterruptHandler); pqsignal(SIGFPE, FloatExceptionHandler); |