(
fd: Fd,
mut buf: Buf,
offset: u64,
)
| 95 | #[cfg(not(windows))] |
| 96 | #[inline] |
| 97 | pub fn pread<Fd: AsFd, Buf: Buffer<u8>>( |
| 98 | fd: Fd, |
| 99 | mut buf: Buf, |
| 100 | offset: u64, |
| 101 | ) -> io::Result<Buf::Output> { |
| 102 | // SAFETY: `pread` behaves. |
| 103 | let len = unsafe { backend::io::syscalls::pread(fd.as_fd(), buf.parts_mut(), offset)? }; |
| 104 | // SAFETY: `pread` behaves. |
| 105 | unsafe { Ok(buf.assume_init(len)) } |
| 106 | } |
| 107 | |
| 108 | /// `pwrite(fd, bufs)`—Writes to a file at a given position. |
| 109 | /// |