[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240929-nolibc-csky-v1-2-bb28031a73b0@weissschuh.net>
Date: Sun, 29 Sep 2024 23:47:37 +0200
From: Thomas Weißschuh <linux@...ssschuh.net>
To: Guo Ren <guoren@...nel.org>, Willy Tarreau <w@....eu>,
Shuah Khan <shuah@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-csky@...r.kernel.org,
linux-kselftest@...r.kernel.org,
Thomas Weißschuh <linux@...ssschuh.net>
Subject: [PATCH 2/5] tools/nolibc: provide a fallback for lseek through
llseek
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@...ssschuh.net>
---
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
Powered by blists - more mailing lists