We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2bb718c commit be77188Copy full SHA for be77188
src/poll.rs
@@ -1,3 +1,6 @@
1
+use std;
2
+use std::time::Duration;
3
+
4
use libc;
5
use {Errno, Result};
6
@@ -47,3 +50,19 @@ pub fn poll(fds: &mut [PollFd], timeout: libc::c_int) -> Result<libc::c_int> {
47
50
48
51
Errno::result(res)
49
52
}
53
54
+pub fn ppoll(fds: &mut [PollFd], timeout: Duration) -> Result<libc::c_int> {
55
56
+ let timeout = libc::timespec {
57
+ tv_sec: timeout.as_secs() as libc::time_t,
58
+ tv_nsec: timeout.subsec_nanos() as libc::c_long,
59
+ };
60
61
+ let res = unsafe {
62
+ libc::ppoll(fds.as_mut_ptr() as *mut libc::pollfd,
63
+ fds.len() as libc::nfds_t,
64
+ &timeout as *const libc::timespec,
65
+ std::ptr::null())
66
67
+ Errno::result(res)
68
+}
0 commit comments