Changeset 201abde in mainline
- 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
- Files:
-
- 32 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/include/types.h
r6adbe3c2 r201abde 63 63 64 64 typedef uint8_t bool; 65 typedef uint64_t thread_id_t; 65 66 typedef uint64_t task_id_t; 66 67 typedef uint32_t context_id_t; -
kernel/arch/arm32/include/types.h
r6adbe3c2 r201abde 63 63 64 64 typedef uint8_t bool; 65 typedef uint64_t thread_id_t; 65 66 typedef uint64_t task_id_t; 66 67 typedef uint32_t context_id_t; -
kernel/arch/ia32/include/types.h
r6adbe3c2 r201abde 63 63 64 64 typedef uint8_t bool; 65 typedef uint64_t thread_id_t; 65 66 typedef uint64_t task_id_t; 66 67 typedef uint32_t context_id_t; -
kernel/arch/ia32xen/include/types.h
r6adbe3c2 r201abde 63 63 64 64 typedef uint8_t bool; 65 typedef uint64_t thread_id_t; 65 66 typedef uint64_t task_id_t; 66 67 typedef uint32_t context_id_t; -
kernel/arch/ia64/include/types.h
r6adbe3c2 r201abde 71 71 72 72 typedef uint8_t bool; 73 typedef uint64_t thread_id_t; 73 74 typedef uint64_t task_id_t; 74 75 typedef uint32_t context_id_t; -
kernel/arch/mips32/include/types.h
r6adbe3c2 r201abde 63 63 64 64 typedef uint8_t bool; 65 typedef uint64_t thread_id_t; 65 66 typedef uint64_t task_id_t; 66 67 typedef uint32_t context_id_t; -
kernel/arch/ppc32/include/types.h
r6adbe3c2 r201abde 63 63 64 64 typedef uint8_t bool; 65 typedef uint64_t thread_id_t; 65 66 typedef uint64_t task_id_t; 66 67 typedef uint32_t context_id_t; -
kernel/arch/ppc64/include/types.h
r6adbe3c2 r201abde 63 63 64 64 typedef uint8_t bool; 65 typedef uint64_t thread_id_t; 65 66 typedef uint64_t task_id_t; 66 67 typedef uint32_t context_id_t; -
kernel/arch/sparc64/include/types.h
r6adbe3c2 r201abde 63 63 64 64 typedef uint8_t bool; 65 typedef uint64_t thread_id_t; 65 66 typedef uint64_t task_id_t; 66 67 typedef uint32_t context_id_t; -
kernel/generic/include/interrupt.h
r6adbe3c2 r201abde 49 49 { \ 50 50 if (istate_from_uspace(istate)) { \ 51 klog_printf("Task %ll dkilled due to an exception at %p.", TASK->taskid, istate_get_pc(istate)); \51 klog_printf("Task %llu killed due to an exception at %p.", TASK->taskid, istate_get_pc(istate)); \ 52 52 klog_printf(" " cmd, ##__VA_ARGS__); \ 53 53 task_kill(TASK->taskid); \ -
kernel/generic/include/proc/task.h
r6adbe3c2 r201abde 91 91 * certain extent. 92 92 */ 93 atomic_t active_calls; 93 atomic_t active_calls; 94 94 95 95 /** Architecture specific task data. */ 96 task_arch_t arch; 96 task_arch_t arch; 97 97 98 98 /** -
kernel/generic/include/proc/thread.h
r6adbe3c2 r201abde 194 194 int priority; 195 195 /** Thread ID. */ 196 uint32_t tid;196 thread_id_t tid; 197 197 198 198 /** Architecture-specific data. */ … … 249 249 250 250 /* Thread syscall prototypes. */ 251 unative_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name);252 unative_t sys_thread_exit(int uspace_status);253 unative_t sys_thread_get_id(void);251 extern unative_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name, thread_id_t *uspace_thread_id); 252 extern unative_t sys_thread_exit(int uspace_status); 253 extern unative_t sys_thread_get_id(thread_id_t *uspace_thread_id); 254 254 255 255 #endif -
kernel/generic/src/adt/btree.c
r6adbe3c2 r201abde 971 971 printf("("); 972 972 for (i = 0; i < node->keys; i++) { 973 printf("%ll d%s", node->key[i], i < node->keys - 1 ? "," : "");973 printf("%llu%s", node->key[i], i < node->keys - 1 ? "," : ""); 974 974 if (node->depth && node->subtree[i]) { 975 975 list_append(&node->subtree[i]->bfs_link, &head); … … 993 993 printf("("); 994 994 for (i = 0; i < node->keys; i++) 995 printf("%ll d%s", node->key[i], i < node->keys - 1 ? "," : "");995 printf("%llu%s", node->key[i], i < node->keys - 1 ? "," : ""); 996 996 printf(")"); 997 997 } -
kernel/generic/src/console/cmd.c
r6adbe3c2 r201abde 714 714 int cmd_set4(cmd_arg_t *argv) 715 715 { 716 uint32_t *addr 716 uint32_t *addr; 717 717 uint32_t arg1 = argv[1].intval; 718 718 bool pointer = false; -
kernel/generic/src/ipc/ipc.c
r6adbe3c2 r201abde 503 503 for (tmp=task->answerbox.calls.next; tmp != &task->answerbox.calls;tmp = tmp->next) { 504 504 call = list_get_instance(tmp, call_t, link); 505 printf("Callid: %p Srctask:%ll dM:%d A1:%d A2:%d A3:%d Flags:%x\n",call,505 printf("Callid: %p Srctask:%llu M:%d A1:%d A2:%d A3:%d Flags:%x\n",call, 506 506 call->sender->taskid, IPC_GET_METHOD(call->data), IPC_GET_ARG1(call->data), 507 507 IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data), call->flags); … … 513 513 tmp = tmp->next) { 514 514 call = list_get_instance(tmp, call_t, link); 515 printf("Callid: %p Srctask:%ll dM:%d A1:%d A2:%d A3:%d Flags:%x\n",call,515 printf("Callid: %p Srctask:%llu M:%d A1:%d A2:%d A3:%d Flags:%x\n",call, 516 516 call->sender->taskid, IPC_GET_METHOD(call->data), IPC_GET_ARG1(call->data), 517 517 IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data), call->flags); -
kernel/generic/src/proc/scheduler.c
r6adbe3c2 r201abde 451 451 * Entering state is unexpected. 452 452 */ 453 panic("tid% d: unexpected state %s\n", THREAD->tid,453 panic("tid%llu: unexpected state %s\n", THREAD->tid, 454 454 thread_states[THREAD->state]); 455 455 break; … … 504 504 505 505 #ifdef SCHEDULER_VERBOSE 506 printf("cpu%d: tid % d (priority=%d, ticks=%lld, nrdy=%ld)\n",506 printf("cpu%d: tid %llu (priority=%d, ticks=%llu, nrdy=%ld)\n", 507 507 CPU->id, THREAD->tid, THREAD->priority, THREAD->ticks, 508 508 atomic_get(&CPU->nrdy)); … … 640 640 spinlock_lock(&t->lock); 641 641 #ifdef KCPULB_VERBOSE 642 printf("kcpulb%d: TID % d-> cpu%d, nrdy=%ld, "642 printf("kcpulb%d: TID %llu -> cpu%d, nrdy=%ld, " 643 643 "avg=%nd\n", CPU->id, t->tid, CPU->id, 644 644 atomic_get(&CPU->nrdy), … … 723 723 cur = cur->next) { 724 724 t = list_get_instance(cur, thread_t, rq_link); 725 printf("% d(%s) ", t->tid,725 printf("%llu(%s) ", t->tid, 726 726 thread_states[t->state]); 727 727 } -
kernel/generic/src/proc/task.c
r6adbe3c2 r201abde 400 400 order(task_get_accounting(t), &cycles, &suffix); 401 401 402 printf("%-6ll d%-10s %-3ld %#10zx %#10zx %9llu%c %7zd "402 printf("%-6llu %-10s %-3ld %#10zx %#10zx %9llu%c %7zd " 403 403 "%6zd", t->taskid, t->name, t->context, t, t->as, 404 404 cycles, suffix, t->refcount, … … 487 487 ipc_cleanup(); 488 488 futex_cleanup(); 489 klog_printf("Cleanup of task %ll dcompleted.", TASK->taskid);489 klog_printf("Cleanup of task %llu completed.", TASK->taskid); 490 490 } 491 491 -
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 -
kernel/generic/src/syscall/syscall.c
r6adbe3c2 r201abde 101 101 rc = syscall_table[id](a1, a2, a3, a4); 102 102 else { 103 klog_printf("TASK %ll d: Unknown syscall id %d",TASK->taskid,id);103 klog_printf("TASK %llu: Unknown syscall id %d",TASK->taskid,id); 104 104 task_kill(TASK->taskid); 105 105 thread_exit(); -
kernel/test/fpu/fpu1.c
r6adbe3c2 r201abde 127 127 if ((int) (100000000 * e) != E_10e8) { 128 128 if (!sh_quiet) 129 printf("tid% d: e*10e8=%zd should be %zd\n", THREAD->tid, (unative_t) (100000000 * e), (unative_t) E_10e8);129 printf("tid%llu: e*10e8=%zd should be %zd\n", THREAD->tid, (unative_t) (100000000 * e), (unative_t) E_10e8); 130 130 atomic_inc(&threads_fault); 131 131 break; … … 162 162 if ((int) (1000000 * pi) != PI_10e8) { 163 163 if (!sh_quiet) 164 printf("tid% d: pi*10e8=%zd should be %zd\n", THREAD->tid, (unative_t) (1000000 * pi), (unative_t) (PI_10e8 / 100));164 printf("tid%llu: pi*10e8=%zd should be %zd\n", THREAD->tid, (unative_t) (1000000 * pi), (unative_t) (PI_10e8 / 100)); 165 165 atomic_inc(&threads_fault); 166 166 break; … … 169 169 if ((int) (100000000 * pi) != PI_10e8) { 170 170 if (!sh_quiet) 171 printf("tid% d: pi*10e8=%zd should be %zd\n", THREAD->tid, (unative_t) (100000000 * pi), (unative_t) PI_10e8);171 printf("tid%llu: pi*10e8=%zd should be %zd\n", THREAD->tid, (unative_t) (100000000 * pi), (unative_t) PI_10e8); 172 172 atomic_inc(&threads_fault); 173 173 break; -
kernel/test/fpu/mips2.c
r6adbe3c2 r201abde 73 73 if (arg != after_arg) { 74 74 if (!sh_quiet) 75 printf("General reg tid% d: arg(%d) != %d\n", THREAD->tid, arg, after_arg);75 printf("General reg tid%llu: arg(%d) != %d\n", THREAD->tid, arg, after_arg); 76 76 atomic_inc(&threads_fault); 77 77 break; … … 105 105 if (arg != after_arg) { 106 106 if (!sh_quiet) 107 printf("General reg tid% d: arg(%d) != %d\n", THREAD->tid, arg, after_arg);107 printf("General reg tid%llu: arg(%d) != %d\n", THREAD->tid, arg, after_arg); 108 108 atomic_inc(&threads_fault); 109 109 break; -
kernel/test/fpu/sse1.c
r6adbe3c2 r201abde 73 73 if (arg != after_arg) { 74 74 if (!sh_quiet) 75 printf("tid% d: arg(%d) != %d\n", THREAD->tid, arg, after_arg);75 printf("tid%llu: arg(%d) != %d\n", THREAD->tid, arg, after_arg); 76 76 atomic_inc(&threads_fault); 77 77 break; … … 105 105 if (arg != after_arg) { 106 106 if (!sh_quiet) 107 printf("tid% d: arg(%d) != %d\n", THREAD->tid, arg, after_arg);107 printf("tid%llu: arg(%d) != %d\n", THREAD->tid, arg, after_arg); 108 108 atomic_inc(&threads_fault); 109 109 break; -
kernel/test/mm/falloc2.c
r6adbe3c2 r201abde 59 59 if (frames == NULL) { 60 60 if (!sh_quiet) 61 printf("Thread #% d(cpu%d): Unable to allocate frames\n", THREAD->tid, CPU->id);61 printf("Thread #%llu (cpu%d): Unable to allocate frames\n", THREAD->tid, CPU->id); 62 62 atomic_inc(&thread_fail); 63 63 atomic_dec(&thread_count); … … 70 70 for (order = 0; order <= MAX_ORDER; order++) { 71 71 if (!sh_quiet) 72 printf("Thread #% d(cpu%d): Allocating %d frames blocks ... \n", THREAD->tid, CPU->id, 1 << order);72 printf("Thread #%llu (cpu%d): Allocating %d frames blocks ... \n", THREAD->tid, CPU->id, 1 << order); 73 73 74 74 allocated = 0; … … 83 83 84 84 if (!sh_quiet) 85 printf("Thread #% d(cpu%d): %d blocks allocated.\n", THREAD->tid, CPU->id, allocated);85 printf("Thread #%llu (cpu%d): %d blocks allocated.\n", THREAD->tid, CPU->id, allocated); 86 86 87 87 if (!sh_quiet) 88 printf("Thread #% d(cpu%d): Deallocating ... \n", THREAD->tid, CPU->id);88 printf("Thread #%llu (cpu%d): Deallocating ... \n", THREAD->tid, CPU->id); 89 89 90 90 for (i = 0; i < allocated; i++) { … … 92 92 if (((uint8_t *) frames[i])[k] != val) { 93 93 if (!sh_quiet) 94 printf("Thread #% d(cpu%d): Unexpected data (%d) in block %p offset %#zx\n", THREAD->tid, CPU->id, ((char *) frames[i])[k], frames[i], k);94 printf("Thread #%llu (cpu%d): Unexpected data (%d) in block %p offset %#zx\n", THREAD->tid, CPU->id, ((char *) frames[i])[k], frames[i], k); 95 95 atomic_inc(&thread_fail); 96 96 goto cleanup; … … 101 101 102 102 if (!sh_quiet) 103 printf("Thread #% d(cpu%d): Finished run.\n", THREAD->tid, CPU->id);103 printf("Thread #%llu (cpu%d): Finished run.\n", THREAD->tid, CPU->id); 104 104 } 105 105 } … … 109 109 110 110 if (!sh_quiet) 111 printf("Thread #% d(cpu%d): Exiting\n", THREAD->tid, CPU->id);111 printf("Thread #%llu (cpu%d): Exiting\n", THREAD->tid, CPU->id); 112 112 atomic_dec(&thread_count); 113 113 } -
kernel/test/mm/slab1.c
r6adbe3c2 r201abde 138 138 139 139 if (!sh_quiet) 140 printf("Starting thread #% d...\n", THREAD->tid);140 printf("Starting thread #%llu...\n", THREAD->tid); 141 141 142 142 for (j = 0; j < 10; j++) { … … 152 152 153 153 if (!sh_quiet) 154 printf("Thread #% dfinished\n", THREAD->tid);154 printf("Thread #%llu finished\n", THREAD->tid); 155 155 156 156 semaphore_up(&thr_sem); -
kernel/test/mm/slab2.c
r6adbe3c2 r201abde 151 151 152 152 if (!sh_quiet) 153 printf("Starting thread #% d...\n",THREAD->tid);153 printf("Starting thread #%llu...\n",THREAD->tid); 154 154 155 155 /* Alloc all */ 156 156 if (!sh_quiet) 157 printf("Thread #% dallocating...\n", THREAD->tid);157 printf("Thread #%llu allocating...\n", THREAD->tid); 158 158 159 159 while (1) { … … 167 167 168 168 if (!sh_quiet) 169 printf("Thread #% dreleasing...\n", THREAD->tid);169 printf("Thread #%llu releasing...\n", THREAD->tid); 170 170 171 171 while (data) { … … 177 177 178 178 if (!sh_quiet) 179 printf("Thread #% dallocating...\n", THREAD->tid);179 printf("Thread #%llu allocating...\n", THREAD->tid); 180 180 181 181 while (1) { … … 189 189 190 190 if (!sh_quiet) 191 printf("Thread #% dreleasing...\n", THREAD->tid);191 printf("Thread #%llu releasing...\n", THREAD->tid); 192 192 193 193 while (data) { … … 199 199 200 200 if (!sh_quiet) 201 printf("Thread #% dfinished\n", THREAD->tid);201 printf("Thread #%llu finished\n", THREAD->tid); 202 202 203 203 slab_print_list(); -
kernel/test/synch/rwlock3.c
r6adbe3c2 r201abde 46 46 47 47 if (!sh_quiet) 48 printf("cpu%d, tid % d: trying to lock rwlock for reading....\n", CPU->id, THREAD->tid);48 printf("cpu%d, tid %llu: trying to lock rwlock for reading....\n", CPU->id, THREAD->tid); 49 49 50 50 rwlock_read_lock(&rwlock); … … 52 52 53 53 if (!sh_quiet) { 54 printf("cpu%d, tid % d: success\n", CPU->id, THREAD->tid);55 printf("cpu%d, tid % d: trying to lock rwlock for writing....\n", CPU->id, THREAD->tid);54 printf("cpu%d, tid %llu: success\n", CPU->id, THREAD->tid); 55 printf("cpu%d, tid %llu: trying to lock rwlock for writing....\n", CPU->id, THREAD->tid); 56 56 } 57 57 … … 60 60 61 61 if (!sh_quiet) 62 printf("cpu%d, tid % d: success\n", CPU->id, THREAD->tid);62 printf("cpu%d, tid %llu: success\n", CPU->id, THREAD->tid); 63 63 64 64 atomic_dec(&thread_count); -
kernel/test/synch/rwlock4.c
r6adbe3c2 r201abde 75 75 76 76 if (!sh_quiet) 77 printf("cpu%d, tid % dw+ (%d)\n", CPU->id, THREAD->tid, to);77 printf("cpu%d, tid %llu w+ (%d)\n", CPU->id, THREAD->tid, to); 78 78 79 79 rc = rwlock_write_lock_timeout(&rwlock, to); 80 80 if (SYNCH_FAILED(rc)) { 81 81 if (!sh_quiet) 82 printf("cpu%d, tid % dw!\n", CPU->id, THREAD->tid);82 printf("cpu%d, tid %llu w!\n", CPU->id, THREAD->tid); 83 83 atomic_dec(&thread_count); 84 84 return; … … 86 86 87 87 if (!sh_quiet) 88 printf("cpu%d, tid % dw=\n", CPU->id, THREAD->tid);88 printf("cpu%d, tid %llu w=\n", CPU->id, THREAD->tid); 89 89 90 90 if (rwlock.readers_in) { … … 107 107 108 108 if (!sh_quiet) 109 printf("cpu%d, tid % dw-\n", CPU->id, THREAD->tid);109 printf("cpu%d, tid %llu w-\n", CPU->id, THREAD->tid); 110 110 atomic_dec(&thread_count); 111 111 } … … 120 120 121 121 if (!sh_quiet) 122 printf("cpu%d, tid % dr+ (%d)\n", CPU->id, THREAD->tid, to);122 printf("cpu%d, tid %llu r+ (%d)\n", CPU->id, THREAD->tid, to); 123 123 124 124 rc = rwlock_read_lock_timeout(&rwlock, to); 125 125 if (SYNCH_FAILED(rc)) { 126 126 if (!sh_quiet) 127 printf("cpu%d, tid % dr!\n", CPU->id, THREAD->tid);127 printf("cpu%d, tid %llu r!\n", CPU->id, THREAD->tid); 128 128 atomic_dec(&thread_count); 129 129 return; … … 131 131 132 132 if (!sh_quiet) 133 printf("cpu%d, tid % dr=\n", CPU->id, THREAD->tid);133 printf("cpu%d, tid %llu r=\n", CPU->id, THREAD->tid); 134 134 135 135 thread_usleep(30000); … … 137 137 138 138 if (!sh_quiet) 139 printf("cpu%d, tid % dr-\n", CPU->id, THREAD->tid);139 printf("cpu%d, tid %llu r-\n", CPU->id, THREAD->tid); 140 140 atomic_dec(&thread_count); 141 141 } -
kernel/test/synch/semaphore2.c
r6adbe3c2 r201abde 68 68 69 69 to = random(20000); 70 printf("cpu%d, tid % ddown+ (%d)\n", CPU->id, THREAD->tid, to);70 printf("cpu%d, tid %llu down+ (%d)\n", CPU->id, THREAD->tid, to); 71 71 rc = semaphore_down_timeout(&sem, to); 72 72 if (SYNCH_FAILED(rc)) { 73 printf("cpu%d, tid % ddown!\n", CPU->id, THREAD->tid);73 printf("cpu%d, tid %llu down!\n", CPU->id, THREAD->tid); 74 74 return; 75 75 } 76 76 77 printf("cpu%d, tid % ddown=\n", CPU->id, THREAD->tid);77 printf("cpu%d, tid %llu down=\n", CPU->id, THREAD->tid); 78 78 thread_usleep(random(30000)); 79 79 80 80 semaphore_up(&sem); 81 printf("cpu%d, tid % dup\n", CPU->id, THREAD->tid);81 printf("cpu%d, tid %llu up\n", CPU->id, THREAD->tid); 82 82 } 83 83 -
kernel/test/thread/thread1.c
r6adbe3c2 r201abde 49 49 while (atomic_get(&finish)) { 50 50 if (!sh_quiet) 51 printf("% d ", (int) (THREAD->tid));51 printf("%llu ", THREAD->tid); 52 52 thread_usleep(100000); 53 53 } -
uspace/libc/generic/thread.c
r6adbe3c2 r201abde 125 125 * @param arg Argument to be passed to thread. 126 126 * @param name Symbolic name of the thread. 127 * 128 * @return TID of the new thread on success or -1 on failure. 129 */ 130 int thread_create(void (* function)(void *), void *arg, char *name) 127 * @param tid Thread ID of the newly created thread. 128 * 129 * @return Zero on success or a code from @ref errno.h on failure. 130 */ 131 int thread_create(void (* function)(void *), void *arg, char *name, thread_id_t *tid) 131 132 { 132 133 char *stack; … … 149 150 uarg->uspace_uarg = uarg; 150 151 151 return __SYSCALL 2(SYS_THREAD_CREATE, (sysarg_t) uarg, (sysarg_t) name);152 return __SYSCALL3(SYS_THREAD_CREATE, (sysarg_t) uarg, (sysarg_t) name, (sysarg_t) tid); 152 153 } 153 154 … … 167 168 * @param thread TID. 168 169 */ 169 void thread_detach( int thread)170 void thread_detach(thread_id_t thread) 170 171 { 171 172 } … … 179 180 * @return Thread exit status. 180 181 */ 181 int thread_join( int thread)182 int thread_join(thread_id_t thread) 182 183 { 183 184 } … … 187 188 * @return Current thread ID. 188 189 */ 189 int thread_get_id(void) 190 { 191 return __SYSCALL0(SYS_THREAD_GET_ID); 190 thread_id_t thread_get_id(void) 191 { 192 thread_id_t thread_id; 193 194 (void) __SYSCALL1(SYS_THREAD_GET_ID, (sysarg_t) &thread_id); 195 196 return thread_id; 192 197 } 193 198 -
uspace/libc/include/thread.h
r6adbe3c2 r201abde 40 40 #include <types.h> 41 41 42 typedef uint64_t thread_id_t; 43 42 44 extern void __thread_entry(void); 43 45 extern void __thread_main(uspace_arg_t *uarg); 44 46 45 extern int thread_create(void (* function)(void * arg), void *arg, char *name);47 extern int thread_create(void (* function)(void *), void *arg, char *name, thread_id_t *tid); 46 48 extern void thread_exit(int status); 47 extern void thread_detach( int thread);48 extern int thread_join( int thread);49 extern int thread_get_id(void);49 extern void thread_detach(thread_id_t thread); 50 extern int thread_join(thread_id_t thread); 51 extern thread_id_t thread_get_id(void); 50 52 extern tcb_t * __make_tls(void); 51 53 extern tcb_t * __alloc_tls(void **data, size_t size); -
uspace/tester/thread/thread1.c
r6adbe3c2 r201abde 46 46 while (atomic_get(&finish)) { 47 47 if (!sh_quiet) 48 printf("% d", thread_get_id());48 printf("%llu ", thread_get_id()); 49 49 usleep(100000); 50 50 } … … 61 61 62 62 for (i = 0; i < THREADS; i++) { 63 int t; 64 if ((t = thread_create(threadtest, NULL, "threadtest")) < 0) { 63 if (thread_create(threadtest, NULL, "threadtest", NULL) < 0) { 65 64 if (!quiet) 66 65 printf("Could not create thread %d\n", i);
Note:
See TracChangeset
for help on using the changeset viewer.