18 #ifndef _COBALT_POSIX_THREAD_H 19 #define _COBALT_POSIX_THREAD_H 22 #include <linux/types.h> 23 #include <linux/time.h> 24 #include <linux/signal.h> 25 #include <cobalt/kernel/thread.h> 26 #include <cobalt/uapi/thread.h> 27 #include <cobalt/uapi/sched.h> 29 #include <xenomai/posix/syscall.h> 30 #include <xenomai/posix/extension.h> 32 #define PTHREAD_PROCESS_PRIVATE 0 33 #define PTHREAD_PROCESS_SHARED 1 35 #define PTHREAD_CREATE_JOINABLE 0 36 #define PTHREAD_CREATE_DETACHED 1 38 #define PTHREAD_INHERIT_SCHED 0 39 #define PTHREAD_EXPLICIT_SCHED 1 41 #define PTHREAD_MUTEX_NORMAL 0 42 #define PTHREAD_MUTEX_RECURSIVE 1 43 #define PTHREAD_MUTEX_ERRORCHECK 2 44 #define PTHREAD_MUTEX_DEFAULT 0 47 struct cobalt_threadstat;
55 struct _pthread_fastlock {
61 struct _pthread_fastlock __c_lock;
63 char __padding[48 -
sizeof (
struct _pthread_fastlock)
64 - sizeof (long) - sizeof (long long)];
79 struct _pthread_fastlock __m_lock;
82 struct cobalt_local_hkey {
89 struct cobalt_thread {
91 struct xnthread threadbase;
92 struct cobalt_extref extref;
93 struct cobalt_process *process;
94 struct list_head next;
98 struct list_head sigqueues[_NSIG];
99 struct xnsynch sigwait;
100 struct list_head signext;
103 struct xnsynch monitor_synch;
104 struct list_head monitor_link;
106 struct cobalt_local_hkey hkey;
109 struct cobalt_sigwait_context {
110 struct xnthread_wait_context wc;
115 static inline struct cobalt_thread *cobalt_current_thread(
void)
118 return curr ? container_of(curr,
struct cobalt_thread, threadbase) : NULL;
121 int __cobalt_thread_create(
unsigned long pth,
int policy,
122 struct sched_param_ex __user *u_param,
123 int xid, __u32 __user *u_winoff);
125 int __cobalt_thread_setschedparam_ex(
struct cobalt_thread *thread,
int policy,
126 const struct sched_param_ex *param_ex);
128 int cobalt_thread_setschedparam_ex(
unsigned long pth,
130 const struct sched_param_ex *param_ex,
131 __u32 __user *u_winoff,
132 int __user *u_promoted);
134 int cobalt_thread_getschedparam_ex(
unsigned long pth,
136 struct sched_param_ex *param_ex);
138 int __cobalt_thread_getschedparam_ex(
struct cobalt_thread *thread,
140 struct sched_param_ex *param_ex);
142 int cobalt_thread_setschedprio(
unsigned long pth,
144 __u32 __user *u_winoff,
145 int __user *u_promoted);
147 struct cobalt_thread *cobalt_thread_find(pid_t pid);
149 struct cobalt_thread *cobalt_thread_find_local(pid_t pid);
151 struct cobalt_thread *cobalt_thread_lookup(
unsigned long pth);
153 COBALT_SYSCALL_DECL(thread_create,
154 (
unsigned long pth,
int policy,
155 struct sched_param_ex __user *u_param,
156 int xid, __u32 __user *u_winoff));
158 struct cobalt_thread *
159 cobalt_thread_shadow(
struct cobalt_local_hkey *lhkey,
160 __u32 __user *u_winoff);
162 COBALT_SYSCALL_DECL(thread_setmode,
163 (
int clrmask,
int setmask,
int __user *u_mode_r));
165 COBALT_SYSCALL_DECL(thread_setname,
166 (
unsigned long pth,
const char __user *u_name));
168 COBALT_SYSCALL_DECL(thread_kill, (
unsigned long pth,
int sig));
170 COBALT_SYSCALL_DECL(thread_join, (
unsigned long pth));
172 COBALT_SYSCALL_DECL(thread_getpid, (
unsigned long pth));
174 COBALT_SYSCALL_DECL(thread_getstat,
175 (pid_t pid,
struct cobalt_threadstat __user *u_stat));
177 COBALT_SYSCALL_DECL(thread_setschedparam_ex,
180 const struct sched_param_ex __user *u_param,
181 __u32 __user *u_winoff,
182 int __user *u_promoted));
184 COBALT_SYSCALL_DECL(thread_getschedparam_ex,
186 int __user *u_policy,
187 struct sched_param_ex __user *u_param));
189 COBALT_SYSCALL_DECL(thread_setschedprio,
192 __u32 __user *u_winoff,
193 int __user *u_promoted));
195 void cobalt_thread_map(
struct xnthread *curr);
197 struct xnthread_personality *cobalt_thread_exit(
struct xnthread *curr);
199 struct xnthread_personality *cobalt_thread_finalize(
struct xnthread *zombie);
201 #ifdef CONFIG_XENO_OPT_COBALT_EXTENSION 203 int cobalt_thread_extend(
struct cobalt_extension *ext,
206 void cobalt_thread_restrict(
void);
209 int cobalt_thread_extended_p(
const struct cobalt_thread *thread,
210 const struct cobalt_extension *ext)
212 return thread->extref.extension == ext;
218 int cobalt_thread_extended_p(
const struct cobalt_thread *thread,
219 const struct cobalt_extension *ext)
226 extern xnticks_t cobalt_time_slice;
static struct xnthread * xnthread_current(void)
Retrieve the current Cobalt core TCB.
Definition: thread.h:374