summaryrefslogtreecommitdiff
path: root/src/journal/journald.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/journal/journald.c')
-rw-r--r--src/journal/journald.c41
1 files changed, 33 insertions, 8 deletions
diff --git a/src/journal/journald.c b/src/journal/journald.c
index 7b3b6471de..f2dd4050b6 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -48,6 +48,7 @@
#include "journal-rate-limit.h"
#include "journal-internal.h"
#include "journal-vacuum.h"
+#include "journal-authenticate.h"
#include "conf-parser.h"
#include "journald.h"
#include "virt.h"
@@ -2969,8 +2970,26 @@ int main(int argc, char *argv[]) {
for (;;) {
struct epoll_event event;
+ int t;
- r = epoll_wait(server.epoll_fd, &event, 1, -1);
+#ifdef HAVE_GCRYPT
+ usec_t u;
+
+ if (server.system_journal &&
+ journal_file_next_evolve_usec(server.system_journal, &u)) {
+ usec_t n;
+
+ n = now(CLOCK_MONOTONIC);
+
+ if (n >= u)
+ t = 0;
+ else
+ t = (int) ((u - n + USEC_PER_MSEC - 1) / USEC_PER_MSEC);
+ } else
+#endif
+ t = -1;
+
+ r = epoll_wait(server.epoll_fd, &event, 1, t);
if (r < 0) {
if (errno == EINTR)
@@ -2979,14 +2998,20 @@ int main(int argc, char *argv[]) {
log_error("epoll_wait() failed: %m");
r = -errno;
goto finish;
- } else if (r == 0)
- break;
+ }
- r = process_event(&server, &event);
- if (r < 0)
- goto finish;
- else if (r == 0)
- break;
+ if (r > 0) {
+ r = process_event(&server, &event);
+ if (r < 0)
+ goto finish;
+ else if (r == 0)
+ break;
+ }
+
+#ifdef HAVE_GCRYPT
+ if (server.system_journal)
+ journal_file_maybe_append_tag(server.system_journal, 0);
+#endif
}
log_debug("systemd-journald stopped as pid %lu", (unsigned long) getpid());