MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / pwritev2

Function pwritev2

src/backend/libc/io/syscalls.rs:174–191  ·  view source on GitHub ↗
(
    fd: BorrowedFd<'_>,
    bufs: &[IoSlice<'_>],
    offset: u64,
    flags: ReadWriteFlags,
)

Source from the content-addressed store, hash-verified

172
173#[cfg(all(linux_kernel, not(target_os = "android")))]
174pub(crate) fn pwritev2(
175 fd: BorrowedFd<'_>,
176 bufs: &[IoSlice<'_>],
177 offset: u64,
178 flags: ReadWriteFlags,
179) -> io::Result<usize> {
180 // Silently cast; we'll get `EINVAL` if the value is negative.
181 let offset = offset as i64;
182 unsafe {
183 ret_usize(c::pwritev2(
184 borrowed_fd(fd),
185 bufs.as_ptr().cast::<c::iovec>(),
186 min(bufs.len(), MAX_IOV) as c::c_int,
187 offset,
188 bitflags_bits!(flags),
189 ))
190 }
191}
192
193// These functions are derived from Rust's library/std/src/sys/unix/fd.rs at
194// revision 326ef470a8b379a180d6dc4bbef08990698a737a.

Callers 1

pwritev64v2Function · 0.50

Calls 4

borrowed_fdFunction · 0.85
ret_usizeFunction · 0.50
as_ptrMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected