50 |
|
|
51 |
struct task |
struct task |
52 |
{ |
{ |
|
/* The capability object must be the first member of this |
|
|
struct. */ |
|
|
struct hurd_cap_obj obj; |
|
|
|
|
53 |
/* This is for fast removal from the task_id_to_task hash table. */ |
/* This is for fast removal from the task_id_to_task hash table. */ |
54 |
hurd_ihash_locp_t locp; |
hurd_ihash_locp_t locp; |
55 |
|
|
76 |
for that task. The object returned is locked and has one |
for that task. The object returned is locked and has one |
77 |
reference. */ |
reference. */ |
78 |
error_t task_alloc (l4_word_t task_id, unsigned int nr_threads, |
error_t task_alloc (l4_word_t task_id, unsigned int nr_threads, |
79 |
l4_thread_id_t *threads, hurd_cap_obj_t *r_obj); |
l4_thread_id_t *threads, task_t *r_task); |
80 |
|
|
81 |
|
|
82 |
extern pthread_mutex_t task_id_to_task_lock; |
extern pthread_mutex_t task_id_to_task_lock; |
95 |
pthread_mutex_lock (&task_id_to_task_lock); |
pthread_mutex_lock (&task_id_to_task_lock); |
96 |
task = hurd_ihash_find (&task_id_to_task, task_id); |
task = hurd_ihash_find (&task_id_to_task, task_id); |
97 |
if (task) |
if (task) |
98 |
hurd_cap_obj_ref (&task->obj); |
{ |
99 |
|
hurd_cap_obj_t obj = hurd_cap_obj_from_user (task_t, task); |
100 |
|
hurd_cap_obj_ref (obj); |
101 |
|
} |
102 |
pthread_mutex_unlock (&task_id_to_task_lock); |
pthread_mutex_unlock (&task_id_to_task_lock); |
103 |
|
|
104 |
return task; |
return task; |