Changes in kernel/generic/src/proc/task.c [c46bfbc:feeac0d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/task.c
rc46bfbc rfeeac0d 36 36 */ 37 37 38 #include <assert.h>39 38 #include <proc/thread.h> 40 39 #include <proc/task.h> … … 42 41 #include <mm/slab.h> 43 42 #include <atomic.h> 44 #include <synch/futex.h>45 43 #include <synch/spinlock.h> 46 44 #include <synch/waitq.h> … … 50 48 #include <adt/btree.h> 51 49 #include <adt/list.h> 52 #include <cap/cap.h>53 50 #include <ipc/ipc.h> 54 51 #include <ipc/ipcrsc.h> … … 58 55 #include <func.h> 59 56 #include <str.h> 57 #include <memstr.h> 60 58 #include <syscall/copy.h> 61 59 #include <macros.h> … … 84 82 static void task_kill_internal(task_t *); 85 83 static int tsk_constructor(void *, unsigned int); 86 static size_t tsk_destructor(void *obj);87 84 88 85 /** Initialize kernel tasks support. … … 94 91 avltree_create(&tasks_tree); 95 92 task_slab = slab_cache_create("task_t", sizeof(task_t), 0, 96 tsk_constructor, tsk_destructor, 0);93 tsk_constructor, NULL, 0); 97 94 } 98 95 … … 161 158 { 162 159 task_t *task = (task_t *) obj; 163 164 int rc = caps_task_alloc(task);165 if (rc != EOK)166 return rc;167 160 168 161 atomic_set(&task->refcount, 0); … … 170 163 171 164 irq_spinlock_initialize(&task->lock, "task_t_lock"); 165 mutex_initialize(&task->futexes_lock, MUTEX_PASSIVE); 172 166 173 167 list_initialize(&task->threads); … … 175 169 ipc_answerbox_init(&task->answerbox, task); 176 170 171 size_t i; 172 for (i = 0; i < IPC_MAX_PHONES; i++) 173 ipc_phone_init(&task->phones[i], task); 174 177 175 spinlock_initialize(&task->active_calls_lock, "active_calls_lock"); 178 176 list_initialize(&task->active_calls); 179 177 180 178 #ifdef CONFIG_UDEBUG 181 179 /* Init kbox stuff */ … … 188 186 } 189 187 190 size_t tsk_destructor(void *obj)191 {192 task_t *task = (task_t *) obj;193 194 caps_task_free(task);195 return 0;196 }197 198 188 /** Create new task with no threads. 199 189 * … … 213 203 214 204 task->container = CONTAINER; 215 task-> perms = 0;205 task->capabilities = 0; 216 206 task->ucycles = 0; 217 207 task->kcycles = 0; 218 219 caps_task_init(task);220 208 221 209 task->ipc_info.call_sent = 0; … … 240 228 241 229 if ((ipc_phone_0) && 242 (container_check(ipc_phone_0->task->container, task->container))) { 243 cap_handle_t phone_handle = phone_alloc(task); 244 kobject_t *phone_obj = kobject_get(task, phone_handle, 245 KOBJECT_TYPE_PHONE); 246 (void) ipc_phone_connect(phone_obj->phone, ipc_phone_0); 247 } 248 249 futex_task_init(task); 230 (container_check(ipc_phone_0->task->container, task->container))) 231 (void) ipc_phone_connect(&task->phones[0], ipc_phone_0); 232 233 btree_create(&task->futexes); 250 234 251 235 /* … … 288 272 * Free up dynamically allocated state. 289 273 */ 290 futex_task_deinit(task);274 btree_destroy(&task->futexes); 291 275 292 276 /* … … 436 420 task_t *task_find_by_id(task_id_t id) 437 421 { 438 assert(interrupts_disabled());439 assert(irq_spinlock_locked(&tasks_lock));422 ASSERT(interrupts_disabled()); 423 ASSERT(irq_spinlock_locked(&tasks_lock)); 440 424 441 425 avltree_node_t *node = … … 460 444 void task_get_accounting(task_t *task, uint64_t *ucycles, uint64_t *kcycles) 461 445 { 462 assert(interrupts_disabled());463 assert(irq_spinlock_locked(&task->lock));446 ASSERT(interrupts_disabled()); 447 ASSERT(irq_spinlock_locked(&task->lock)); 464 448 465 449 /* Accumulated values of task */ … … 619 603 if (*additional) 620 604 printf("%-8" PRIu64 " %9" PRIu64 "%c %9" PRIu64 "%c " 621 "%9" PRIua "\n", task->taskid, ucycles, usuffix, kcycles,605 "%9" PRIua, task->taskid, ucycles, usuffix, kcycles, 622 606 ksuffix, atomic_get(&task->refcount)); 623 607 else … … 625 609 task->taskid, task->name, task->container, task, task->as); 626 610 #endif 611 612 if (*additional) { 613 size_t i; 614 for (i = 0; i < IPC_MAX_PHONES; i++) { 615 if (task->phones[i].callee) 616 printf(" %zu:%p", i, task->phones[i].callee); 617 } 618 printf("\n"); 619 } 627 620 628 621 irq_spinlock_unlock(&task->lock, false);
Note:
See TracChangeset
for help on using the changeset viewer.