File just-reopen-logs-signal.patch of Package pgbouncer
Index: pgbouncer-1.23.1/src/main.c
===================================================================
--- pgbouncer-1.23.1.orig/src/main.c
+++ pgbouncer-1.23.1/src/main.c
@@ -526,6 +526,7 @@ static struct event ev_sigquit;
static struct event ev_sigusr1;
static struct event ev_sigusr2;
static struct event ev_sighup;
+static struct event ev_sigttin;
static void handle_sigquit(evutil_socket_t sock, short flags, void *arg)
{
@@ -574,6 +575,12 @@ static void handle_sighup(int sock, shor
log_error("TLS configuration could not be reloaded, keeping old configuration");
sd_notify(0, "READY=1");
}
+
+static void handle_sigttin(int sock, short flags, void *arg)
+{
+ log_info("Got SIGTTIN re-open logfiles");
+ reset_logging();
+}
#endif
static void signal_setup(void)
@@ -612,6 +619,12 @@ static void signal_setup(void)
if (err < 0)
fatal_perror("evsignal_add");
#endif
+
+ evsignal_assign(&ev_sigttin, pgb_event_base, SIGTTIN, handle_sigttin, NULL);
+ err = evsignal_add(&ev_sigttin, NULL);
+ if (err < 0)
+ fatal_perror("evsignal_add");
+
evsignal_assign(&ev_sigterm, pgb_event_base, SIGTERM, handle_sigterm, NULL);
err = evsignal_add(&ev_sigterm, NULL);
if (err < 0)