aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFujii Masao <fujii@postgresql.org>2020-11-04 14:48:02 +0900
committerFujii Masao <fujii@postgresql.org>2020-11-04 14:48:02 +0900
commit02d332297f9bfe63476d53a439cc8f3b05bb5e67 (patch)
treefa92a88d6b6d85eb743c5bf45493cc62a15971c0
parent9f12a3b95dd56c897f1aa3d756d8fb419e84a187 (diff)
downloadpostgresql-02d332297f9bfe63476d53a439cc8f3b05bb5e67.tar.gz
postgresql-02d332297f9bfe63476d53a439cc8f3b05bb5e67.zip
Use standard SIGHUP handler in syslogger.
Commit 1e53fe0e70 changed background processes so that they use standard SIGHUP handler. Like that, this commit makes syslogger use standard SIGHUP handler to simplify the code. Author: Bharath Rupireddy Reviewed-by: Fujii Masao Discussion: https://postgr.es/m/CALj2ACXPorUqePswDtOeM_s82v9RW32E1fYmOPZ5NuE+TWKj_A@mail.gmail.com
-rw-r--r--src/backend/postmaster/syslogger.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/src/backend/postmaster/syslogger.c b/src/backend/postmaster/syslogger.c
index ffcb54968f1..faa82ec4815 100644
--- a/src/backend/postmaster/syslogger.c
+++ b/src/backend/postmaster/syslogger.c
@@ -39,6 +39,7 @@
#include "pgstat.h"
#include "pgtime.h"
#include "postmaster/fork_process.h"
+#include "postmaster/interrupt.h"
#include "postmaster/postmaster.h"
#include "postmaster/syslogger.h"
#include "storage/dsm.h"
@@ -123,7 +124,6 @@ static CRITICAL_SECTION sysloggerSection;
/*
* Flags set by interrupt handlers for later service in the main loop.
*/
-static volatile sig_atomic_t got_SIGHUP = false;
static volatile sig_atomic_t rotation_requested = false;
@@ -144,7 +144,6 @@ static unsigned int __stdcall pipeThread(void *arg);
static void logfile_rotate(bool time_based_rotation, int size_rotation_for);
static char *logfile_getname(pg_time_t timestamp, const char *suffix);
static void set_next_rotation_time(void);
-static void sigHupHandler(SIGNAL_ARGS);
static void sigUsr1Handler(SIGNAL_ARGS);
static void update_metainfo_datafile(void);
@@ -240,7 +239,7 @@ SysLoggerMain(int argc, char *argv[])
* broken backends...
*/
- pqsignal(SIGHUP, sigHupHandler); /* set flag to read config file */
+ pqsignal(SIGHUP, SignalHandlerForConfigReload); /* set flag to read config file */
pqsignal(SIGINT, SIG_IGN);
pqsignal(SIGTERM, SIG_IGN);
pqsignal(SIGQUIT, SIG_IGN);
@@ -324,9 +323,9 @@ SysLoggerMain(int argc, char *argv[])
/*
* Process any requests or signals received recently.
*/
- if (got_SIGHUP)
+ if (ConfigReloadPending)
{
- got_SIGHUP = false;
+ ConfigReloadPending = false;
ProcessConfigFile(PGC_SIGHUP);
/*
@@ -1553,18 +1552,6 @@ RemoveLogrotateSignalFiles(void)
unlink(LOGROTATE_SIGNAL_FILE);
}
-/* SIGHUP: set flag to reload config file */
-static void
-sigHupHandler(SIGNAL_ARGS)
-{
- int save_errno = errno;
-
- got_SIGHUP = true;
- SetLatch(MyLatch);
-
- errno = save_errno;
-}
-
/* SIGUSR1: set flag to rotate logfile */
static void
sigUsr1Handler(SIGNAL_ARGS)