[libc-commits] [PATCH] D134919: [libc] add syscall function
Siva Chandra via Phabricator via libc-commits
libc-commits at lists.llvm.org
Fri Sep 30 14:11:01 PDT 2022
sivachandra accepted this revision.
sivachandra added inline comments.
================
Comment at: libc/include/llvm-libc-macros/linux/unistd-macros.h:22
+// ignored.
+#define syscall(...) __llvm_libc_syscall(__VA_ARGS__, 1, 2, 3, 4, 5, 6)
+
----------------
sivachandra wrote:
> For better type checking, we should do something like this:
>
> ```
> #define __syscall_helper(sysno, arg1, arg2, arg3, arg4, arg5, arg6, ...) \
> __llvm_libc_syscall((long)(sysno), (long)(arg1), (long)(arg2), (long)(arg3), \
> (long)(arg4), (long)(arg5), (long)(arg6))
> #define syscall(...) __syscall_helper(__VA_ARGS__, 1, 2, 3, 4, 5, 6, 7)
> ```
If you don't add a 7th argument below on line 25, will the macro on line 22 work when invoked like this: `syscall(SYS_getpid)`?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134919/new/
https://reviews.llvm.org/D134919
More information about the libc-commits
mailing list