2020-12-25 18:27:42 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-12-25 18:27:42 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <sys/prctl.h>
|
2021-02-05 12:16:30 +01:00
|
|
|
#include <syscall.h>
|
2020-12-25 18:27:42 +01:00
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
2022-03-28 21:35:23 +02:00
|
|
|
int prctl(int option, ...)
|
2020-12-25 18:27:42 +01:00
|
|
|
{
|
2022-03-28 21:35:23 +02:00
|
|
|
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);
|
|
|
|
|
|
2020-12-25 18:27:42 +01:00
|
|
|
int rc = syscall(SC_prctl, option, arg1, arg2);
|
|
|
|
|
__RETURN_WITH_ERRNO(rc, rc, -1);
|
|
|
|
|
}
|
|
|
|
|
}
|