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

Function pwrite

src/backend/linux_raw/io/syscalls.rs:168–221  ·  view source on GitHub ↗
(fd: BorrowedFd<'_>, buf: &[u8], pos: u64)

Source from the content-addressed store, hash-verified

166
167#[inline]
168pub(crate) fn pwrite(fd: BorrowedFd<'_>, buf: &[u8], pos: u64) -> io::Result<usize> {
169 let (buf_addr, buf_len) = slice(buf);
170
171 // <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/kernel/sys32.c?h=v6.13#n76>
172 #[cfg(all(
173 target_pointer_width = "32",
174 any(
175 target_arch = "arm",
176 target_arch = "mips",
177 target_arch = "mips32r6",
178 target_arch = "powerpc"
179 ),
180 ))]
181 unsafe {
182 ret_usize(syscall_readonly!(
183 __NR_pwrite64,
184 fd,
185 buf_addr,
186 buf_len,
187 zero(),
188 hi(pos),
189 lo(pos)
190 ))
191 }
192 #[cfg(all(
193 target_pointer_width = "32",
194 not(any(
195 target_arch = "arm",
196 target_arch = "mips",
197 target_arch = "mips32r6",
198 target_arch = "powerpc"
199 )),
200 ))]
201 unsafe {
202 ret_usize(syscall_readonly!(
203 __NR_pwrite64,
204 fd,
205 buf_addr,
206 buf_len,
207 hi(pos),
208 lo(pos)
209 ))
210 }
211 #[cfg(target_pointer_width = "64")]
212 unsafe {
213 ret_usize(syscall_readonly!(
214 __NR_pwrite64,
215 fd,
216 buf_addr,
217 buf_len,
218 loff_t_from_u64(pos)
219 ))
220 }
221}
222
223#[inline]
224pub(crate) fn writev(fd: BorrowedFd<'_>, bufs: &[IoSlice<'_>]) -> io::Result<usize> {

Callers

nothing calls this directly

Calls 2

sliceFunction · 0.85
ret_usizeFunction · 0.50

Tested by

no test coverage detected