1 /*
2  * llseek/lseek64 syscall for uClibc
3  *
4  * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
5  *
6  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
7  */
8 
9 #include <_lfs_64.h>
10 #include <sys/syscall.h>
11 #include <bits/wordsize.h>
12 
13 /* Newer kernel ports have llseek() instead of _llseek() */
14 #if !defined __NR__llseek && defined __NR_llseek
15 # define __NR__llseek __NR_llseek
16 #endif
17 
18 #if defined __NR__llseek && __WORDSIZE == 32
19 # include <unistd.h>
20 # include <endian.h>
21 # include <cancel.h>
__NC(lseek64)22 off64_t __NC(lseek64)(int fd, off64_t offset, int whence)
23 {
24 	off64_t result;
25 	/* do we not need to handle the offset with __LONG_LONG_PAIR depending on endianness? */
26 	return (off64_t)INLINE_SYSCALL(_llseek, 5, fd, (off_t) OFF64_HI(offset),
27 				       (off_t) OFF64_LO(offset), &result, whence) ?: result;
28 }
29 CANCELLABLE_SYSCALL(off64_t, lseek64, (int fd, off64_t offset, int whence), (fd, offset, whence))
30 lt_libc_hidden(lseek64)
31 #endif
32