Kernel/LibC: Add basic support for pthread_{create,exit}

This commit is contained in:
2025-04-01 23:08:27 +03:00
parent 788f5429e1
commit c1618e2b5d
9 changed files with 178 additions and 10 deletions

View File

@@ -182,6 +182,9 @@ namespace Kernel
BAN::ErrorOr<long> sys_sigpending(sigset_t* set);
BAN::ErrorOr<long> sys_sigprocmask(int how, const sigset_t* set, sigset_t* oset);
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_tcgetpgrp(int fd);
BAN::ErrorOr<long> sys_tcsetpgrp(int fd, pid_t pgid);
@@ -290,6 +293,13 @@ namespace Kernel
BAN::Vector<Thread*> m_threads;
struct pthread_info_t
{
Thread* thread;
void* value;
};
BAN::Vector<pthread_info_t> m_exited_pthreads;
uint64_t m_alarm_interval_ns { 0 };
uint64_t m_alarm_wake_time_ns { 0 };

View File

@@ -38,6 +38,8 @@ namespace Kernel
static BAN::ErrorOr<Thread*> create_userspace(Process*, PageTable&);
~Thread();
BAN::ErrorOr<Thread*> pthread_create(entry_t, void*);
BAN::ErrorOr<Thread*> clone(Process*, uintptr_t sp, uintptr_t ip);
void setup_exec();
void setup_process_cleanup();