[libc-commits] [PATCH] D157792: [libc] Fix compilation on 32-bit systems

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Aug 15 13:57:39 PDT 2023


sivachandra added inline comments.


================
Comment at: libc/src/unistd/linux/lseek.cpp:28
+#ifdef SYS_llseek
+#define SYS__llseek SYS_llseek
+#endif
----------------
At this point, the best would probably be:

```
#ifdef SYS_llseek
constexpr long LLSEEK_SYSCALL_NO = SYS_llseek;
#elif defined(SYS__llseek)
constexpr long LSEEK_SYSCALL_NO = SYS__llseek;
#else
#error ...
#endif
int ret = __llvm_libc::syscall_impl<int>(LLSEEK_SYSCALL_NO, fd, offset >> 32,
                                         offset, &result, whence);
```


================
Comment at: libc/src/unistd/linux/lseek.cpp:30
+#endif
   int ret = __llvm_libc::syscall_impl<int>(SYS__llseek, fd, offset >> 32,
                                            offset, &result, whence);
----------------
May be you should keep the cast to `uint64_t` here because `off_t` is a signed type?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157792/new/

https://reviews.llvm.org/D157792



More information about the libc-commits mailing list