[libc-commits] [PATCH] D157792: [libc] Fix compilation on 32-bit systems
Phabricator via libc-commits
libc-commits at lists.llvm.org
Wed Aug 16 05:52:55 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGea70e6f9a9f0: [libc] Fix compilation on 32-bit systems (authored by Mikhail R. Gadelha <mikhail at igalia.com>).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157792/new/
https://reviews.llvm.org/D157792
Files:
libc/src/unistd/linux/lseek.cpp
Index: libc/src/unistd/linux/lseek.cpp
===================================================================
--- libc/src/unistd/linux/lseek.cpp
+++ libc/src/unistd/linux/lseek.cpp
@@ -23,14 +23,15 @@
#ifdef SYS_lseek
int ret = __llvm_libc::syscall_impl<int>(SYS_lseek, fd, offset, whence);
result = ret;
-#elif defined(SYS_llseek)
- long ret = __llvm_libc::syscall_impl(SYS_llseek, fd,
- (long)(((uint64_t)(offset)) >> 32),
- (long)offset, &result, whence);
- result = ret;
+#elif defined(SYS_llseek) || defined(SYS__llseek)
+#ifdef SYS_llseek
+ constexpr long LLSEEK_SYSCALL_NO = SYS_llseek;
#elif defined(SYS__llseek)
- int ret = __llvm_libc::syscall_impl<int>(SYS__llseek, fd, offset >> 32,
- offset, &result, whence);
+ constexpr long LLSEEK_SYSCALL_NO = SYS__llseek;
+#endif
+ uint64_t offset_64 = static_cast<uint64_t>(offset);
+ int ret = __llvm_libc::syscall_impl<int>(
+ LLSEEK_SYSCALL_NO, fd, offset_64 >> 32, offset_64, &result, whence);
#else
#error "lseek, llseek and _llseek syscalls not available."
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157792.550712.patch
Type: text/x-patch
Size: 1161 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230816/b1894501/attachment.bin>
More information about the libc-commits
mailing list