
These syscalls are not necessary on their own, and they give the false impression that a caller could set or get the thread name of any process in the system, which is not true. Therefore, move the functionality of these syscalls to be options in the prctl syscall, which makes it abundantly clear that these operations could only occur from a running thread in a process that sees other threads in that process only.
29 lines
562 B
C++
29 lines
562 B
C++
/*
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <errno.h>
|
|
#include <stdarg.h>
|
|
#include <stdio.h>
|
|
#include <sys/prctl.h>
|
|
#include <syscall.h>
|
|
|
|
extern "C" {
|
|
|
|
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);
|
|
uintptr_t arg3 = va_arg(args, uintptr_t);
|
|
|
|
va_end(args);
|
|
|
|
int rc = syscall(SC_prctl, option, arg1, arg2, arg3);
|
|
__RETURN_WITH_ERRNO(rc, rc, -1);
|
|
}
|
|
}
|