cryptenroll/repart/creds: no longer default to binding against literal PCR 7 (#36200)
[systemd.io.git] / man / journal-iterate-poll.c
blob6b78296267ad3f1613c0bbb8bfc66c8a64107fa9
1 /* SPDX-License-Identifier: MIT-0 */
3 #define _GNU_SOURCE 1
4 #include <poll.h>
5 #include <time.h>
6 #include <systemd/sd-journal.h>
8 int wait_for_changes(sd_journal *j) {
9 uint64_t t;
10 int msec;
11 struct pollfd pollfd;
13 sd_journal_get_timeout(j, &t);
14 if (t == (uint64_t) -1)
15 msec = -1;
16 else {
17 struct timespec ts;
18 uint64_t n;
19 clock_gettime(CLOCK_MONOTONIC, &ts);
20 n = (uint64_t) ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
21 msec = t > n ? (int) ((t - n + 999) / 1000) : 0;
24 pollfd.fd = sd_journal_get_fd(j);
25 pollfd.events = sd_journal_get_events(j);
26 poll(&pollfd, 1, msec);
27 return sd_journal_process(j);