From 372ecd8a7204809fa2f00e74c573f635574dfc16 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 15 Jul 2019 18:36:34 +0200 Subject: [PATCH] Forward SIGUSR1 refs #5230 --- lib/cli/daemoncommand.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/cli/daemoncommand.cpp b/lib/cli/daemoncommand.cpp index 39fd804be..3dd8a8177 100644 --- a/lib/cli/daemoncommand.cpp +++ b/lib/cli/daemoncommand.cpp @@ -260,6 +260,7 @@ static const sigset_t l_UnixWorkerSignals = ([]() -> sigset_t { (void)sigemptyset(&s); (void)sigaddset(&s, SIGCHLD); + (void)sigaddset(&s, SIGUSR1); (void)sigaddset(&s, SIGUSR2); (void)sigaddset(&s, SIGINT); (void)sigaddset(&s, SIGTERM); @@ -272,10 +273,14 @@ static std::atomic l_CurrentlyStartingUnixWorkerPid (-1); static std::atomic l_CurrentlyStartingUnixWorkerState (UnixWorkerState::Pending); static std::atomic l_TermSignal (-1); static std::atomic l_RequestedReload (false); +static std::atomic l_RequestedReopenLogs (false); static void UmbrellaSignalHandler(int num, siginfo_t *info, void*) { switch (num) { + case SIGUSR1: + l_RequestedReopenLogs.store(true); + break; case SIGUSR2: if (l_CurrentlyStartingUnixWorkerState.load() == UnixWorkerState::Pending && info->si_pid == l_CurrentlyStartingUnixWorkerPid.load()) { @@ -373,6 +378,7 @@ static pid_t StartUnixWorker(const std::vector& configs) sa.sa_handler = SIG_DFL; (void)sigaction(SIGCHLD, &sa, nullptr); + (void)sigaction(SIGUSR1, &sa, nullptr); (void)sigaction(SIGHUP, &sa, nullptr); } @@ -556,6 +562,7 @@ int DaemonCommand::Run(const po::variables_map& vm, const std::vector 0) {