1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +03:00

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.
This commit is contained in:
Heikki Linnakangas
2008-12-09 14:28:20 +00:00
parent 9edd720050
commit 7b05b3fa39
10 changed files with 143 additions and 45 deletions

View File

@ -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
@ -2436,6 +2436,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.
*
@ -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);