if (!f->seal)
return 0;
+ if (realtime <= 0)
+ realtime = now(CLOCK_MONOTONIC);
+
r = journal_file_fsprg_need_evolve(f, realtime);
if (r <= 0)
return 0;
return 0;
}
+
+bool journal_file_next_evolve_usec(JournalFile *f, usec_t *u) {
+ uint64_t epoch;
+
+ assert(f);
+ assert(u);
+
+ if (!f->seal)
+ return false;
+
+ epoch = FSPRG_GetEpoch(f->fsprg_state);
+
+ *u = (usec_t) (f->fss_start_usec + f->fss_interval_usec * epoch + f->fss_interval_usec);
+
+ return true;
+}
int journal_file_fsprg_evolve(JournalFile *f, uint64_t realtime);
int journal_file_fsprg_seek(JournalFile *f, uint64_t epoch);
+
+bool journal_file_next_evolve_usec(JournalFile *f, usec_t *u);
#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"
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)
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());