18 #ifndef _COBALT_POSIX_PROCESS_H
19 #define _COBALT_POSIX_PROCESS_H
21 #include <linux/list.h>
22 #include <linux/bitmap.h>
23 #include <cobalt/kernel/ppd.h>
25 #define KEVENT_PROPAGATE 0
28 #define NR_PERSONALITIES 4
29 #if BITS_PER_LONG < NR_PERSONALITIES
30 #error "NR_PERSONALITIES overflows internal bitmap"
34 struct xnthread_personality;
37 struct cobalt_kqueues {
38 struct list_head condq;
39 struct list_head mutexq;
40 struct list_head semq;
41 struct list_head threadq;
42 struct list_head monitorq;
43 struct list_head eventq;
44 struct list_head schedq;
47 struct cobalt_process {
49 struct hlist_node hlink;
50 struct cobalt_ppd sys_ppd;
52 struct cobalt_kqueues kqueues;
54 struct list_head sigwaiters;
55 DECLARE_BITMAP(timers_map, CONFIG_XENO_OPT_NRTIMERS);
56 struct cobalt_timer *timers[CONFIG_XENO_OPT_NRTIMERS];
57 void *priv[NR_PERSONALITIES];
60 extern struct cobalt_kqueues cobalt_global_kqueues;
62 int cobalt_register_personality(
struct xnthread_personality *personality);
64 int cobalt_unregister_personality(
int xid);
66 struct xnthread_personality *cobalt_push_personality(
int xid);
68 void cobalt_pop_personality(
struct xnthread_personality *prev);
70 int cobalt_bind_core(
void);
72 int cobalt_bind_personality(
unsigned int magic);
74 struct cobalt_process *cobalt_search_process(
struct mm_struct *mm);
76 int cobalt_map_user(
struct xnthread *thread, __u32 __user *u_winoff);
78 void *cobalt_get_context(
int xid);
80 int cobalt_yield(xnticks_t min, xnticks_t max);
82 int cobalt_process_init(
void);
84 void cobalt_process_cleanup(
void);
86 static inline struct cobalt_process *cobalt_current_process(
void)
88 return ipipe_current_threadinfo()->process;
91 static inline struct cobalt_process *
92 cobalt_set_process(
struct cobalt_process *process)
94 struct ipipe_threadinfo *p = ipipe_current_threadinfo();
95 struct cobalt_process *old;
103 static inline struct cobalt_ppd *cobalt_ppd_get(
int global)
105 struct cobalt_process *process;
107 if (global || (process = cobalt_current_process()) == NULL)
108 return &__xnsys_global_ppd;
110 return &process->sys_ppd;
113 extern struct xnthread_personality *cobalt_personalities[];
115 extern struct xnthread_personality cobalt_personality;