]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/journal-iterate-poll.c
man: drop license header in glib-event-glue.c
[thirdparty/systemd.git] / man / journal-iterate-poll.c
CommitLineData
929f5263
ZJS
1#include <poll.h>
2#include <systemd/sd-journal.h>
3
4int wait_for_changes(sd_journal *j) {
5 struct pollfd pollfd;
6 int msec;
7
8 sd_journal_get_timeout(m, &t);
9 if (t == (uint64_t) -1)
10 msec = -1;
11 else {
12 struct timespec ts;
13 uint64_t n;
14 clock_gettime(CLOCK_MONOTONIC, &ts);
15 n = (uint64_t) ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
16 msec = t > n ? (int) ((t - n + 999) / 1000) : 0;
17 }
18
19 pollfd.fd = sd_journal_get_fd(j);
20 pollfd.events = sd_journal_get_events(j);
21 poll(&pollfd, 1, msec);
22 return sd_journal_process(j);
23}