mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 08:00:20 +00:00
LibPThread: Add pthread_set/getname_np
These wrappers call the set_thread_name and get_thread_name syscalls respectively.
This commit is contained in:
parent
9058962712
commit
baf7e247e3
Notes:
sideshowbarker
2024-07-19 10:55:43 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/baf7e247e3f Pull-request: https://github.com/SerenityOS/serenity/pull/857
2 changed files with 15 additions and 2 deletions
|
@ -23,9 +23,9 @@ constexpr size_t highest_reasonable_stack_size = 8 * MB; // That's the default i
|
|||
|
||||
extern "C" {
|
||||
|
||||
static int create_thread(void* (*entry)(void*), void* argument, void* stack)
|
||||
static int create_thread(void* (*entry)(void*), void* argument, void* thread_params)
|
||||
{
|
||||
return syscall(SC_create_thread, entry, argument, stack);
|
||||
return syscall(SC_create_thread, entry, argument, thread_params);
|
||||
}
|
||||
|
||||
static void exit_thread(void* code)
|
||||
|
@ -537,4 +537,14 @@ int pthread_setspecific(pthread_key_t key, const void* value)
|
|||
t_specifics.values[key] = const_cast<void*>(value);
|
||||
return 0;
|
||||
}
|
||||
int pthread_setname_np(pthread_t thread, const char* buffer, int buffer_size)
|
||||
{
|
||||
return syscall(SC_set_thread_name, thread, buffer, buffer_size);
|
||||
}
|
||||
|
||||
int pthread_getname_np(pthread_t thread, char* buffer, int buffer_size)
|
||||
{
|
||||
return syscall(SC_get_thread_name, thread, buffer, buffer_size);
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
|
|
@ -81,4 +81,7 @@ int pthread_mutexattr_init(pthread_mutexattr_t*);
|
|||
int pthread_mutexattr_settype(pthread_mutexattr_t*, int);
|
||||
int pthread_mutexattr_destroy(pthread_mutexattr_t*);
|
||||
|
||||
int pthread_setname_np(pthread_t, const char*, int);
|
||||
int pthread_getname_np(pthread_t, char*, int);
|
||||
|
||||
__END_DECLS
|
||||
|
|
Loading…
Reference in a new issue