Rev 4343 | Rev 4345 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4343 | Rev 4344 | ||
---|---|---|---|
Line 247... | Line 247... | ||
247 | */ |
247 | */ |
248 | return (unative_t) copy_to_uspace(uspace_task_id, &TASK->taskid, |
248 | return (unative_t) copy_to_uspace(uspace_task_id, &TASK->taskid, |
249 | sizeof(TASK->taskid)); |
249 | sizeof(TASK->taskid)); |
250 | } |
250 | } |
251 | 251 | ||
- | 252 | /** Syscall for setting the task name. |
|
- | 253 | * |
|
- | 254 | * The name simplifies identifying the task in the task list. |
|
- | 255 | * |
|
- | 256 | * @param name The new name for the task. (typically the same |
|
- | 257 | * as the command used to execute it). |
|
- | 258 | * |
|
- | 259 | * @return 0 on success or an error code from @ref errno.h. |
|
- | 260 | */ |
|
- | 261 | unative_t sys_task_set_name(const char *uspace_name, size_t name_len) |
|
- | 262 | { |
|
- | 263 | int rc; |
|
- | 264 | char namebuf[TASK_NAME_BUFLEN]; |
|
- | 265 | ||
- | 266 | /* Cap length of name and copy it from userspace. */ |
|
- | 267 | ||
- | 268 | if (name_len > TASK_NAME_BUFLEN - 1) |
|
- | 269 | name_len = TASK_NAME_BUFLEN - 1; |
|
- | 270 | ||
- | 271 | rc = copy_from_uspace(namebuf, uspace_name, name_len); |
|
- | 272 | if (rc != 0) |
|
- | 273 | return (unative_t) rc; |
|
- | 274 | ||
- | 275 | namebuf[name_len] = '\0'; |
|
- | 276 | strcpy(TASK->name, namebuf); |
|
- | 277 | ||
- | 278 | return EOK; |
|
- | 279 | } |
|
- | 280 | ||
252 | /** Find task structure corresponding to task ID. |
281 | /** Find task structure corresponding to task ID. |
253 | * |
282 | * |
254 | * The tasks_lock must be already held by the caller of this function and |
283 | * The tasks_lock must be already held by the caller of this function and |
255 | * interrupts must be disabled. |
284 | * interrupts must be disabled. |
256 | * |
285 | * |
Line 365... | Line 394... | ||
365 | uint64_t cycles; |
394 | uint64_t cycles; |
366 | char suffix; |
395 | char suffix; |
367 | order(task_get_accounting(t), &cycles, &suffix); |
396 | order(task_get_accounting(t), &cycles, &suffix); |
368 | 397 | ||
369 | #ifdef __32_BITS__ |
398 | #ifdef __32_BITS__ |
370 | printf("%-6" PRIu64 " %-10s %-3" PRIu32 " %10p %10p %9" PRIu64 |
399 | printf("%-6" PRIu64 " %-12s %-3" PRIu32 " %10p %10p %9" PRIu64 |
371 | "%c %7ld %6ld", t->taskid, t->name, t->context, t, t->as, cycles, |
400 | "%c %7ld %6ld", t->taskid, t->name, t->context, t, t->as, cycles, |
372 | suffix, atomic_get(&t->refcount), atomic_get(&t->active_calls)); |
401 | suffix, atomic_get(&t->refcount), atomic_get(&t->active_calls)); |
373 | #endif |
402 | #endif |
374 | 403 | ||
375 | #ifdef __64_BITS__ |
404 | #ifdef __64_BITS__ |
376 | printf("%-6" PRIu64 " %-10s %-3" PRIu32 " %18p %18p %9" PRIu64 |
405 | printf("%-6" PRIu64 " %-12s %-3" PRIu32 " %18p %18p %9" PRIu64 |
377 | "%c %7ld %6ld", t->taskid, t->name, t->context, t, t->as, cycles, |
406 | "%c %7ld %6ld", t->taskid, t->name, t->context, t, t->as, cycles, |
378 | suffix, atomic_get(&t->refcount), atomic_get(&t->active_calls)); |
407 | suffix, atomic_get(&t->refcount), atomic_get(&t->active_calls)); |
379 | #endif |
408 | #endif |
380 | 409 | ||
381 | for (j = 0; j < IPC_MAX_PHONES; j++) { |
410 | for (j = 0; j < IPC_MAX_PHONES; j++) { |
Line 396... | Line 425... | ||
396 | /* Messing with task structures, avoid deadlock */ |
425 | /* Messing with task structures, avoid deadlock */ |
397 | ipl = interrupts_disable(); |
426 | ipl = interrupts_disable(); |
398 | spinlock_lock(&tasks_lock); |
427 | spinlock_lock(&tasks_lock); |
399 | 428 | ||
400 | #ifdef __32_BITS__ |
429 | #ifdef __32_BITS__ |
401 | printf("taskid name ctx address as " |
430 | printf("taskid name ctx address as " |
402 | "cycles threads calls callee\n"); |
431 | "cycles threads calls callee\n"); |
403 | printf("------ ---------- --- ---------- ---------- " |
432 | printf("------ ------------ --- ---------- ---------- " |
404 | "---------- ------- ------ ------>\n"); |
433 | "---------- ------- ------ ------>\n"); |
405 | #endif |
434 | #endif |
406 | 435 | ||
407 | #ifdef __64_BITS__ |
436 | #ifdef __64_BITS__ |
408 | printf("taskid name ctx address as " |
437 | printf("taskid name ctx address as " |
409 | "cycles threads calls callee\n"); |
438 | "cycles threads calls callee\n"); |
410 | printf("------ ---------- --- ------------------ ------------------ " |
439 | printf("------ ------------ --- ------------------ ------------------ " |
411 | "---------- ------- ------ ------>\n"); |
440 | "---------- ------- ------ ------>\n"); |
412 | #endif |
441 | #endif |
413 | 442 | ||
414 | avltree_walk(&tasks_tree, task_print_walker, NULL); |
443 | avltree_walk(&tasks_tree, task_print_walker, NULL); |
415 | 444 |