summaryrefslogtreecommitdiff
path: root/src/journal/journald.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-12-11 20:13:44 +0100
committerLennart Poettering <lennart@poettering.net>2013-12-11 20:55:09 +0100
commitf9a810bedacf1da7c505c1786a2416d592665926 (patch)
treee4fdb88684e2bacb4567228aabd3448d75fb3ce0 /src/journal/journald.c
parent419173e60a05424008fcd312f6df4b59b2ce8e62 (diff)
journald: port to sd-event and enable watchdog support
Diffstat (limited to 'src/journal/journald.c')
-rw-r--r--src/journal/journald.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/src/journal/journald.c b/src/journal/journald.c
index 5fb10b1d3f..aa12fa785d 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -70,9 +70,7 @@ int main(int argc, char *argv[]) {
"STATUS=Processing requests...");
for (;;) {
- struct epoll_event event;
- int t = -1;
- usec_t n;
+ usec_t t = (usec_t) -1, n;
n = now(CLOCK_REALTIME);
@@ -87,7 +85,7 @@ int main(int argc, char *argv[]) {
}
/* Calculate when to rotate the next time */
- t = (int) ((server.oldest_file_usec + server.max_retention_usec - n + USEC_PER_MSEC - 1) / USEC_PER_MSEC);
+ t = server.oldest_file_usec + server.max_retention_usec - n;
}
#ifdef HAVE_GCRYPT
@@ -98,30 +96,18 @@ int main(int argc, char *argv[]) {
if (n >= u)
t = 0;
else
- t = MIN(t, (int) ((u - n + USEC_PER_MSEC - 1) / USEC_PER_MSEC));
+ t = MIN(t, u - n);
}
}
#endif
- r = epoll_wait(server.epoll_fd, &event, 1, t);
+ r = sd_event_run(server.event, t);
if (r < 0) {
-
- if (errno == EINTR)
- continue;
-
- log_error("epoll_wait() failed: %m");
+ log_error("Failed to run event loop: %s", strerror(-r));
r = -errno;
goto finish;
}
- if (r > 0) {
- r = process_event(&server, &event);
- if (r < 0)
- goto finish;
- else if (r == 0)
- break;
- }
-
server_maybe_append_tags(&server);
server_maybe_warn_forward_syslog_missed(&server);
}
@@ -130,8 +116,7 @@ int main(int argc, char *argv[]) {
server_driver_message(&server, SD_MESSAGE_JOURNAL_STOP, "Journal stopped");
finish:
- sd_notify(false,
- "STATUS=Shutting down...");
+ sd_notify(false, "STATUS=Shutting down...");
server_done(&server);