`kevent(kqueue, changelist, eventlist, timeout)`—Wait for events on a `kqueue`. This is a wrapper around [`kevent_timespec`] which takes a `Duration` instead of a `Timespec` for the timemout value. `Timespec` has a signed `i64` seconds field; if converting `Duration` to `Timespec` overflows, `None` is passed as the timeout instead, such such a large timeout would be effectively infinite in practi
(
kqueue: Fd,
changelist: &[Event],
eventlist: Buf,
timeout: Option<Duration>,
)
| 446 | /// The file descriptors referred to by the `Event` structs must be valid for |
| 447 | /// the lifetime of the `kqueue` file descriptor. |
| 448 | pub unsafe fn kevent<Fd: AsFd, Buf: Buffer<Event>>( |
| 449 | kqueue: Fd, |
| 450 | changelist: &[Event], |
| 451 | eventlist: Buf, |
| 452 | timeout: Option<Duration>, |
| 453 | ) -> io::Result<Buf::Output> { |
| 454 | let timeout = match timeout { |
| 455 | Some(timeout) => match timeout.as_secs().try_into() { |
| 456 | Ok(tv_sec) => Some(Timespec { |
| 457 | tv_sec, |
| 458 | tv_nsec: timeout.subsec_nanos() as _, |
| 459 | }), |
| 460 | Err(_) => None, |
| 461 | }, |
| 462 | None => None, |
| 463 | }; |
| 464 | |
| 465 | kevent_timespec(kqueue, changelist, eventlist, timeout.as_ref()) |
| 466 | } |
no test coverage detected