Changeset 577f042a in mainline for kernel/generic/src/proc/task.c
- Timestamp:
- 2011-01-27T17:57:29Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5378f99
- Parents:
- 875c629
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/task.c
r875c629 r577f042a 342 342 sysarg_t sys_task_set_name(const char *uspace_name, size_t name_len) 343 343 { 344 int rc;345 344 char namebuf[TASK_NAME_BUFLEN]; 346 345 347 346 /* Cap length of name and copy it from userspace. */ 348 349 347 if (name_len > TASK_NAME_BUFLEN - 1) 350 348 name_len = TASK_NAME_BUFLEN - 1; 351 349 352 rc = copy_from_uspace(namebuf, uspace_name, name_len);350 int rc = copy_from_uspace(namebuf, uspace_name, name_len); 353 351 if (rc != 0) 354 352 return (sysarg_t) rc; 355 353 356 354 namebuf[name_len] = '\0'; 355 356 /* 357 * As the task name is referenced also from the 358 * threads, lock the threads' lock for the course 359 * 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 */ 357 367 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); 358 372 359 373 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.