[PATCH 2/5] tools/nolibc: provide a fallback for lseek through llseek

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Not all architectures implement the lseek syscall, for example csky for
which support will be added.
Provide a fallback implementation to the llseek syscall.

Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
---
 tools/include/nolibc/sys.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h
index 7b82bc3cf107439a3f09f98b99d4d540ffb9ba2a..b3b78343647177c9e5ecb7261997b4f5e03fb8f5 100644
--- a/tools/include/nolibc/sys.h
+++ b/tools/include/nolibc/sys.h
@@ -595,6 +595,14 @@ off_t sys_lseek(int fd, off_t offset, int whence)
 {
 #ifdef __NR_lseek
 	return my_syscall3(__NR_lseek, fd, offset, whence);
+#elif defined(__NR_llseek)
+	off_t result;
+	int ret;
+
+	ret = my_syscall5(__NR_llseek, fd,
+			  sizeof(offset) > 4 ? offset >> 32 : 0,
+			  offset, &result, whence);
+	return ret ? ret : result;
 #else
 	return __nolibc_enosys(__func__, fd, offset, whence);
 #endif

-- 
2.46.2





[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux