mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 11:17:44 +00:00
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.
This commit is contained in:
parent
aae26a3a1e
commit
618aebdd8a
9 changed files with 596 additions and 23 deletions
|
@ -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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue