Changeset 201abde in mainline for kernel/generic/src/proc/thread.c
- Timestamp:
- 2007-04-07T20:06:52Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7e58979
- Parents:
- 6adbe3c2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/thread.c
r6adbe3c2 r201abde 95 95 96 96 SPINLOCK_INITIALIZE(tidlock); 97 uint32_t last_tid = 0;97 thread_id_t last_tid = 0; 98 98 99 99 static slab_cache_t *thread_slab; … … 581 581 order(t->cycles, &cycles, &suffix); 582 582 583 printf("%-6 zd%-10s %#10zx %-8s %#10zx %-3ld %#10zx "583 printf("%-6llu %-10s %#10zx %-8s %#10zx %-3ld %#10zx " 584 584 "%#10zx %9llu%c ", t->tid, t->name, t, 585 585 thread_states[t->state], t->task, t->task->context, … … 637 637 * 638 638 */ 639 unative_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name )639 unative_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name, thread_id_t *uspace_thread_id) 640 640 { 641 641 thread_t *t; 642 642 char namebuf[THREAD_NAME_BUFLEN]; 643 643 uspace_arg_t *kernel_uarg; 644 uint32_t tid;645 644 int rc; 646 645 … … 659 658 false); 660 659 if (t) { 661 tid = t->tid;662 660 thread_ready(t); 663 return (unative_t) tid; 664 } else { 661 if (uspace_thread_id != NULL) 662 return (unative_t) copy_to_uspace(uspace_thread_id, &t->tid, 663 sizeof(t->tid)); 664 else 665 return 0; 666 } else 665 667 free(kernel_uarg); 666 }667 668 668 669 return (unative_t) ENOMEM; … … 681 682 /** Syscall for getting TID. 682 683 * 683 * @return Thread ID. 684 */ 685 unative_t sys_thread_get_id(void) 684 * @param uspace_thread_id Userspace address of 8-byte buffer where to store 685 * current thread ID. 686 * 687 * @return 0 on success or an error code from @ref errno.h. 688 */ 689 unative_t sys_thread_get_id(thread_id_t *uspace_thread_id) 686 690 { 687 691 /* … … 689 693 * remains constant for the lifespan of the thread. 690 694 */ 691 return THREAD->tid; 695 return (unative_t) copy_to_uspace(uspace_thread_id, &THREAD->tid, 696 sizeof(THREAD->tid)); 692 697 } 693 698
Note:
See TracChangeset
for help on using the changeset viewer.