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_resources {
38 struct list_head condq;
39 struct list_head mutexq;
40 struct list_head semq;
41 struct list_head monitorq;
42 struct list_head eventq;
43 struct list_head schedq;
46 struct cobalt_process {
48 struct hlist_node hlink;
49 struct cobalt_ppd sys_ppd;
52 struct list_head sigwaiters;
53 struct cobalt_resources resources;
54 struct list_head thread_list;
55 DECLARE_BITMAP(timers_map, CONFIG_XENO_OPT_NRTIMERS);
56 struct cobalt_timer *timers[CONFIG_XENO_OPT_NRTIMERS];
57 void *priv[NR_PERSONALITIES];
59 unsigned int debugged_threads;
62 struct cobalt_resnode {
63 struct cobalt_resources *scope;
64 struct cobalt_process *owner;
65 struct list_head next;
69 int cobalt_register_personality(
struct xnthread_personality *personality);
71 int cobalt_unregister_personality(
int xid);
73 struct xnthread_personality *cobalt_push_personality(
int xid);
75 void cobalt_pop_personality(
struct xnthread_personality *prev);
77 int cobalt_bind_core(
int ufeatures);
79 int cobalt_bind_personality(
unsigned int magic);
81 struct cobalt_process *cobalt_search_process(
struct mm_struct *mm);
83 int cobalt_map_user(
struct xnthread *thread, __u32 __user *u_winoff);
85 void *cobalt_get_context(
int xid);
87 int cobalt_yield(xnticks_t min, xnticks_t max);
89 int cobalt_process_init(
void);
91 extern struct list_head cobalt_global_thread_list;
93 extern struct cobalt_resources cobalt_global_resources;
95 static inline struct cobalt_process *cobalt_current_process(
void)
97 return ipipe_current_threadinfo()->process;
100 static inline struct cobalt_process *
101 cobalt_set_process(
struct cobalt_process *process)
103 struct ipipe_threadinfo *p = ipipe_current_threadinfo();
104 struct cobalt_process *old;
107 p->process = process;
112 static inline struct cobalt_ppd *cobalt_ppd_get(
int global)
114 struct cobalt_process *process;
116 if (global || (process = cobalt_current_process()) == NULL)
117 return &cobalt_kernel_ppd;
119 return &process->sys_ppd;
122 static inline struct cobalt_resources *cobalt_current_resources(
int pshared)
124 struct cobalt_process *process;
126 if (pshared || (process = cobalt_current_process()) == NULL)
127 return &cobalt_global_resources;
129 return &process->resources;
133 void __cobalt_add_resource(
struct cobalt_resnode *node,
int pshared)
135 node->owner = cobalt_current_process();
136 node->scope = cobalt_current_resources(pshared);
139 #define cobalt_add_resource(__node, __type, __pshared) \ 141 __cobalt_add_resource(__node, __pshared); \ 142 list_add_tail(&(__node)->next, \ 143 &((__node)->scope)->__type ## q); \ 147 void cobalt_del_resource(
struct cobalt_resnode *node)
149 list_del(&node->next);
152 extern struct xnthread_personality *cobalt_personalities[];
154 extern struct xnthread_personality cobalt_personality;