Changes in kernel/generic/src/proc/task.c [577f042a:1e9f8ab] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/task.c
r577f042a r1e9f8ab 342 342 sysarg_t sys_task_set_name(const char *uspace_name, size_t name_len) 343 343 { 344 int rc; 344 345 char namebuf[TASK_NAME_BUFLEN]; 345 346 346 347 /* Cap length of name and copy it from userspace. */ 348 347 349 if (name_len > TASK_NAME_BUFLEN - 1) 348 350 name_len = TASK_NAME_BUFLEN - 1; 349 351 350 intrc = copy_from_uspace(namebuf, uspace_name, name_len);352 rc = copy_from_uspace(namebuf, uspace_name, name_len); 351 353 if (rc != 0) 352 354 return (sysarg_t) rc; 353 355 354 356 namebuf[name_len] = '\0'; 355 356 /*357 * As the task name is referenced also from the358 * threads, lock the threads' lock for the course359 * of the update.360 */361 362 irq_spinlock_lock(&tasks_lock, true);363 irq_spinlock_lock(&TASK->lock, false);364 irq_spinlock_lock(&threads_lock, false);365 366 /* Set task name */367 357 str_cpy(TASK->name, TASK_NAME_BUFLEN, namebuf); 368 369 irq_spinlock_unlock(&threads_lock, false);370 irq_spinlock_unlock(&TASK->lock, false);371 irq_spinlock_unlock(&tasks_lock, true);372 358 373 359 return EOK; … … 463 449 static void task_kill_internal(task_t *task) 464 450 { 451 link_t *cur; 452 453 /* 454 * Interrupt all threads. 455 */ 465 456 irq_spinlock_lock(&task->lock, false); 466 irq_spinlock_lock(&threads_lock, false);467 468 /*469 * Interrupt all threads.470 */471 472 link_t *cur;473 457 for (cur = task->th_head.next; cur != &task->th_head; cur = cur->next) { 474 458 thread_t *thread = list_get_instance(cur, thread_t, th_link); … … 487 471 } 488 472 489 irq_spinlock_unlock(&threads_lock, false);490 473 irq_spinlock_unlock(&task->lock, false); 491 474 }
Note:
See TracChangeset
for help on using the changeset viewer.