[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 Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux