summaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
diff options
context:
space:
mode:
authorHeikki Linnakangas2008-12-09 14:28:20 +0000
committerHeikki Linnakangas2008-12-09 14:28:20 +0000
commit7010f96d9b8a84f296ddbfa77ca922d2dfb9eb5f (patch)
treeb547e02fb9c1d87bde2f0c24252cd62a7d8fc177 /src/backend/tcop/postgres.c
parent9526bedcc7efbf1588c2373d19d5609344ff5829 (diff)
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.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 90c4c8400e..0049c86c13 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -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);