diff options
author | Andrew Kaster <andrewdkaster@gmail.com> | 2019-11-17 20:08:10 -0700 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-11-18 09:04:32 +0100 |
commit | 618aebdd8ab55f9b63256e8195fa4e0f6fe305aa (patch) | |
tree | c076bbff894ee4f0151ae91049d62bad1e499d32 /Kernel/Syscall.h | |
parent | aae26a3a1ec059ca16cb7930f4f78b908ec6e8a1 (diff) | |
download | serenity-618aebdd8ab55f9b63256e8195fa4e0f6fe305aa.zip |
Kernel+LibPthread: pthread_create handles pthread_attr_t
Add an initial implementation of pthread attributes for:
* detach state (joinable, detached)
* schedule params (just priority)
* guard page size (as skeleton) (requires kernel support maybe?)
* stack size and user-provided stack location (4 or 8 MB only, must be aligned)
Add some tests too, to the thread test program.
Also, LibC: Move pthread declarations to sys/types.h, where they belong.
Diffstat (limited to 'Kernel/Syscall.h')
-rw-r--r-- | Kernel/Syscall.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Kernel/Syscall.h b/Kernel/Syscall.h index 6308dcdf94..530c1c9b51 100644 --- a/Kernel/Syscall.h +++ b/Kernel/Syscall.h @@ -248,6 +248,20 @@ struct SC_setsockopt_params { socklen_t value_size; }; +struct SC_create_thread_params { + unsigned int m_detach_state = 0; // JOINABLE or DETACHED + int m_schedule_priority = 2; // ThreadPriority::Normal + // FIXME: Implment guard pages in create_thread (unreadable pages at "overflow" end of stack) + // "If an implementation rounds up the value of guardsize to a multiple of {PAGESIZE}, + // a call to pthread_attr_getguardsize() specifying attr shall store in the guardsize + // parameter the guard size specified by the previous pthread_attr_setguardsize() function call" + // ... ok, if you say so posix. Guess we get to lie to people about guard page size + unsigned int m_guard_page_size = 0; // Rounded up to PAGE_SIZE + unsigned int m_reported_guard_page_size = 0; // The lie we tell callers + unsigned int m_stack_size = 4 * MB; // Default PTHREAD_STACK_MIN + void* m_stack_location = nullptr; // nullptr means any, o.w. process virtual address +}; + void initialize(); int sync(); |