[libc-commits] [PATCH] D74530: [libc] Add Convenience syscall Template Function

Alex Brachet via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Feb 13 11:47:12 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG2c73c2666651: [libc] Add Convenience syscall Template Function (authored by abrachet).
Herald added a project: libc-project.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74530

Files:
  libc/config/linux/x86_64/syscall.h.inc
  libc/test/config/linux/x86_64/syscall_test.cpp


Index: libc/test/config/linux/x86_64/syscall_test.cpp
===================================================================
--- libc/test/config/linux/x86_64/syscall_test.cpp
+++ libc/test/config/linux/x86_64/syscall_test.cpp
@@ -36,4 +36,9 @@
       [](long n, long a1, long a2, long a3, long a4, long a5, long a6) {
         return __llvm_libc::syscall(n, a1, a2, a3, a4, a5, a6);
       });
+
+  std::function<long(long, void *)> notLongType(
+      [](long n, void *a1) {
+        return __llvm_libc::syscall(n, a1);
+      });
 }
Index: libc/config/linux/x86_64/syscall.h.inc
===================================================================
--- libc/config/linux/x86_64/syscall.h.inc
+++ libc/config/linux/x86_64/syscall.h.inc
@@ -94,6 +94,13 @@
   return retcode;
 }
 
+template <typename... Ts>
+__attribute__((always_inline)) inline long syscall(long __number, Ts... ts) {
+  static_assert(sizeof...(Ts) <= 6, "Too many arguments for syscall");
+  return syscall(__number, (long)ts...);
+}
+
+
 #undef SYSCALL_CLOBBER_LIST
 
 } // namespace __llvm_libc


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74530.244494.patch
Type: text/x-patch
Size: 1062 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20200213/b6c1f720/attachment-0001.bin>


More information about the libc-commits mailing list