1 /* SPDX-License-Identifier: MIT-0 */
6 #include <systemd/sd-journal.h>
8 int wait_for_changes(sd_journal
*j
) {
13 sd_journal_get_timeout(j
, &t
);
14 if (t
== (uint64_t) -1)
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
);