Skip to content

Commit

Permalink
Add epoll_pwait
Browse files Browse the repository at this point in the history
  • Loading branch information
DBLouis committed Aug 11, 2021
1 parent 68488a4 commit 311d0da
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
## [Unreleased] - ReleaseDate
### Added

- Added `epoll_pwait` wrapper
(#[1488](https://github.com/nix-rust/nix/pull/1488))
- Added `TimeSpec::from_duration` and `TimeSpec::from_timespec`
(#[1465](https://github.com/nix-rust/nix/pull/1465))
- Added `IPV6_V6ONLY` sockopt.
Expand Down
11 changes: 11 additions & 0 deletions src/sys/epoll.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::{Error, Result};
use crate::errno::Errno;
use crate::sys::signal::SigSet;
use libc::{self, c_int};
use std::os::unix::io::RawFd;
use std::ptr;
Expand Down Expand Up @@ -107,3 +108,13 @@ pub fn epoll_wait(epfd: RawFd, events: &mut [EpollEvent], timeout_ms: isize) ->

Errno::result(res).map(|r| r as usize)
}

#[cfg(not(target_os = "android"))]
#[inline]
pub fn epoll_pwait(epfd: RawFd, events: &mut [EpollEvent], timeout_ms: isize, sigmask: SigSet) -> Result<usize> {
let res = unsafe {
libc::epoll_pwait(epfd, events.as_mut_ptr() as *mut libc::epoll_event, events.len() as c_int, timeout_ms as c_int, sigmask.as_ref())
};

Errno::result(res).map(|r| r as usize)
}

0 comments on commit 311d0da

Please sign in to comment.