summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-06-09 15:04:14 +0200
committerLennart Poettering <lennart@poettering.net>2012-06-17 00:03:12 +0200
commitba6b3039531a70466dd955c6faa9bf521b3dfbac (patch)
treeba565e8a373a65a2d1c2e0a99029e2023b7252b8 /src
parent38a6db16dc6f3ac6e6f497c90e51fb9904d785ba (diff)
journal: rotate on SIGUSR2
Diffstat (limited to 'src')
-rw-r--r--src/journal/journald.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/journal/journald.c b/src/journal/journald.c
index 795b23547b..1bf25e8091 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -2143,6 +2143,7 @@ static int server_flush_proc_kmsg(Server *s) {
static int process_event(Server *s, struct epoll_event *ev) {
assert(s);
+ assert(ev);
if (ev->data.fd == s->signal_fd) {
struct signalfd_siginfo sfsi;
@@ -2167,7 +2168,13 @@ static int process_event(Server *s, struct epoll_event *ev) {
if (sfsi.ssi_signo == SIGUSR1) {
server_flush_to_var(s);
- return 0;
+ return 1;
+ }
+
+ if (sfsi.ssi_signo == SIGUSR2) {
+ server_rotate(s);
+ server_vacuum(s);
+ return 1;
}
log_debug("Received SIG%s", signal_to_string(sfsi.ssi_signo));
@@ -2558,7 +2565,7 @@ static int open_signalfd(Server *s) {
assert(s);
assert_se(sigemptyset(&mask) == 0);
- sigset_add_many(&mask, SIGINT, SIGTERM, SIGUSR1, -1);
+ sigset_add_many(&mask, SIGINT, SIGTERM, SIGUSR1, SIGUSR2, -1);
assert_se(sigprocmask(SIG_SETMASK, &mask, NULL) == 0);
s->signal_fd = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC);