summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-01-04 18:33:36 +0100
committerLennart Poettering <lennart@poettering.net>2012-01-04 18:33:36 +0100
commitdf50185b43916926a72246ab3a80875eda7ad2a3 (patch)
treeabc859fb7e4e28dab3cd870a66638232365aedca /src/util.c
parentfd8ee359a014916ac62ae2b58f6736ccb48c6d4e (diff)
journal: beef up journal output of systemctl and journalctl
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c18
1 files changed, 18 insertions, 0 deletions
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;