Quellcode durchsuchen

LibC: Make prctl() a varargs function

Tim Schumacher vor 3 Jahren
Ursprung
Commit
aa7b6852ce
2 geänderte Dateien mit 10 neuen und 2 gelöschten Zeilen
  1. 9 1
      Userland/Libraries/LibC/sys/prctl.cpp
  2. 1 1
      Userland/Libraries/LibC/sys/prctl.h

+ 9 - 1
Userland/Libraries/LibC/sys/prctl.cpp

@@ -12,8 +12,16 @@
 
 extern "C" {
 
-int prctl(int option, uintptr_t arg1, uintptr_t arg2)
+int prctl(int option, ...)
 {
+    va_list args;
+    va_start(args, option);
+
+    uintptr_t arg1 = va_arg(args, uintptr_t);
+    uintptr_t arg2 = va_arg(args, uintptr_t);
+
+    va_end(args);
+
     int rc = syscall(SC_prctl, option, arg1, arg2);
     __RETURN_WITH_ERRNO(rc, rc, -1);
 }

+ 1 - 1
Userland/Libraries/LibC/sys/prctl.h

@@ -12,6 +12,6 @@
 
 __BEGIN_DECLS
 
-int prctl(int option, uintptr_t arg1, uintptr_t arg2);
+int prctl(int option, ...);
 
 __END_DECLS