]>
git.ipfire.org Git - thirdparty/systemd.git/blob - man/journal-iterate-poll.c
3 #include <systemd/sd-journal.h>
5 int wait_for_changes(sd_journal
*j
) {
10 sd_journal_get_timeout(j
, &t
);
11 if (t
== (uint64_t) -1)
16 clock_gettime(CLOCK_MONOTONIC
, &ts
);
17 n
= (uint64_t) ts
.tv_sec
* 1000000 + ts
.tv_nsec
/ 1000;
18 msec
= t
> n
? (int) ((t
- n
+ 999) / 1000) : 0;
21 pollfd
.fd
= sd_journal_get_fd(j
);
22 pollfd
.events
= sd_journal_get_events(j
);
23 poll(&pollfd
, 1, msec
);
24 return sd_journal_process(j
);