diff options
| author | Thomas Weißschuh <linux@weissschuh.net> | 2025-08-21 17:40:36 +0200 |
|---|---|---|
| committer | Thomas Weißschuh <linux@weissschuh.net> | 2025-09-01 20:47:54 +0200 |
| commit | f11e156e0f1a582744fc04b614599fc8bcfc1da6 (patch) | |
| tree | 86c43db3cf74cc46ba5017d258f597afd6875775 /tools/include | |
| parent | fbd47de75502c63933016912325582309d72cd03 (diff) | |
| download | linux-next-f11e156e0f1a582744fc04b614599fc8bcfc1da6.tar.gz linux-next-f11e156e0f1a582744fc04b614599fc8bcfc1da6.zip | |
tools/nolibc: fold llseek fallback into lseek()
Align the implementation of the fallback handling inside sys_lseek()
with the rest of nolibc.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250821-nolibc-enosys-v1-5-4b63f2caaa89@weissschuh.net
Diffstat (limited to 'tools/include')
| -rw-r--r-- | tools/include/nolibc/sys.h | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index 34f20182792a..c5564f57deec 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -594,41 +594,27 @@ off_t sys_lseek(int fd, off_t offset, int whence) #if defined(__NR_lseek) return my_syscall3(__NR_lseek, fd, offset, whence); #else - return __nolibc_enosys(__func__, fd, offset, whence); -#endif -} + __kernel_loff_t loff = 0; + off_t result; + int ret; -static __attribute__((unused)) -int sys_llseek(int fd, unsigned long offset_high, unsigned long offset_low, - __kernel_loff_t *result, int whence) -{ -#if defined(__NR_llseek) - return my_syscall5(__NR_llseek, fd, offset_high, offset_low, result, whence); -#else - return __nolibc_enosys(__func__, fd, offset_high, offset_low, result, whence); + /* Only exists on 32bit where nolibc off_t is also 32bit */ + ret = my_syscall5(__NR_llseek, fd, 0, offset, &loff, whence); + if (ret < 0) + result = ret; + else if (loff != (off_t)loff) + result = -EOVERFLOW; + else + result = loff; + + return result; #endif } static __attribute__((unused)) off_t lseek(int fd, off_t offset, int whence) { - __kernel_loff_t loff = 0; - off_t result; - int ret; - - result = sys_lseek(fd, offset, whence); - if (result == -ENOSYS) { - /* Only exists on 32bit where nolibc off_t is also 32bit */ - ret = sys_llseek(fd, 0, offset, &loff, whence); - if (ret < 0) - result = ret; - else if (loff != (off_t)loff) - result = -EOVERFLOW; - else - result = loff; - } - - return __sysret(result); + return __sysret(sys_lseek(fd, offset, whence)); } |
