(
port: Fd,
mut events: Buf,
min_events: u32,
timeout: Option<&Timespec>,
)
| 155 | /// [illumos]: https://illumos.org/man/3C/port_getn |
| 156 | #[doc(alias = "port_getn")] |
| 157 | pub fn getn<Fd: AsFd, Buf: Buffer<Event>>( |
| 158 | port: Fd, |
| 159 | mut events: Buf, |
| 160 | min_events: u32, |
| 161 | timeout: Option<&Timespec>, |
| 162 | ) -> io::Result<Buf::Output> { |
| 163 | // SAFETY: `port_getn` behaves. |
| 164 | let nevents = |
| 165 | unsafe { syscalls::port_getn(port.as_fd(), events.parts_mut(), min_events, timeout)? }; |
| 166 | // SAFETY: `port_getn` behaves. |
| 167 | unsafe { Ok(events.assume_init(nevents)) } |
| 168 | } |
| 169 | |
| 170 | /// `port_getn(port, NULL, 0, NULL)`—Queries the number of events |
| 171 | /// available from a port. |
no test coverage detected