mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:04:59 +00:00
Kernel+Userland: Remove the {get,set}_thread_name syscalls
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.
This commit is contained in:
parent
1458849850
commit
1c0aa51684
14 changed files with 54 additions and 63 deletions
|
@ -22,6 +22,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <syscall.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
@ -547,13 +548,13 @@ int pthread_setname_np(pthread_t thread, char const* name)
|
|||
{
|
||||
if (!name)
|
||||
return EFAULT;
|
||||
int rc = syscall(SC_set_thread_name, thread, name, strlen(name));
|
||||
int rc = prctl(PR_SET_THREAD_NAME, thread, name, strlen(name));
|
||||
__RETURN_PTHREAD_ERROR(rc);
|
||||
}
|
||||
|
||||
int pthread_getname_np(pthread_t thread, char* buffer, size_t buffer_size)
|
||||
{
|
||||
int rc = syscall(SC_get_thread_name, thread, buffer, buffer_size);
|
||||
int rc = prctl(PR_GET_THREAD_NAME, thread, buffer, buffer_size);
|
||||
__RETURN_PTHREAD_ERROR(rc);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue