From ee531d949c2f62374fc109252f8cbe61c2b8ee39 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 4 Apr 2013 17:22:28 +0200 Subject: journal: add public API call sd_journal_get_events() This function should be used when filling in "struct pollfd"'s .events field for watching the journal. It will always return POLLIN for now, but we should keep our options open to change this later on. This mimics libsystemd-bus' sd_bus_get_events() call with the same purpose. --- src/journal/sd-journal.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/journal/sd-journal.c') diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index bb99671934..3eba4cd0d1 100644 --- a/src/journal/sd-journal.c +++ b/src/journal/sd-journal.c @@ -1981,6 +1981,19 @@ _public_ int sd_journal_get_fd(sd_journal *j) { return j->inotify_fd; } +_public_ int sd_journal_get_events(sd_journal *j) { + int fd; + + if (!j) + return -EINVAL; + + fd = sd_journal_get_fd(j); + if (fd < 0) + return fd; + + return POLLIN; +} + static void process_inotify_event(sd_journal *j, struct inotify_event *e) { Directory *d; int r; -- cgit v1.2.3-54-g00ecf