From df50185b43916926a72246ab3a80875eda7ad2a3 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 4 Jan 2012 18:33:36 +0100 Subject: journal: beef up journal output of systemctl and journalctl --- src/util.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/util.c') diff --git a/src/util.c b/src/util.c index de36d1595e..8a6c3bb5e7 100644 --- a/src/util.c +++ b/src/util.c @@ -4694,6 +4694,24 @@ int pipe_eof(int fd) { return pollfd.revents & POLLHUP; } +int fd_wait_for_event(int fd, int event) { + struct pollfd pollfd; + int r; + + zero(pollfd); + pollfd.fd = fd; + pollfd.events = event; + + r = poll(&pollfd, 1, -1); + if (r < 0) + return -errno; + + if (r == 0) + return 0; + + return pollfd.revents; +} + int fopen_temporary(const char *path, FILE **_f, char **_temp_path) { FILE *f; char *t; -- cgit v1.2.3-54-g00ecf