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 DECLARE_BITMAP(timers_map, CONFIG_XENO_OPT_NRTIMERS);
55 struct cobalt_timer *timers[CONFIG_XENO_OPT_NRTIMERS];
56 void *priv[NR_PERSONALITIES];
60 struct cobalt_resnode {
61 struct cobalt_resources *scope;
62 struct cobalt_process *owner;
63 struct list_head next;
67 int cobalt_register_personality(
struct xnthread_personality *personality);
69 int cobalt_unregister_personality(
int xid);
71 struct xnthread_personality *cobalt_push_personality(
int xid);
73 void cobalt_pop_personality(
struct xnthread_personality *prev);
75 int cobalt_bind_core(
int ufeatures);
77 int cobalt_bind_personality(
unsigned int magic);
79 struct cobalt_process *cobalt_search_process(
struct mm_struct *mm);
81 int cobalt_map_user(
struct xnthread *thread, __u32 __user *u_winoff);
83 void *cobalt_get_context(
int xid);
85 int cobalt_yield(xnticks_t min, xnticks_t max);
87 int cobalt_process_init(
void);
89 extern struct list_head cobalt_thread_list;
91 extern struct cobalt_resources cobalt_global_resources;
93 static inline struct cobalt_process *cobalt_current_process(
void)
95 return ipipe_current_threadinfo()->process;
98 static inline struct cobalt_process *
99 cobalt_set_process(
struct cobalt_process *process)
101 struct ipipe_threadinfo *p = ipipe_current_threadinfo();
102 struct cobalt_process *old;
105 p->process = process;
110 static inline struct cobalt_ppd *cobalt_ppd_get(
int global)
112 struct cobalt_process *process;
114 if (global || (process = cobalt_current_process()) == NULL)
115 return &cobalt_kernel_ppd;
117 return &process->sys_ppd;
120 static inline struct cobalt_resources *cobalt_current_resources(
int pshared)
122 struct cobalt_process *process;
124 if (pshared || (process = cobalt_current_process()) == NULL)
125 return &cobalt_global_resources;
127 return &process->resources;
131 void __cobalt_add_resource(
struct cobalt_resnode *node,
int pshared)
133 node->owner = cobalt_current_process();
134 node->scope = cobalt_current_resources(pshared);
137 #define cobalt_add_resource(__node, __type, __pshared) \ 139 __cobalt_add_resource(__node, __pshared); \ 140 list_add_tail(&(__node)->next, \ 141 &((__node)->scope)->__type ## q); \ 145 void cobalt_del_resource(
struct cobalt_resnode *node)
147 list_del(&node->next);
150 extern struct xnthread_personality *cobalt_personalities[];
152 extern struct xnthread_personality cobalt_personality;