Changeset 506 for trunk/kernel/syscalls/sys_thread_create.c
- Timestamp:
- Aug 25, 2018, 6:29:34 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/sys_thread_create.c
r457 r506 39 39 #include <rpc.h> 40 40 41 #include <syscalls.h> 41 42 42 43 /////////////////////////////////////////////////// 43 int sys_thread_create ( pthread_t * trdid_ptr, 44 pthread_attr_t * user_attr, 45 void * start_func, 46 void * start_arg ) 44 int sys_thread_create( 45 struct thread_s * new_thread, 46 const struct pthread_attr_s * user_attr, 47 const void * start_func, 48 const void * start_args ) 47 49 { 48 50 pthread_attr_t kern_attr; // copy of pthread attributes in kernel space … … 72 74 73 75 // check trdid buffer in user space 74 error = vmm_get_vseg( process , (intptr_t) trdid_ptr, &vseg );76 error = vmm_get_vseg( process , (intptr_t)new_thread , &vseg ); 75 77 76 78 if ( error ) … … 79 81 #if DEBUG_SYSCALLS_ERROR 80 82 printk("\n[ERROR] in %s : trdid buffer unmapped %x / thread %x / process %x\n", 81 __FUNCTION__ , (intptr_t) trdid_ptr, parent->trdid, process->pid );83 __FUNCTION__ , (intptr_t)new_thread, parent->trdid, process->pid ); 82 84 vmm_display( process , false ); 83 85 #endif … … 121 123 } 122 124 123 // check start_arg buffer in user space124 if( start_arg != NULL )125 { 126 error = vmm_get_vseg( process , (intptr_t)start_arg , &vseg );125 // check start_args buffer in user space 126 if( start_args != NULL ) 127 { 128 error = vmm_get_vseg( process , (intptr_t)start_args , &vseg ); 127 129 128 130 if( error ) … … 130 132 131 133 #if DEBUG_SYSCALLS_ERROR 132 printk("\n[ERROR] in %s : start_arg buffer unmapped %x / thread %x / process %x\n",133 __FUNCTION__ , (intptr_t)start_arg , parent->trdid , process->pid );134 printk("\n[ERROR] in %s : start_args buffer unmapped %x / thread %x / process %x\n", 135 __FUNCTION__ , (intptr_t)start_args , parent->trdid , process->pid ); 134 136 vmm_display( process , false ); 135 137 #endif … … 176 178 error = thread_user_create( process->pid, 177 179 start_func, 178 start_arg ,180 start_args, 179 181 &kern_attr, 180 182 &child_ptr ); … … 187 189 process->pid, 188 190 start_func, 189 start_arg ,191 start_args, 190 192 &kern_attr, 191 193 &child_xp, … … 209 211 // returns trdid to user space 210 212 trdid = hal_remote_lw( XPTR( target_cxy , &child_ptr->trdid ) ); 211 hal_copy_to_uspace( trdid_ptr, &trdid , sizeof(pthread_t) );213 hal_copy_to_uspace( new_thread , &trdid , sizeof(pthread_t) ); 212 214 213 215 // activate new thread
Note: See TracChangeset
for help on using the changeset viewer.