prctl.cpp 510 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <errno.h>
  7. #include <stdarg.h>
  8. #include <stdio.h>
  9. #include <sys/prctl.h>
  10. #include <syscall.h>
  11. extern "C" {
  12. int prctl(int option, ...)
  13. {
  14. va_list args;
  15. va_start(args, option);
  16. uintptr_t arg1 = va_arg(args, uintptr_t);
  17. uintptr_t arg2 = va_arg(args, uintptr_t);
  18. va_end(args);
  19. int rc = syscall(SC_prctl, option, arg1, arg2);
  20. __RETURN_WITH_ERRNO(rc, rc, -1);
  21. }
  22. }