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

Function _seek

src/backend/linux_raw/fs/syscalls.rs:252–277  ·  view source on GitHub ↗
(fd: BorrowedFd<'_>, offset: i64, whence: c::c_uint)

Source from the content-addressed store, hash-verified

250
251#[inline]
252pub(crate) fn _seek(fd: BorrowedFd<'_>, offset: i64, whence: c::c_uint) -> io::Result<u64> {
253 #[cfg(target_pointer_width = "32")]
254 unsafe {
255 let mut result = MaybeUninit::<u64>::uninit();
256 ret(syscall!(
257 __NR__llseek,
258 fd,
259 // Don't use the hi/lo functions here because Linux's llseek
260 // takes its 64-bit argument differently from everything else.
261 pass_usize((offset >> 32) as usize),
262 pass_usize(offset as usize),
263 &mut result,
264 c_uint(whence)
265 ))?;
266 Ok(result.assume_init())
267 }
268 #[cfg(target_pointer_width = "64")]
269 unsafe {
270 ret_u64(syscall_readonly!(
271 __NR_lseek,
272 fd,
273 loff_t(offset),
274 c_uint(whence)
275 ))
276 }
277}
278
279#[inline]
280pub(crate) fn tell(fd: BorrowedFd<'_>) -> io::Result<u64> {

Callers 4

seekFunction · 0.85
tellFunction · 0.85
seekMethod · 0.85
readMethod · 0.85

Calls 3

ret_u64Function · 0.85
assume_initMethod · 0.80
retFunction · 0.50

Tested by

no test coverage detected