diff options
author | Stefano Garzarella <sgarzare@redhat.com> | 2022-06-08 09:52:53 +0200 |
---|---|---|
committer | Stefano Garzarella <sgarzare@redhat.com> | 2022-06-09 09:09:23 +0200 |
commit | c3081e4896344dbf0c27103a60c90eaa8d35715e (patch) | |
tree | 2487a8ea9384924ec651ee39b46980eb97613abf /src | |
parent | 5dedbc7850448ae3922ab0a833f3eb971bf7e25f (diff) | |
download | nix-c3081e4896344dbf0c27103a60c90eaa8d35715e.zip |
ppoll: make sigmask parameter optional
ppoll(2) supports 'sigmask' as NULL. In that case no signal mask
manipulation is performed.
Let's make `sigmask` parameter of `nix::poll::ppoll` optional
to allow that behaviour.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/poll.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/poll.rs b/src/poll.rs index 6d332b03..3004d24c 100644 --- a/src/poll.rs +++ b/src/poll.rs @@ -151,20 +151,24 @@ feature! { /// `ppoll` behaves like `poll`, but let you specify what signals may interrupt it /// with the `sigmask` argument. If you want `ppoll` to block indefinitely, /// specify `None` as `timeout` (it is like `timeout = -1` for `poll`). +/// If `sigmask` is `None`, then no signal mask manipulation is performed, +/// so in that case `ppoll` differs from `poll` only in the precision of the +/// timeout argument. /// #[cfg(any(target_os = "android", target_os = "dragonfly", target_os = "freebsd", target_os = "linux"))] pub fn ppoll( fds: &mut [PollFd], timeout: Option<crate::sys::time::TimeSpec>, - sigmask: crate::sys::signal::SigSet + sigmask: Option<crate::sys::signal::SigSet> ) -> Result<libc::c_int> { let timeout = timeout.as_ref().map_or(core::ptr::null(), |r| r.as_ref()); + let sigmask = sigmask.as_ref().map_or(core::ptr::null(), |r| r.as_ref()); let res = unsafe { libc::ppoll(fds.as_mut_ptr() as *mut libc::pollfd, fds.len() as libc::nfds_t, timeout, - sigmask.as_ref()) + sigmask) }; Errno::result(res) } |