Kernel/LibC: Implement pthread_self
This commit is contained in:
parent
691c9fe8e0
commit
5549696c3a
|
@ -184,6 +184,7 @@ namespace Kernel
|
|||
|
||||
BAN::ErrorOr<long> sys_pthread_create(const pthread_attr_t* __restrict attr, void (*entry)(void*), void* arg);
|
||||
BAN::ErrorOr<long> sys_pthread_exit(void* value);
|
||||
BAN::ErrorOr<long> sys_pthread_self();
|
||||
|
||||
BAN::ErrorOr<long> sys_tcgetpgrp(int fd);
|
||||
BAN::ErrorOr<long> sys_tcsetpgrp(int fd, pid_t pgid);
|
||||
|
|
|
@ -2121,6 +2121,11 @@ namespace Kernel
|
|||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
BAN::ErrorOr<long> Process::sys_pthread_self()
|
||||
{
|
||||
return Thread::current().tid();
|
||||
}
|
||||
|
||||
BAN::ErrorOr<long> Process::sys_tcgetpgrp(int fd)
|
||||
{
|
||||
LockGuard _(m_process_lock);
|
||||
|
|
|
@ -92,6 +92,7 @@ __BEGIN_DECLS
|
|||
O(SYS_HARDLINKAT, hardlinkat) \
|
||||
O(SYS_PTHREAD_CREATE, pthread_create) \
|
||||
O(SYS_PTHREAD_EXIT, pthread_exit) \
|
||||
O(SYS_PTHREAD_SELF, pthread_self) \
|
||||
|
||||
enum Syscall
|
||||
{
|
||||
|
|
|
@ -47,3 +47,8 @@ void pthread_exit(void* value_ptr)
|
|||
syscall(SYS_PTHREAD_EXIT, value_ptr);
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
pthread_t pthread_self(void)
|
||||
{
|
||||
return syscall(SYS_PTHREAD_SELF);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue