summary refs log tree commit diff
path: root/sys_util/src
diff options
context:
space:
mode:
authorZach Reizner <zachr@google.com>2019-11-22 17:11:03 -0800
committerCommit Bot <commit-bot@chromium.org>2019-11-26 21:05:42 +0000
commite3f1271842625872b06da54a1f4de03b1dba014a (patch)
treedea823d49f753a3376cfa97257acd8fddabe41ba /sys_util/src
parent1a2683b90dbb65326edd07151ce78c277bfa171b (diff)
downloadcrosvm-e3f1271842625872b06da54a1f4de03b1dba014a.tar
crosvm-e3f1271842625872b06da54a1f4de03b1dba014a.tar.gz
crosvm-e3f1271842625872b06da54a1f4de03b1dba014a.tar.bz2
crosvm-e3f1271842625872b06da54a1f4de03b1dba014a.tar.lz
crosvm-e3f1271842625872b06da54a1f4de03b1dba014a.tar.xz
crosvm-e3f1271842625872b06da54a1f4de03b1dba014a.tar.zst
crosvm-e3f1271842625872b06da54a1f4de03b1dba014a.zip
sys_util: poll: add iter_writable to set of methods for PollEvents
There were already methods for the readable and hungup events, so this
completes the set.

TEST=None
BUG=chromium:1023975

Change-Id: Ie9cd1459893cc8b6ba7a52e638e164095ddbcba5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1930404
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Diffstat (limited to 'sys_util/src')
-rw-r--r--sys_util/src/poll.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys_util/src/poll.rs b/sys_util/src/poll.rs
index 7c09bb7..1b92c96 100644
--- a/sys_util/src/poll.rs
+++ b/sys_util/src/poll.rs
@@ -201,6 +201,15 @@ impl<'a, T: PollToken> PollEvents<'a, T> {
         }
     }
 
+    /// Iterates over each writable event.
+    pub fn iter_writable(&self) -> PollEventIter<slice::Iter<epoll_event>, T> {
+        PollEventIter {
+            mask: EPOLLOUT as u32,
+            iter: self.events[..self.count].iter(),
+            tokens: PhantomData,
+        }
+    }
+
     /// Iterates over each hungup event.
     pub fn iter_hungup(&self) -> PollEventIter<slice::Iter<epoll_event>, T> {
         PollEventIter {