summaryrefslogtreecommitdiff
path: root/Libraries/LibC
diff options
context:
space:
mode:
authorAndrew Kaster <andrewdkaster@gmail.com>2019-11-17 20:08:10 -0700
committerAndreas Kling <awesomekling@gmail.com>2019-11-18 09:04:32 +0100
commit618aebdd8ab55f9b63256e8195fa4e0f6fe305aa (patch)
treec076bbff894ee4f0151ae91049d62bad1e499d32 /Libraries/LibC
parentaae26a3a1ec059ca16cb7930f4f78b908ec6e8a1 (diff)
downloadserenity-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 'Libraries/LibC')
-rw-r--r--Libraries/LibC/limits.h2
-rw-r--r--Libraries/LibC/sys/types.h14
2 files changed, 15 insertions, 1 deletions
diff --git a/Libraries/LibC/limits.h b/Libraries/LibC/limits.h
index 1c5f583556..d89f7228ee 100644
--- a/Libraries/LibC/limits.h
+++ b/Libraries/LibC/limits.h
@@ -33,3 +33,5 @@
#define MB_LEN_MAX 16
#define ARG_MAX 65536
+
+#define PTHREAD_STACK_MIN 65536
diff --git a/Libraries/LibC/sys/types.h b/Libraries/LibC/sys/types.h
index cda19da382..9f7f3edab2 100644
--- a/Libraries/LibC/sys/types.h
+++ b/Libraries/LibC/sys/types.h
@@ -1,7 +1,7 @@
#pragma once
-#include <stddef.h>
#include <bits/stdint.h>
+#include <stddef.h>
#include <sys/cdefs.h>
__BEGIN_DECLS
@@ -60,4 +60,16 @@ struct utimbuf {
time_t modtime;
};
+typedef int pthread_t;
+typedef void* pthread_key_t;
+typedef void* pthread_once_t;
+typedef uint32_t pthread_mutex_t;
+typedef void* pthread_attr_t;
+typedef void* pthread_mutexattr_t;
+typedef void* pthread_cond_t;
+typedef void* pthread_rwlock_t;
+typedef void* pthread_rwlockatrr_t;
+typedef void* pthread_spinlock_t;
+typedef void* pthread_condattr_t;
+
__END_DECLS