From aa7b6852ce3f7c0d31faf409f0662bef0d5dddbd Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Mon, 28 Mar 2022 21:35:23 +0200 Subject: [PATCH] LibC: Make prctl() a varargs function --- Userland/Libraries/LibC/sys/prctl.cpp | 10 +++++++++- Userland/Libraries/LibC/sys/prctl.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibC/sys/prctl.cpp b/Userland/Libraries/LibC/sys/prctl.cpp index 25d0033c7c..88d0afcd36 100644 --- a/Userland/Libraries/LibC/sys/prctl.cpp +++ b/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); } diff --git a/Userland/Libraries/LibC/sys/prctl.h b/Userland/Libraries/LibC/sys/prctl.h index 4fc573ffa7..238affad82 100644 --- a/Userland/Libraries/LibC/sys/prctl.h +++ b/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