Changeset f6d2c81 in mainline
- Timestamp:
- 2007-05-30T19:50:24Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c31e536
- Parents:
- 51ec40f
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/task.c
r51ec40f rf6d2c81 108 108 t = NULL; 109 109 link_t *cur; 110 for (cur = tasks_btree.leaf_head.next; cur != &tasks_btree.leaf_head; cur = cur->next) { 111 btree_node_t *node = list_get_instance(cur, btree_node_t, leaf_link); 110 for (cur = tasks_btree.leaf_head.next; 111 cur != &tasks_btree.leaf_head; cur = cur->next) { 112 btree_node_t *node; 113 114 node = list_get_instance(cur, btree_node_t, leaf_link); 112 115 113 116 unsigned int i; … … 222 225 * @return Task of the running program or NULL on error. 223 226 */ 224 task_t * 227 task_t *task_run_program(void *program_addr, char *name) 225 228 { 226 229 as_t *as; -
kernel/generic/src/proc/thread.c
r51ec40f rf6d2c81 300 300 task_destroy(t->task); 301 301 302 /* 303 * If the thread had a userspace context, free up its kernel_uarg 304 * structure. 305 */ 306 if (t->flags & THREAD_FLAG_USPACE) { 307 ASSERT(t->thread_arg); 308 free(t->thread_arg); 309 } 310 302 311 slab_free(thread_slab, t); 303 312 } … … 313 322 * @param name Symbolic name. 314 323 * @param uncounted Thread's accounting doesn't affect accumulated task 315 * accounting.324 * accounting. 316 325 * 317 326 * @return New thread's structure on success, NULL on failure. … … 319 328 */ 320 329 thread_t *thread_create(void (* func)(void *), void *arg, task_t *task, 321 330 int flags, char *name, bool uncounted) 322 331 { 323 332 thread_t *t; … … 638 647 * 639 648 */ 640 unative_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name, thread_id_t *uspace_thread_id) 649 unative_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name, 650 thread_id_t *uspace_thread_id) 641 651 { 642 652 thread_t *t; … … 661 671 thread_ready(t); 662 672 if (uspace_thread_id != NULL) 663 return (unative_t) copy_to_uspace(uspace_thread_id, &t->tid,664 sizeof(t->tid));673 return (unative_t) copy_to_uspace(uspace_thread_id, 674 &t->tid, sizeof(t->tid)); 665 675 else 666 676 return 0; -
uspace/libc/generic/thread.c
r51ec40f rf6d2c81 78 78 * Zero out the thread local uninitialized data. 79 79 */ 80 memset(data + (&_tbss_start - &_tdata_start), 0, &_tbss_end -81 80 memset(data + (&_tbss_start - &_tdata_start), 0, 81 &_tbss_end - &_tbss_start); 82 82 83 83 return tcb; … … 129 129 * @return Zero on success or a code from @ref errno.h on failure. 130 130 */ 131 int thread_create(void (* function)(void *), void *arg, char *name, thread_id_t *tid) 131 int thread_create(void (* function)(void *), void *arg, char *name, 132 thread_id_t *tid) 132 133 { 133 134 char *stack; 134 135 uspace_arg_t *uarg; 136 int rc; 135 137 136 138 stack = (char *) malloc(getpagesize() * THREAD_INITIAL_STACK_PAGES_NO); … … 150 152 uarg->uspace_uarg = uarg; 151 153 152 return __SYSCALL3(SYS_THREAD_CREATE, (sysarg_t) uarg, (sysarg_t) name, (sysarg_t) tid); 154 rc = __SYSCALL3(SYS_THREAD_CREATE, (sysarg_t) uarg, (sysarg_t) name, 155 (sysarg_t) tid); 156 157 if (!rc) { 158 /* 159 * Failed to create a new thread. 160 * Free up the allocated structures. 161 */ 162 free(uarg); 163 free(stack); 164 } 165 166 return rc; 153 167 } 154 168
Note:
See TracChangeset
for help on using the changeset viewer.