]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Revert "Merge branch 'bugfix' into 'master'"
authorRay Strode <halfline@gmail.com>
Tue, 16 Jul 2019 13:50:37 +0000 (13:50 +0000)
committerRay Strode <halfline@gmail.com>
Tue, 16 Jul 2019 13:50:37 +0000 (13:50 +0000)
This reverts merge request !46

src/libply/ply-utils.c
src/libply/ply-utils.h

index 71a520f2d82987faed28d8c3b08db078d4b30da3..0cadae962d66a871da9eb56014be34c3d7b25add 100644 (file)
@@ -386,6 +386,36 @@ ply_read_uint32 (int       fd,
         return true;
 }
 
+bool
+ply_fd_has_data (int fd)
+{
+        struct pollfd poll_data;
+        int result;
+
+        poll_data.fd = fd;
+        poll_data.events = POLLIN | POLLPRI;
+        poll_data.revents = 0;
+        result = poll (&poll_data, 1, 10);
+
+        return result == 1
+               && ((poll_data.revents & POLLIN)
+                   || (poll_data.revents & POLLPRI));
+}
+
+bool
+ply_fd_can_take_data (int fd)
+{
+        struct pollfd poll_data;
+        int result;
+
+        poll_data.fd = fd;
+        poll_data.events = POLLOUT;
+        poll_data.revents = 0;
+        result = poll (&poll_data, 1, 10);
+
+        return result == 1;
+}
+
 bool
 ply_fd_may_block (int fd)
 {
index 8295e73fca5bbe127eaabb275d1f329737fdc083..4dd9c09ae04dac40bd77e1d1dd2659d414528745 100644 (file)
@@ -80,6 +80,8 @@ bool ply_read_uint32 (int       fd,
                       uint32_t *value);
 
 bool ply_fd_has_data (int fd);
+bool ply_fd_can_take_data (int fd);
+bool ply_fd_may_block (int fd);
 bool ply_set_fd_as_blocking (int fd);
 char **ply_copy_string_array (const char *const *array);
 void ply_free_string_array (char **array);