- Timestamp:
- Oct 4, 2018, 11:50:21 PM (6 years ago)
- Location:
- trunk/kernel/syscalls
- Files:
-
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/shared_include/shared_pthread.h
r457 r566 26 26 27 27 /******************************************************************************************* 28 * This file defines the types and mnemonics that are shared by the kernel 29 * and by the <pthread> user level library. 30 ******************************************************************************************/ 31 32 33 /******************************************************************************************* 28 34 * These typedef define the POSIX thread related types. 29 35 ******************************************************************************************/ 30 36 37 typedef unsigned int pthread_mutex_t; 38 typedef unsigned int pthread_mutexattr_t; // TODO not implemented 39 31 40 typedef unsigned int pthread_cond_t; 32 typedef unsigned int pthread_condattr_t; 33 typedef unsigned int pthread_rwlock_t; 34 typedef unsigned int pthread_rwlock attr_t;35 typedef unsigned int pthread_ key_t;41 typedef unsigned int pthread_condattr_t; // TODO not implemented 42 43 typedef unsigned int pthread_rwlock_t; // TODO not implemented 44 typedef unsigned int pthread_rwlockattr_t; // TODO not implemented 36 45 37 46 /******************************************************************************************* … … 92 101 MUTEX_LOCK, 93 102 MUTEX_UNLOCK, 103 MUTEX_TRYLOCK, 94 104 } 95 105 mutex_operation_t; -
trunk/kernel/syscalls/shared_include/syscalls_numbers.h
r526 r566 84 84 SYS_FG = 48, 85 85 SYS_IS_FG = 49, 86 87 SYSCALLS_NR = 50, 86 88 } syscalls_t; 87 89 88 // Keep me concistant with enum above !89 #define SYSCALLS_NR (50U)90 91 90 #endif // _SYSCALLS_NUMBERS_H_ -
trunk/kernel/syscalls/sys_chdir.c
r506 r566 35 35 36 36 ///////////////////////////////// 37 int sys_chdir ( c onst char * pathname )37 int sys_chdir ( char * pathname ) 38 38 { 39 39 error_t error; … … 46 46 if( hal_strlen_from_uspace( pathname ) >= CONFIG_VFS_MAX_PATH_LENGTH ) 47 47 { 48 printk("\n[ERROR] in %s : pathname too long\n", __FUNCTION__ ); 48 49 #if DEBUG_SYSCALLS_ERROR 50 printk("\n[ERROR] in %s : pathname too long / thread %x in process %x\n", 51 __FUNCTION__, this->trdid, process->pid ); 52 #endif 49 53 this->errno = ENFILE; 50 54 return -1; … … 54 58 hal_strcpy_from_uspace( kbuf , pathname , CONFIG_VFS_MAX_PATH_LENGTH ); 55 59 60 printk("\n[ERROR] in %s : not implemented yet\n", __FUNCTION__ ); 61 return -1; 62 56 63 // get cluster and local pointer on reference process 57 xptr_t ref_xp = process->ref_xp;58 process_t * ref_ptr = (process_t *)GET_PTR( ref_xp );59 cxy_t ref_cxy = GET_CXY( ref_xp );64 // xptr_t ref_xp = process->ref_xp; 65 // process_t * ref_ptr = (process_t *)GET_PTR( ref_xp ); 66 // cxy_t ref_cxy = GET_CXY( ref_xp ); 60 67 61 68 // get extended pointer on cwd lock in reference process 62 xptr_t lock_xp = hal_remote_lwd( XPTR( ref_cxy , &ref_ptr->cwd_lock ) );69 // xptr_t lock_xp = hal_remote_l64( XPTR( ref_cxy , &ref_ptr->cwd_lock ) ); 63 70 64 71 // get cwd lock in read mode 65 remote_rwlock_rd_lock( lock_xp );72 // remote_rwlock_rd_acquire( lock_xp ); 66 73 67 // call relevant VFS function68 error = vfs_chdir( process->vfs_cwd_xp , kbuf );74 // TODO ce n'et pas au VFS de le faire [AG] 75 // error = vfs_chdir( process->vfs_cwd_xp , kbuf ); 69 76 70 77 // release cwd lock 71 remote_rwlock_rd_unlock( lock_xp );78 // remote_rwlock_rd_release( lock_xp ); 72 79 73 80 if( error ) -
trunk/kernel/syscalls/sys_chmod.c
r506 r566 32 32 #include <syscalls.h> 33 33 34 ////////////////////////////////// 35 int sys_chmod( c onst char* pathname,36 uint32_t rights)34 /////////////////////////////////// 35 int sys_chmod( char * pathname, 36 uint32_t rights __attribute__((unused)) ) 37 37 { 38 38 error_t error; … … 45 45 if( hal_strlen_from_uspace( pathname ) >= CONFIG_VFS_MAX_PATH_LENGTH ) 46 46 { 47 printk("\n[ERROR] in %s : pathname too long\n", __FUNCTION__ ); 47 48 #if DEBUG_SYSCALLS_ERROR 49 printk("\n[ERROR] in %s : pathname too long / thread %x in process %x\n", 50 __FUNCTION__, this->trdid, process->pid ); 51 #endif 48 52 this->errno = ENFILE; 49 53 return -1; … … 53 57 hal_strcpy_from_uspace( kbuf , pathname , CONFIG_VFS_MAX_PATH_LENGTH ); 54 58 59 printk("\n[ERROR] in %s : not implemented yet\n", __FUNCTION__ ); 60 return -1; 61 55 62 // get cluster and local pointer on reference process 56 xptr_t ref_xp = process->ref_xp; 57 process_t * ref_ptr = (process_t *)GET_PTR( ref_xp ); 58 cxy_t ref_cxy = GET_CXY( ref_xp ); 59 60 // get extended pointer on cwd inode 61 xptr_t cwd_xp = hal_remote_lwd( XPTR( ref_cxy , &ref_ptr->vfs_cwd_xp ) ); 62 63 // get the cwd lock in read mode from reference process 64 remote_rwlock_rd_lock( XPTR( ref_cxy , &ref_ptr->cwd_lock ) ); 63 // xptr_t ref_xp = process->ref_xp; 64 // process_t * ref_ptr = (process_t *)GET_PTR( ref_xp ); 65 // cxy_t ref_cxy = GET_CXY( ref_xp ); 65 66 66 67 // call the relevant VFS function 67 error = vfs_chmod( cwd_xp, 68 kbuf, 69 rights ); 70 71 // release the cwd lock 72 remote_rwlock_rd_unlock( XPTR( ref_cxy , &ref_ptr->cwd_lock ) ); 68 // error = vfs_chmod( cwd_xp, 69 // kbuf, 70 // rights ); 73 71 74 72 if( error ) 75 73 { 76 74 printk("\n[ERROR] in %s : cannot remove directory %s\n", 77 75 __FUNCTION__ , kbuf ); 78 76 this->errno = error; 79 77 return -1; -
trunk/kernel/syscalls/sys_condvar.c
r508 r566 32 32 #include <remote_mutex.h> 33 33 34 //////////////////////////////////////// 34 35 #if DEBUG_SYS_CONDVAR 36 ///////////////////////////////////////////////////// 37 static char * sys_convar_op_str( uint32_t operation ) 38 { 39 if ( operation == CONDVAR_INIT ) return "INIT"; 40 else if( operation == CONDVAR_WAIT ) return "WAIT"; 41 else if( operation == CONDVAR_SIGNAL ) return "SIGNAL"; 42 else if( operation == CONDVAR_BROADCAST ) return "BROADCAST"; 43 else if( operation == CONDVAR_DESTROY ) return "DESTROY"; 44 else return "undefined"; 45 } 46 #endif 47 48 ////////////////////////////////////// 35 49 int sys_condvar( void * condvar, 36 50 uint32_t operation, 37 51 void * mutex ) 38 52 { 53 vseg_t * vseg; // for condvar check 39 54 error_t error; 40 vseg_t * vseg;41 55 42 56 thread_t * this = CURRENT_THREAD; 43 57 process_t * process = this->process; 58 59 #if DEBUG_SYS_CONDVAR 60 uint64_t tm_start; 61 uint64_t tm_end; 62 tm_start = hal_get_cycles(); 63 if( DEBUG_SYS_CONDVAR < tm_start ) 64 printk("\n[DBG] %s : thread %x in process %x enter for %s / cycle %d\n", 65 __FUNCTION__, this->trdid, process->pid, sys_condvar_op_str( operation ), (uint32_t)tm_start ); 66 #endif 44 67 45 68 // check condvar in user vspace … … 191 214 } // end switch 192 215 216 hal_fence(); 217 218 #if DEBUG_SYS_CONDVAR 219 tm_start = hal_get_cycles(); 220 if( DEBUG_SYS_MUTEX < tm_start ) 221 printk("\n[DBG] %s : thread %x in process %x exit for %s / cycle %d\n", 222 __FUNCTION__, this->trdid, process->pid, sys_condvar_op_str( operation ), (uint32_t)tm_start ); 223 #endif 224 193 225 return 0; 194 226 -
trunk/kernel/syscalls/sys_exec.c
r509 r566 158 158 // the environment variables from user buffers to the exec_info_t structure, allocate 159 159 // and call the process_make_exec() function. 160 // As it must destroy all process copies, and all other tthreads in all clusters,160 // As it must destroy all process copies, and all other threads in all clusters, 161 161 // the process_make_exec() function must be executed in the owner cluster. 162 162 // 163 163 // TODO : the args & envs arguments are not supported yet : both must be NULL [AG] 164 164 ///////////////////////////////////////////////////////////////////////////////////////// 165 int sys_exec( c onst char * pathname,// .elf file pathname165 int sys_exec( char * pathname, // .elf file pathname 166 166 char ** args, // process arguments 167 167 char ** envs ) // environment variables 168 168 { 169 exec_info_t exec_info; // structure to pass to process_make_exec()169 exec_info_t exec_info; // structure to pass to process_make_exec() 170 170 error_t error; 171 171 … … 175 175 pid_t pid = process->pid; 176 176 177 #if DEBUG_SYS_EXEC 178 uint64_t tm_start = hal_get_cycles(); 179 #endif 180 177 181 assert( (CXY_FROM_PID( pid ) == local_cxy) , 178 182 "must be called in the owner cluster\n"); … … 202 206 203 207 #if DEBUG_SYS_EXEC 204 uint64_t tm_start;205 tm_start = hal_get_cycles();206 208 if( DEBUG_SYS_EXEC < tm_start ) 207 209 printk("\n[DBG] %s : thread %x in process %x enter for path <%s> / cycle = %d\n", -
trunk/kernel/syscalls/sys_exit.c
r506 r566 47 47 cxy_t parent_cxy; // parent process cluster 48 48 process_t * parent_ptr; // local pointer on parent process 49 xptr_t children_lock_xp; // extended pointer on children locki50 49 thread_t * parent_main_ptr; // local pointer on parent main thread 51 50 xptr_t parent_main_xp; // extended pointer on parent main thread … … 72 71 #if (DEBUG_SYS_EXIT & 1) 73 72 if( DEBUG_SYS_EXIT < tm_start ) 74 printk("\n[DBG] %s : thread %x in process %x get owner process %xin cluster %x\n",75 __FUNCTION__, this->trdid, process->pid, owner_ ptr, owner_cxy );73 printk("\n[DBG] %s : thread %x in process %x get owner process in cluster %x\n", 74 __FUNCTION__, this->trdid, process->pid, owner_cxy ); 76 75 #endif 77 76 78 // get local pointer on the processmain thread77 // get local pointer on the main thread 79 78 main_ptr = hal_remote_lpt( XPTR( owner_cxy , &owner_ptr->th_tbl[0] ) ); 80 79 … … 86 85 #if (DEBUG_SYS_EXIT & 1) 87 86 if( DEBUG_SYS_EXIT < tm_start ) 88 printk("\n[DBG] %s : thread %x in process %x get parent process %xin cluster %x\n",89 __FUNCTION__, this->trdid, process->pid, parent_ ptr, parent_cxy );87 printk("\n[DBG] %s : thread %x in process %x get parent process in cluster %x\n", 88 __FUNCTION__, this->trdid, process->pid, parent_cxy ); 90 89 #endif 91 92 // get extended pointer on lock protecting children list in parent process93 children_lock_xp = XPTR( parent_cxy , &parent_ptr->children_lock );94 90 95 91 // get pointers on the parent process main thread … … 118 114 #endif 119 115 120 // mark for delete th iscalling thread when it is not the main116 // mark for delete the calling thread when it is not the main 121 117 if( (owner_cxy != local_cxy) || (main_ptr != this) ) 122 118 { … … 151 147 152 148 // unblock the parent process main thread 153 remote_spinlock_lock( children_lock_xp );154 149 thread_unblock( parent_main_xp , THREAD_BLOCKED_WAIT ); 155 remote_spinlock_unlock( children_lock_xp );156 150 157 151 #if( DEBUG_SYS_EXIT & 1) 158 152 if( tm_start > DEBUG_SYS_EXIT ) 159 printk("\n[DBG] %s : thread %x in process %x unblock parent main thread in process %x\n",153 printk("\n[DBG] %s : thread %x in process %x unblocked parent main thread in process %x\n", 160 154 __FUNCTION__ , this->trdid, process->pid, 161 hal_remote_l w( XPTR( parent_cxy , &parent_ptr->pid) ) );155 hal_remote_l32( XPTR( parent_cxy , &parent_ptr->pid) ) ); 162 156 #endif 163 157 -
trunk/kernel/syscalls/sys_fg.c
r506 r566 75 75 76 76 // get extended pointer on the reference process STDIN file descriptor 77 file_xp = hal_remote_l wd( XPTR( process_cxy , &process_ptr->fd_array.array[0] ) );77 file_xp = hal_remote_l64( XPTR( process_cxy , &process_ptr->fd_array.array[0] ) ); 78 78 79 79 // get extended pointer on TXT_RX chdev … … 85 85 86 86 // set reference process owner in TXT_RX chdev 87 hal_remote_s wd( XPTR( chdev_cxy , &chdev_ptr->ext.txt.owner_xp ) , process_xp );87 hal_remote_s64( XPTR( chdev_cxy , &chdev_ptr->ext.txt.owner_xp ) , process_xp ); 88 88 89 89 // reset PROCESS_TERM_WAIT and PROCESS_TERM_STOP flags in process term_state … … 98 98 printk("\n[DBG] %s : thread %x exit / process %x get TXT_%d ownership / cycle %d\n", 99 99 __FUNCTION__ , CURRENT_THREAD , pid, 100 hal_remote_l w( XPTR( chdev_cxy , &chdev_ptr->channel ) ) , (uint32_t)tm_end );100 hal_remote_l32( XPTR( chdev_cxy , &chdev_ptr->channel ) ) , (uint32_t)tm_end ); 101 101 #endif 102 102 -
trunk/kernel/syscalls/sys_fork.c
r506 r566 40 40 #include <syscalls.h> 41 41 42 ////////////// 42 //////////////////// 43 43 int sys_fork( void ) 44 44 { … … 67 67 parent_cxy = local_cxy; 68 68 69 #if (DEBUG_SYS_FORK || CONFIG_INSTRUMENTATION_SYSCALLS) 70 uint64_t tm_start = hal_get_cycles(); 71 #endif 72 69 73 #if DEBUG_SYS_FORK 70 uint64_t tm_start;71 uint64_t tm_end;72 tm_start = hal_get_cycles();73 74 if( DEBUG_SYS_FORK < tm_start ) 74 75 printk("\n[DBG] %s : thread %x in process %x enter / cycle = %d\n", … … 87 88 88 89 #if DEBUG_SYSCALLS_ERROR 89 printk("\n[ERROR] in %s : too much children processes\n", __FUNCTION__); 90 printk("\n[ERROR] in %s : thread %x in process %x cannot fork : too much children\n", 91 __FUNCTION__, parent_thread_ptr->trdid, parent_pid ); 90 92 #endif 91 93 hal_remote_atomic_add ( children_xp , -1 ); … … 134 136 135 137 #if DEBUG_SYSCALLS_ERROR 136 printk("\n[ERROR] in %s : cannot fork process %x incluster %x\n",137 __FUNCTION__, parent_ pid, local_cxy );138 printk("\n[ERROR] in %s : thread %x in process %x cannot fork to cluster %x\n", 139 __FUNCTION__, parent_thread_ptr->trdid, parent_pid, local_cxy ); 138 140 #endif 139 141 parent_thread_ptr->errno = EAGAIN; … … 159 161 thread_t * current = CURRENT_THREAD; 160 162 163 #if (DEBUG_SYS_FORK || CONFIG_INSTRUMENTATION_SYSCALLS) 164 uint64_t tm_end = hal_get_cycles(); 165 #endif 166 167 #if DEBUG_SYS_FORK 168 if( DEBUG_SYS_FORK < tm_end ) 169 printk("\n[DBG] %s : thread %x in process %x exit / cycle %d\n", 170 __FUNCTION__, current->trdid, current->process->pid, (uint32_t)tm_end ); 171 #endif 172 161 173 if( (current == parent_thread_ptr) && (local_cxy == parent_cxy) ) // parent thread 162 174 { … … 164 176 thread_unblock( XPTR( child_cxy , child_thread_ptr ) , THREAD_BLOCKED_GLOBAL ); 165 177 166 #if DEBUG_SYS_FORK 167 tm_end = hal_get_cycles(); 168 if( DEBUG_SYS_FORK < tm_end ) 169 printk("\n[DBG] %s : process %x exit / cost = %d / cycle %d\n", 170 __FUNCTION__, parent_pid, (uint32_t)(tm_end - tm_start), (uint32_t)tm_end);178 // only parent contribute to instrumentation 179 180 #if CONFIG_INSTRUMENTATION_SYSCALLS 181 hal_atomic_add( &syscalls_cumul_cost[SYS_FORK] , tm_end - tm_start ); 182 hal_atomic_add( &syscalls_occurences[SYS_FORK] , 1 ); 171 183 #endif 172 184 return child_pid; … … 174 186 else // child_thread 175 187 { 176 177 #if DEBUG_SYS_FORK178 tm_end = hal_get_cycles();179 if( DEBUG_SYS_FORK < tm_end )180 printk("\n[DBG] %s : process %x exit / cost = %d / cycle %d\n",181 __FUNCTION__, child_pid, (uint32_t)(tm_end - tm_start), (uint32_t)tm_end );182 #endif183 188 return 0; 184 189 } -
trunk/kernel/syscalls/sys_get_config.c
r506 r566 37 37 int sys_get_config( uint32_t * x_size, 38 38 uint32_t * y_size, 39 uint32_t * y_width,40 39 uint32_t * ncores ) 41 40 { -
trunk/kernel/syscalls/sys_getcwd.c
r506 r566 80 80 81 81 // get CWD lock in read mode 82 remote_rwlock_rd_ lock( XPTR( ref_cxy , &ref_ptr->cwd_lock ) );82 remote_rwlock_rd_acquire( XPTR( ref_cxy , &ref_ptr->cwd_lock ) ); 83 83 84 84 // call relevant VFS function … … 86 86 kbuf , CONFIG_VFS_MAX_PATH_LENGTH ); 87 87 88 // release CWD lock 89 remote_rwlock_rd_ unlock( XPTR( ref_cxy , &ref_ptr->cwd_lock ) );88 // release CWD lock in read mode 89 remote_rwlock_rd_release( XPTR( ref_cxy , &ref_ptr->cwd_lock ) ); 90 90 91 91 // copy kernel buffer to user space -
trunk/kernel/syscalls/sys_getpid.c
r506 r566 1 1 /* 2 * kern/sys_getpid.c - get process id2 * kern/sys_getpid.c - Kernel function implementing the "get_pid" system call. 3 3 * 4 * Author Alain Greiner (2016,2017 )4 * Author Alain Greiner (2016,2017, 2018) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 23 23 24 24 #include <thread.h> 25 25 #include <process.h> 26 26 #include <syscalls.h> 27 27 28 //////////////// 28 ////////////////////// 29 29 int sys_getpid( void ) 30 30 { 31 return CURRENT_THREAD->process->pid; 32 } 31 thread_t * this = CURRENT_THREAD; 32 process_t * process = this->process; 33 34 #if (DEBUG_SYS_GETPID || CONFIG_INSTRUMENTATION_SYSCALLS) 35 uint64_t tm_start = hal_get_cycles(); 36 #endif 37 38 #if DEBUG_SYS_GETPID 39 tm_start = hal_get_cycles(); 40 if( DEBUG_SYS_FG < tm_start ) 41 printk("\n[DBG] %s : thread %x in process %x enter / cycle %d\n", 42 __FUNCTION__ , this->trdid , process->pid, (uint32_t)tm_start ); 43 #endif 44 45 // get pid value from local process descriptor 46 pid_t pid = process->pid; 47 48 #if (DEBUG_SYS_GETPID || CONFIG_INSTRUMENTATION_SYSCALLS) 49 uint64_t tm_end = hal_get_cycles(); 50 #endif 51 52 #if DEBUG_SYS_GETPID 53 tm_end = hal_get_cycles(); 54 if( DEBUG_SYS_GETPID < tm_end ) 55 printk("\n[DBG] %s : thread %x in process %x exit / cycle %d\n", 56 __FUNCTION__, this->trdid, process->pid, (uint32_t)tm_end ); 57 #endif 58 59 #if CONFIG_INSTRUMENTATION_SYSCALLS 60 hal_atomic_add( &syscalls_cumul_cost[SYS_GETPID] , tm_end - tm_start ); 61 hal_atomic_add( &syscalls_occurences[SYS_GETPID] , 1 ); 62 #endif 63 64 return pid; 65 66 } // end sys_getpid() -
trunk/kernel/syscalls/sys_is_fg.c
r506 r566 48 48 process_t * process = this->process; 49 49 50 #if (DEBUG_SYS_IS_FG || CONFIG_INSTRUMENTATION_SYSCALLS) 51 uint64_t tm_start = hal_get_cycles(); 52 #endif 53 50 54 #if DEBUG_SYS_IS_FG 51 uint64_t tm_start;52 uint64_t tm_end;53 55 tm_start = hal_get_cycles(); 54 if( DEBUG_SYS_ FG < tm_start )56 if( DEBUG_SYS_IS_FG < tm_start ) 55 57 printk("\n[DBG] %s : thread %x in process %x enter for pid %x / cycle %d\n", 56 58 __FUNCTION__ , this->trdid , process->pid, pid, (uint32_t)tm_start ); … … 92 94 hal_fence(); 93 95 96 #if (DEBUG_SYS_IS_FG || CONFIG_INSTRUMENTATION_SYSCALLS) 97 uint64_t tm_end = hal_get_cycles(); 98 #endif 99 94 100 #if DEBUG_SYS_IS_FG 95 101 tm_end = hal_get_cycles(); 96 if( DEBUG_SYS_ FG < tm_end )102 if( DEBUG_SYS_IS_FG < tm_end ) 97 103 printk("\n[DBG] %s : thread %x in process %x exit / is_txt_owner %d / cycle %d\n", 98 104 __FUNCTION__, this->trdid, process->pid, is_txt_owner, (uint32_t)tm_end ); 99 105 #endif 100 106 101 return 0; 107 #if CONFIG_INSTRUMENTATION_SYSCALLS 108 hal_atomic_add( &syscalls_cumul_cost[SYS_IS_FG] , tm_end - tm_start ); 109 hal_atomic_add( &syscalls_occurences[SYS_IS_FG] , 1 ); 110 #endif 111 112 return 0; 102 113 103 114 } // end sys_is_fg() -
trunk/kernel/syscalls/sys_isatty.c
r506 r566 89 89 90 90 // get file type 91 vfs_inode_type_t type = hal_remote_l w( XPTR( file_cxy , &file_ptr->type ) );91 vfs_inode_type_t type = hal_remote_l32( XPTR( file_cxy , &file_ptr->type ) ); 92 92 93 93 // action depend on file type … … 104 104 105 105 // get chdev type 106 chdev_func = hal_remote_l w( XPTR( chdev_cxy , &chdev_ptr->func ) );106 chdev_func = hal_remote_l32( XPTR( chdev_cxy , &chdev_ptr->func ) ); 107 107 108 108 if( chdev_func == DEV_FUNC_TXT ) retval = 1; -
trunk/kernel/syscalls/sys_kill.c
r506 r566 47 47 cxy_t parent_cxy; // parent process cluster 48 48 process_t * parent_ptr; // local pointer on parent process 49 xptr_t children_lock_xp; // extended pointer on children lock in parent50 49 thread_t * parent_main_ptr; // local pointer on parent main thread 51 50 xptr_t parent_main_xp; // extended pointer on parent main thread … … 108 107 109 108 // get parent process descriptor pointers 110 parent_xp = (xptr_t)hal_remote_l wd( XPTR( owner_cxy , &owner_ptr->parent_xp ) );109 parent_xp = (xptr_t)hal_remote_l64( XPTR( owner_cxy , &owner_ptr->parent_xp ) ); 111 110 parent_cxy = GET_CXY( parent_xp ); 112 111 parent_ptr = GET_PTR( parent_xp ); … … 118 117 #endif 119 118 120 // get extended pointer on lock protecting children list in parent process121 children_lock_xp = XPTR( parent_cxy , &parent_ptr->children_lock );122 123 119 // get pointers on the parent process main thread 124 120 parent_main_ptr = hal_remote_lpt( XPTR( parent_cxy , &parent_ptr->th_tbl[0] ) ); … … 149 145 PROCESS_TERM_STOP ); 150 146 151 // take the children lock and unblock the parent process main thread 152 remote_spinlock_lock( children_lock_xp ); 147 // unblock the parent process main thread 153 148 thread_unblock( parent_main_xp , THREAD_BLOCKED_WAIT ); 154 remote_spinlock_unlock( children_lock_xp );155 149 156 150 retval = 0; … … 188 182 PROCESS_TERM_KILL ); 189 183 190 // take the children lock and unblock the parent process main thread 191 remote_spinlock_lock( children_lock_xp ); 184 // unblock the parent process main thread 192 185 thread_unblock( parent_main_xp , THREAD_BLOCKED_WAIT ); 193 remote_spinlock_unlock( children_lock_xp );194 186 195 187 retval = 0; -
trunk/kernel/syscalls/sys_mkdir.c
r457 r566 33 33 /////////////////////////////////// 34 34 int sys_mkdir( char * pathname, 35 uint32_t mode )35 uint32_t mode __attribute__((unused)) ) 36 36 { 37 37 error_t error; … … 58 58 } 59 59 60 printk("\n[ERROR] in %s : not implemented yet\n", __FUNCTION__ ); 61 return -1; 62 60 63 // copy pathname in kernel space 61 64 hal_strcpy_from_uspace( kbuf , pathname , CONFIG_VFS_MAX_PATH_LENGTH ); 62 65 63 66 // get cluster and local pointer on reference process 64 xptr_t ref_xp = process->ref_xp;65 process_t * ref_ptr = (process_t *)GET_PTR( ref_xp );66 cxy_t ref_cxy = GET_CXY( ref_xp );67 // xptr_t ref_xp = process->ref_xp; 68 // process_t * ref_ptr = (process_t *)GET_PTR( ref_xp ); 69 // cxy_t ref_cxy = GET_CXY( ref_xp ); 67 70 68 71 // get extended pointer on cwd inode 69 xptr_t cwd_xp = hal_remote_lwd( XPTR( ref_cxy , &ref_ptr->vfs_cwd_xp ) );72 // xptr_t cwd_xp = hal_remote_l64( XPTR( ref_cxy , &ref_ptr->vfs_cwd_xp ) ); 70 73 71 74 // get the cwd lock in read mode from reference process 72 remote_rwlock_rd_lock( XPTR( ref_cxy , &ref_ptr->cwd_lock ) );75 // remote_rwlock_rd_lock( XPTR( ref_cxy , &ref_ptr->cwd_lock ) ); 73 76 74 77 // call the relevant VFS function 75 error = vfs_mkdir( cwd_xp,76 kbuf,77 mode );78 // error = vfs_mkdir( cwd_xp, 79 // kbuf, 80 // mode ); 78 81 79 82 // release the cwd lock 80 remote_rwlock_rd_unlock( XPTR( ref_cxy , &ref_ptr->cwd_lock ) );83 // remote_rwlock_rd_unlock( XPTR( ref_cxy , &ref_ptr->cwd_lock ) ); 81 84 82 85 if( error ) -
trunk/kernel/syscalls/sys_mkfifo.c
r457 r566 31 31 //////////////////////////////////// 32 32 int sys_mkfifo ( char * pathname, 33 uint32_t mode )33 uint32_t mode __attribute__((unused)) ) 34 34 { 35 35 error_t error; … … 59 59 hal_strcpy_from_uspace( kbuf , pathname , CONFIG_VFS_MAX_PATH_LENGTH ); 60 60 61 // get cluster and local pointer on reference process 62 xptr_t ref_xp = process->ref_xp; 63 process_t * ref_ptr = (process_t *)GET_PTR( ref_xp ); 64 cxy_t ref_cxy = GET_CXY( ref_xp ); 65 66 // get extended pointer on cwd inode 67 xptr_t cwd_xp = hal_remote_lwd( XPTR( ref_cxy , &ref_ptr->vfs_cwd_xp ) ); 68 69 // get the cwd lock in read mode from reference process 70 remote_rwlock_rd_lock( XPTR( ref_cxy , &ref_ptr->cwd_lock ) ); 71 72 // call the relevant VFS function 73 error = vfs_mkfifo( cwd_xp, 74 kbuf, 75 mode ); 76 77 // release the cwd lock 78 remote_rwlock_rd_unlock( XPTR( ref_cxy , &ref_ptr->cwd_lock ) ); 61 printk("\n[ERROR] in %s : not implemented yet\n", __FUNCTION__ ); 62 return -1; 79 63 80 64 if( error ) -
trunk/kernel/syscalls/sys_mmap.c
r506 r566 156 156 // get inode pointer, mapper pointer and file attributes 157 157 vfs_inode_t * inode_ptr = hal_remote_lpt(XPTR(file_cxy , &file_ptr->inode )); 158 uint32_t file_attr = hal_remote_l w(XPTR(file_cxy , &file_ptr->attr ));158 uint32_t file_attr = hal_remote_l32 (XPTR(file_cxy , &file_ptr->attr )); 159 159 mapper_t * mapper_ptr = hal_remote_lpt(XPTR(file_cxy , &file_ptr->mapper)); 160 160 161 161 // get file size 162 uint32_t size = hal_remote_l w( XPTR( file_cxy , &inode_ptr->size ) );162 uint32_t size = hal_remote_l32( XPTR( file_cxy , &inode_ptr->size ) ); 163 163 164 164 // chek offset and length arguments -
trunk/kernel/syscalls/sys_mutex.c
r508 r566 32 32 33 33 34 #if DEBUG_SYS_MUTEX 35 //////////////////////////////////////////////////// 36 static char * sys_mutex_op_str( uint32_t operation ) 37 { 38 if ( operation == MUTEX_INIT ) return "INIT"; 39 else if( operation == MUTEX_LOCK ) return "LOCK"; 40 else if( operation == MUTEX_UNLOCK ) return "UNLOCK"; 41 else if( operation == MUTEX_TRYLOCK ) return "TRYLOCK"; 42 else if( operation == MUTEX_DESTROY ) return "DESTROY"; 43 else return "undefined"; 44 } 45 #endif 46 34 47 ///////////////////////////////// 35 48 int sys_mutex( void * vaddr, … … 38 51 { 39 52 error_t error; 40 vseg_t * vseg; 53 vseg_t * vseg; // for vaddr check 41 54 42 55 thread_t * this = CURRENT_THREAD; 43 56 process_t * process = this->process; 57 58 #if DEBUG_SYS_MUTEX 59 uint64_t tm_start; 60 uint64_t tm_end; 61 tm_start = hal_get_cycles(); 62 if( DEBUG_SYS_MUTEX < tm_start ) 63 printk("\n[DBG] %s : thread %x in process %x enter for %s / cycle %d\n", 64 __FUNCTION__, this->trdid, process->pid, sys_mutex_op_str( operation ), (uint32_t)tm_start ); 65 #endif 44 66 45 67 // check vaddr in user vspace … … 148 170 else // success 149 171 { 150 remote_mutex_unlock( mutex_xp ); 172 error = remote_mutex_unlock( mutex_xp ); 173 174 if( error ) 175 { 176 177 #if DEBUG_SYSCALLS_ERROR 178 printk("\n[ERROR] in %s : mutex %x not owned in UNLOCK / thread %x / process %x\n", 179 __FUNCTION__ , (intptr_t)vaddr , this->trdid , process->pid ); 180 #endif 181 this->errno = EINVAL; 182 return -1; 183 } 184 } 185 break; 186 } 187 /////////////////// 188 case MUTEX_TRYLOCK: 189 { 190 xptr_t mutex_xp = remote_mutex_from_ident( (intptr_t)vaddr ); 191 192 if( mutex_xp == XPTR_NULL ) // user error 193 { 194 195 #if DEBUG_SYSCALLS_ERROR 196 printk("\n[ERROR] in %s : mutex %x not registered / thread %x / process %x\n", 197 __FUNCTION__ , (intptr_t)vaddr , this->trdid , process->pid ); 198 #endif 199 this->errno = EINVAL; 200 return -1; 201 } 202 else // success 203 { 204 error = remote_mutex_trylock( mutex_xp ); 205 206 if( error ) // non fatal : mutex already taken 207 { 208 this->errno = EBUSY; 209 return -1; 210 } 151 211 } 152 212 break; 153 213 } 154 214 //////// 155 default: { 215 default: 216 { 156 217 assert ( false, "illegal operation type <%x>", operation ); 157 218 } 158 219 } 159 220 221 hal_fence(); 222 223 #if DEBUG_SYS_MUTEX 224 tm_end = hal_get_cycles(); 225 if( DEBUG_SYS_MUTEX < tm_start ) 226 printk("\n[DBG] %s : thread %x in process %x exit for %s / cost %d / cycle %d\n", 227 __FUNCTION__, this->trdid, process->pid, sys_mutex_op_str( operation ), 228 (uint32_t)(tm_end - tm_start), (uint32_t)tm_end ); 229 #endif 230 160 231 return 0; 161 232 -
trunk/kernel/syscalls/sys_open.c
r506 r566 30 30 #include <vfs.h> 31 31 #include <process.h> 32 #include <remote_spinlock.h>33 32 #include <remote_rwlock.h> 34 33 … … 36 35 37 36 /////////////////////////////////// 38 int sys_open ( c onst char* pathname,39 uint32_t 40 uint32_t 37 int sys_open ( char * pathname, 38 uint32_t flags, 39 uint32_t mode ) 41 40 { 42 41 error_t error; … … 57 56 if( process_fd_array_full() ) 58 57 { 59 printk("\n[ERROR] in %s : file descriptor array full for process %x\n", 60 __FUNCTION__ , process->pid ); 58 59 #if DEBUG_SYSCALLS_ERROR 60 printk("\n[ERROR] in %s : file descriptor array full for process %x\n", 61 __FUNCTION__ , process->pid ); 62 #endif 61 63 this->errno = ENFILE; 62 64 return -1; … … 66 68 if( hal_strlen_from_uspace( pathname ) >= CONFIG_VFS_MAX_PATH_LENGTH ) 67 69 { 68 printk("\n[ERROR] in %s : pathname too long\n", __FUNCTION__ ); 70 71 #if DEBUG_SYSCALLS_ERROR 72 printk("\n[ERROR] in %s : pathname too long\n", __FUNCTION__ ); 73 #endif 69 74 this->errno = ENFILE; 70 75 return -1; … … 86 91 87 92 // get the cwd lock in read mode from reference process 88 remote_rwlock_rd_ lock( XPTR( ref_cxy , &ref_ptr->cwd_lock ) );93 remote_rwlock_rd_acquire( XPTR( ref_cxy , &ref_ptr->cwd_lock ) ); 89 94 90 95 // call the relevant VFS function … … 97 102 98 103 // release the cwd lock 99 remote_rwlock_rd_ unlock( XPTR( ref_cxy , &ref_ptr->cwd_lock ) );104 remote_rwlock_rd_release( XPTR( ref_cxy , &ref_ptr->cwd_lock ) ); 100 105 101 106 if( error ) … … 106 111 return -1; 107 112 } 108 109 // update local fd_array110 remote_spinlock_lock( XPTR( local_cxy , &process->fd_array.lock ) );111 process->fd_array.array[file_id] = file_xp;112 remote_spinlock_unlock( XPTR( local_cxy , &process->fd_array.lock ) );113 114 hal_fence();115 113 116 114 #if DEBUG_SYS_OPEN -
trunk/kernel/syscalls/sys_read.c
r506 r566 34 34 #include <process.h> 35 35 36 #include <syscalls.h>37 38 // TODO: concurrent user page(s) munmap need to be handled [AG]39 36 40 37 extern uint32_t enter_sys_read; … … 69 66 xptr_t process_owner_xp = process->owner_xp; 70 67 68 #if (DEBUG_SYS_READ || CONFIG_INSTRUMENTATION_SYSCALLS) 69 uint64_t tm_start = hal_get_cycles(); 70 #endif 71 71 72 #if DEBUG_SYS_READ 72 uint64_t tm_start;73 uint64_t tm_end;74 tm_start = hal_get_cycles();75 73 if( DEBUG_SYS_READ < tm_start ) 76 74 printk("\n[DBG] %s : thread %x in process %x enter / vaddr %x / count %d / cycle %d\n", … … 130 128 131 129 // check file readable 132 uint32_t attr = hal_remote_l w( XPTR( file_cxy , &file_ptr->attr ) );130 uint32_t attr = hal_remote_l32( XPTR( file_cxy , &file_ptr->attr ) ); 133 131 if( (attr & FD_ATTR_READ_ENABLE) == 0 ) 134 132 { … … 143 141 144 142 // get file type 145 vfs_inode_type_t type = hal_remote_l w( XPTR( file_cxy , &file_ptr->type ) );143 vfs_inode_type_t type = hal_remote_l32( XPTR( file_cxy , &file_ptr->type ) ); 146 144 147 145 // action depend on file type … … 149 147 { 150 148 // check file readable 151 uint32_t attr = hal_remote_l w( XPTR( file_cxy , &file_ptr->attr ) );149 uint32_t attr = hal_remote_l32( XPTR( file_cxy , &file_ptr->attr ) ); 152 150 153 151 if( (attr & FD_ATTR_READ_ENABLE) == 0 ) … … 181 179 { 182 180 // extended pointer on TXT owner process 183 txt_owner_xp = hal_remote_l wd( XPTR( chdev_cxy , &chdev_ptr->ext.txt.owner_xp ) );181 txt_owner_xp = hal_remote_l64( XPTR( chdev_cxy , &chdev_ptr->ext.txt.owner_xp ) ); 184 182 185 183 // check TXT_RX ownership … … 230 228 hal_fence(); 231 229 230 #if (DEBUG_SYS_READ || CONFIG_INSTRUMENTATION_SYSCALLS) 231 uint64_t tm_end = hal_get_cycles(); 232 #endif 233 232 234 #if DEBUG_SYS_READ 233 tm_end = hal_get_cycles();234 235 if( DEBUG_SYS_READ < tm_end ) 235 printk("\n[DBG] %s : thread %x in process %x exit / cycle %d / cost %d\n", 236 __FUNCTION__ , this->trdid, process->pid, (uint32_t)tm_start, (uint32_t)(tm_end - tm_start) ); 236 printk("\n[DBG] %s : thread %x in process %x exit / cycle %d\n", 237 __FUNCTION__ , this->trdid, process->pid, (uint32_t)tm_end ); 238 #endif 239 240 #if CONFIG_INSTRUMENTATION_SYSCALLS 241 hal_atomic_add( &syscalls_cumul_cost[SYS_READ] , tm_end - tm_start ); 242 hal_atomic_add( &syscalls_occurences[SYS_READ] , 1 ); 237 243 #endif 238 244 -
trunk/kernel/syscalls/sys_rmdir.c
r506 r566 34 34 35 35 //////////////////////////////// 36 int sys_rmdir( c onst char * pathname )36 int sys_rmdir( char * pathname ) 37 37 { 38 38 error_t error; … … 59 59 60 60 // get extended pointer on cwd inode 61 xptr_t cwd_xp = hal_remote_l wd( XPTR( ref_cxy , &ref_ptr->vfs_cwd_xp ) );61 xptr_t cwd_xp = hal_remote_l64( XPTR( ref_cxy , &ref_ptr->vfs_cwd_xp ) ); 62 62 63 // get the cwd lock in readmode from reference process64 remote_rwlock_ rd_lock( XPTR( ref_cxy , &ref_ptr->cwd_lock ) );63 // get the cwd lock in write mode from reference process 64 remote_rwlock_wr_acquire( XPTR( ref_cxy , &ref_ptr->cwd_lock ) ); 65 65 66 66 // call the relevant VFS function … … 69 69 70 70 // release the cwd lock 71 remote_rwlock_ rd_unlock( XPTR( ref_cxy , &ref_ptr->cwd_lock ) );71 remote_rwlock_wr_release( XPTR( ref_cxy , &ref_ptr->cwd_lock ) ); 72 72 73 73 if( error ) -
trunk/kernel/syscalls/sys_sem.c
r469 r566 51 51 uint32_t * current_value ) // pointer on current value buffer 52 52 { 53 vseg_t * vseg; 53 vseg_t * vseg; // for vaddr check 54 54 error_t error; 55 uint32_t current; // semaphore current value56 xptr_t sem_xp; // extended pointer on semaphore57 55 58 56 thread_t * this = CURRENT_THREAD; … … 90 88 // call relevant kernel function to initialize semaphore 91 89 error = remote_sem_create( (intptr_t)vaddr , 92 init_value, 93 XPTR( local_cxy , &sem_xp ) ); 94 90 init_value ); 95 91 if ( error ) 96 92 { … … 103 99 return -1; 104 100 } 105 106 break; 107 } 101 } 102 break; 108 103 ////////////////// 109 104 case SEM_GETVALUE: … … 115 110 116 111 #if DEBUG_SYSCALLS_ERROR 117 printk("\n[ERROR] in %s GETVALUE: unmapped targetbuffer %x / thread %x in process %x / cycle %d\n",112 printk("\n[ERROR] in %s GETVALUE: unmapped buffer %x / thread %x in process %x / cycle %d\n", 118 113 __FUNCTION__ , (intptr_t)current_value, this->trdid, process->pid, (uint32_t)hal_get_cycles() ); 119 114 vmm_display( process , false ); … … 124 119 125 120 // get extended pointer on remote semaphore 126 sem_xp = remote_sem_from_vaddr( (intptr_t)vaddr );121 xptr_t sem_xp = remote_sem_from_ident( (intptr_t)vaddr ); 127 122 128 123 // check semaphore registered … … 139 134 140 135 // call relevant kernel function to get semaphore current value 136 uint32_t current; 141 137 remote_sem_get_value( sem_xp , ¤t ); 142 138 143 139 // return value to user 144 140 hal_copy_to_uspace( current_value , ¤t , sizeof(uint32_t) ); 145 146 break; 147 } 141 } 142 break; 148 143 ////////////// 149 144 case SEM_WAIT: 150 145 { 151 146 // get extended pointer on remote semaphore 152 sem_xp = remote_sem_from_vaddr( (intptr_t)vaddr );147 xptr_t sem_xp = remote_sem_from_ident( (intptr_t)vaddr ); 153 148 154 149 // check semaphore registered … … 167 162 // call relevant kernel function to wait semaphore available 168 163 remote_sem_wait( sem_xp ); 169 170 break; 171 } 164 } 165 break; 172 166 ////////////// 173 167 case SEM_POST: 174 168 { 175 169 // get extended pointer on remote semaphore 176 sem_xp = remote_sem_from_vaddr( (intptr_t)vaddr );170 xptr_t sem_xp = remote_sem_from_ident( (intptr_t)vaddr ); 177 171 178 172 // check semaphore registered … … 190 184 // call relevant kernel function to release semaphore 191 185 remote_sem_post( sem_xp ); 192 193 break; 194 } 186 } 187 break; 195 188 ///////////////// 196 189 case SEM_DESTROY: 197 190 { 198 191 // get extended pointer on remote semaphore 199 sem_xp = remote_sem_from_vaddr( (intptr_t)vaddr );192 xptr_t sem_xp = remote_sem_from_ident( (intptr_t)vaddr ); 200 193 201 194 // check semaphore registered … … 213 206 // destroy semaphore 214 207 remote_sem_destroy( sem_xp ); 215 216 break;217 208 } 209 break; 218 210 /////// 219 211 default: // undefined operation … … 234 226 tm_end = hal_get_cycles(); 235 227 if( DEBUG_SYS_SEM < tm_end ) 236 { 237 cxy_t sem_cxy = GET_CXY( sem_xp ); 238 remote_sem_t * sem_ptr = GET_PTR( sem_xp ); 239 uint32_t value = hal_remote_lw( XPTR( sem_cxy , &sem_ptr->count ) ); 240 printk("\n[DBG] %s : thread %x in process %x exit for %s / value %d / cost = %d / cycle %d\n", 241 __FUNCTION__, this->trdid, process->pid, sys_sem_op_str( operation ), value, 242 (uint32_t)(tm_end - tm_start), (uint32_t)tm_end ); 243 } 228 printk("\n[DBG] %s : thread %x in process %x exit for %s / cost = %d / cycle %d\n", 229 __FUNCTION__, this->trdid, process->pid, sys_sem_op_str( operation ), 230 (uint32_t)(tm_end - tm_start), (uint32_t)tm_end ); 244 231 #endif 245 232 -
trunk/kernel/syscalls/sys_stat.c
r509 r566 35 35 36 36 ///////////////////////////////////// 37 int sys_stat( c onst char* pathname,37 int sys_stat( char * pathname, 38 38 struct stat * u_stat ) 39 39 { … … 79 79 80 80 // get extended pointer on cwd inode 81 xptr_t cwd_xp = hal_remote_l wd( XPTR( ref_cxy , &ref_ptr->vfs_cwd_xp ) );81 xptr_t cwd_xp = hal_remote_l64( XPTR( ref_cxy , &ref_ptr->vfs_cwd_xp ) ); 82 82 83 83 // get the cwd lock in read mode from reference process 84 remote_rwlock_rd_ lock( XPTR( ref_cxy , &ref_ptr->cwd_lock ) );84 remote_rwlock_rd_acquire( XPTR( ref_cxy , &ref_ptr->cwd_lock ) ); 85 85 86 86 // get extended pointer on remote file descriptor … … 91 91 92 92 // release the cwd lock 93 remote_rwlock_rd_ unlock( XPTR( ref_cxy , &ref_ptr->cwd_lock ) );93 remote_rwlock_rd_release( XPTR( ref_cxy , &ref_ptr->cwd_lock ) ); 94 94 95 95 if( error ) -
trunk/kernel/syscalls/sys_thread_create.c
r506 r566 35 35 #include <kmem.h> 36 36 #include <process.h> 37 #include <spinlock.h>38 37 #include <dqdt.h> 39 38 #include <rpc.h> … … 41 40 #include <syscalls.h> 42 41 43 /////////////////////////////////////////////////// 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 ) 42 ///////////////////////////////////////////////////////// 43 int sys_thread_create( trdid_t * trdid_ptr, 44 struct pthread_attr_s * user_attr, 45 void * start_func, 46 void * start_args ) 49 47 { 50 48 pthread_attr_t kern_attr; // copy of pthread attributes in kernel space 51 49 thread_t * parent; // pointer on thread executing the pthread_create 52 xptr_t parent_xp; // extended pointer on created thread 50 xptr_t parent_xp; // extended pointer on calling thread 51 cxy_t child_cxy; // created child thread cluster identifier 53 52 thread_t * child_ptr; // pointer on created child thread 54 53 xptr_t child_xp; // extended pointer on created thread … … 56 55 process_t * process; // pointer on local process descriptor 57 56 vseg_t * vseg; // required for user space checking 58 cxy_t target_cxy; // target cluster identifier59 57 error_t error; 60 58 … … 69 67 tm_start = hal_get_cycles(); 70 68 if( DEBUG_SYS_THREAD_CREATE < tm_start ) 71 printk("\n[DBG] %s : thread %x (cxy %x) enter / process %x/ cycle %d\n",72 __FUNCTION__, parent , local_cxy, process->pid, (uint32_t)tm_start );69 printk("\n[DBG] %s : thread %x in process %x enter / cycle %d\n", 70 __FUNCTION__, parent->trdid, process->pid, (uint32_t)tm_start ); 73 71 #endif 74 72 75 73 // check trdid buffer in user space 76 error = vmm_get_vseg( process , (intptr_t) new_thread, &vseg );74 error = vmm_get_vseg( process , (intptr_t)trdid_ptr , &vseg ); 77 75 78 76 if ( error ) … … 80 78 81 79 #if DEBUG_SYSCALLS_ERROR 82 printk("\n[ERROR] in %s : t rdid buffer unmapped %x / thread %x / process%x\n",83 __FUNCTION__ , (intptr_t)new_thread, parent->trdid, process->pid);80 printk("\n[ERROR] in %s : thread %x in process %x / trdid buffer %x unmapped %x\n", 81 __FUNCTION__, parent->trdid, process->pid, (intptr_t)trdid_ptr ); 84 82 vmm_display( process , false ); 85 83 #endif … … 97 95 98 96 #if DEBUG_SYSCALLS_ERROR 99 printk("\n[ERROR] in %s : user_attr buffer unmapped %x / thread %x / process%x\n",100 __FUNCTION__ , (intptr_t)user_attr , parent->trdid , process->pid);97 printk("\n[ERROR] in %s : thread %x in process %x / user_attr buffer unmapped %x\n", 98 __FUNCTION__, parent->trdid, process->pid, (intptr_t)user_attr ); 101 99 vmm_display( process , false ); 102 100 #endif … … 115 113 116 114 #if DEBUG_SYSCALLS_ERROR 117 printk("\n[ERROR] in %s : start_func unmapped %x / thread %x / process%x\n",118 __FUNCTION__ , (intptr_t)start_func , parent->trdid , process->pid);115 printk("\n[ERROR] in %s : thread %x in process %x / start_func unmapped %x\n", 116 __FUNCTION__, parent->trdid, process->pid, (intptr_t)start_func ); 119 117 vmm_display( process , false ); 120 118 #endif … … 132 130 133 131 #if DEBUG_SYSCALLS_ERROR 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);132 printk("\n[ERROR] in %s : thread %x in process %x / start_args buffer unmapped %x\n", 133 __FUNCTION__, parent->trdid, process->pid, (intptr_t)start_args ); 136 134 vmm_display( process , false ); 137 135 #endif … … 141 139 } 142 140 143 // define attributes and target_cxy141 // define attributes and child_cxy 144 142 if( user_attr != NULL ) // user defined attributes 145 143 { 146 // check / get target_cxy144 // check / get child_cxy 147 145 if( kern_attr.attributes & PT_ATTR_CLUSTER_DEFINED ) 148 146 { … … 151 149 152 150 #if DEBUG_SYSCALLS_ERROR 153 printk("\n[ERROR] in %s : illegal target cluster = %x / thread %x / process%x\n",154 __FUNCTION__ , kern_attr.cxy, parent->trdid, process->pid);151 printk("\n[ERROR] in %s : thread %x in process %x / illegal target cluster %x\n", 152 __FUNCTION__, parent->trdid, process->pid, kern_attr.cxy ); 155 153 #endif 156 154 parent->errno = EINVAL; 157 155 return -1; 158 156 } 159 target_cxy = kern_attr.cxy;157 child_cxy = kern_attr.cxy; 160 158 } 161 159 else 162 160 { 163 target_cxy = dqdt_get_cluster_for_process();161 child_cxy = dqdt_get_cluster_for_process(); 164 162 } 165 163 } … … 167 165 { 168 166 kern_attr.attributes = PT_ATTR_DETACH | PT_ATTR_CLUSTER_DEFINED; 169 target_cxy = dqdt_get_cluster_for_process();167 child_cxy = dqdt_get_cluster_for_process(); 170 168 } 171 169 … … 173 171 // this returns "error", "child_ptr", and "child_xp" 174 172 175 if( target_cxy == local_cxy ) // target cluster is local173 if( child_cxy == local_cxy ) // target cluster is local 176 174 { 177 175 // create thread in local cluster … … 186 184 else // target cluster is remote 187 185 { 188 rpc_thread_user_create_client( target_cxy,186 rpc_thread_user_create_client( child_cxy, 189 187 process->pid, 190 188 start_func, … … 202 200 203 201 #if DEBUG_SYSCALLS_ERROR 204 printk("\n[ERROR] in %s : cannot create new thread / thread %x / process %x\n",202 printk("\n[ERROR] in %s : thread %x in process %x cannot create new thread\n", 205 203 __FUNCTION__ , parent->trdid, process->pid ); 206 204 #endif … … 210 208 211 209 // returns trdid to user space 212 trdid = hal_remote_l w( XPTR( target_cxy , &child_ptr->trdid ) );213 hal_copy_to_uspace( new_thread, &trdid , sizeof(pthread_t) );210 trdid = hal_remote_l32( XPTR( child_cxy , &child_ptr->trdid ) ); 211 hal_copy_to_uspace( trdid_ptr , &trdid , sizeof(pthread_t) ); 214 212 215 213 // activate new thread … … 221 219 tm_end = hal_get_cycles(); 222 220 if( DEBUG_SYS_THREAD_CREATE < tm_end ) 223 printk("\n[DBG] %s : thread %x (cxy %x) created thread %x (cxy %x) / process%x / cycle %d\n",224 __FUNCTION__, parent , local_cxy, child_ptr, target_cxy, process->pid, (uint32_t)tm_end );221 printk("\n[DBG] %s : thread %x in process %x created thread %x / cycle %d\n", 222 __FUNCTION__, parent->trdid, process->pid, child_ptr->trdid, (uint32_t)tm_end ); 225 223 #endif 226 224 -
trunk/kernel/syscalls/sys_thread_detach.c
r506 r566 48 48 49 49 // check trdid argument 50 if( (target_ltid >= CONFIG_THREAD _MAX_PER_CLUSTER) || cluster_is_undefined( target_cxy ) )50 if( (target_ltid >= CONFIG_THREADS_MAX_PER_CLUSTER) || cluster_is_undefined( target_cxy ) ) 51 51 { 52 52 printk("\n[ERROR] in %s : illegal trdid argument\n", __FUNCTION__ ); … … 69 69 70 70 // get target thread flags 71 flags = hal_remote_l w( XPTR( target_cxy , &target_ptr->flags ) );71 flags = hal_remote_l32( XPTR( target_cxy , &target_ptr->flags ) ); 72 72 73 73 // check target thread joinable -
trunk/kernel/syscalls/sys_thread_exit.c
r506 r566 62 62 tm_start = hal_get_cycles(); 63 63 if( DEBUG_SYS_THREAD_EXIT < tm_start ) 64 printk("\n[DBG] %s : thread %x enter / process %x/ cycle %d\n",65 __FUNCTION__ , this , pid , (uint32_t)tm_start );64 printk("\n[DBG] %s : thread %x in process %x enter / cycle %d\n", 65 __FUNCTION__ , this->trdid, pid , (uint32_t)tm_start ); 66 66 #endif 67 67 … … 98 98 tm_end = hal_get_cycles(); 99 99 if( DEBUG_SYS_THREAD_EXIT < tm_end ) 100 printk("\n[DBG] %s : thread %x exit / process %x/ cost %d / cycle %d\n",101 __FUNCTION__, this , pid, (uint32_t)(tm_end - tm_start), (uint32_t)tm_end );100 printk("\n[DBG] %s : thread %x in process %x exit / cost %d / cycle %d\n", 101 __FUNCTION__, this->trdid, pid, (uint32_t)(tm_end - tm_start), (uint32_t)tm_end ); 102 102 #endif 103 103 -
trunk/kernel/syscalls/sys_thread_join.c
r506 r566 31 31 #include <errno.h> 32 32 #include <printk.h> 33 #include <remote_ spinlock.h>33 #include <remote_busylock.h> 34 34 35 35 #include <syscalls.h> … … 67 67 tm_start = hal_get_cycles(); 68 68 if( DEBUG_SYS_THREAD_JOIN < tm_start ) 69 printk("\n[DBG] %s : parent thread %x enter / process %x / target trdid %x / cycle %d\n",70 __FUNCTION__ , joining_ptr , process->pid, trdid , (uint32_t)tm_start );69 printk("\n[DBG] %s : thread %x in process %x enter / target thread %x / cycle %d\n", 70 __FUNCTION__ , joining_ptr->trdid, process->pid, trdid , (uint32_t)tm_start ); 71 71 #endif 72 72 73 73 // check trdid argument 74 if( (target_ltid >= CONFIG_THREAD _MAX_PER_CLUSTER) || cluster_is_undefined( target_cxy ) )74 if( (target_ltid >= CONFIG_THREADS_MAX_PER_CLUSTER) || cluster_is_undefined( target_cxy ) ) 75 75 { 76 76 … … 126 126 127 127 // check target thread joinable 128 if( (hal_remote_l w( target_flags_xp ) & THREAD_FLAG_DETACHED) == 0 )128 if( (hal_remote_l32( target_flags_xp ) & THREAD_FLAG_DETACHED) != 0 ) 129 129 { 130 130 … … 140 140 141 141 // get the lock protecting the join in target thread 142 remote_ spinlock_lock( target_join_lock_xp );142 remote_busylock_acquire( target_join_lock_xp ); 143 143 144 144 // test the kill_done flag from the target thread 145 if( hal_remote_lw( target_flags_xp ) & THREAD_FLAG_KILL_DONE ) // killer thread is first 146 { 145 if( hal_remote_l32( target_flags_xp ) & THREAD_FLAG_KILL_DONE ) // killer thread is first 146 { 147 148 #if (DEBUG_SYS_THREAD_JOIN & 1) 149 if( DEBUG_SYS_THREAD_JOIN < tm_start ) 150 printk("\n[DBG] %s : thread %x in process %x / killer thread arrived first\n", 151 __FUNCTION__ , joining_ptr->trdid, process->pid ); 152 #endif 147 153 // get pointers on killer thread 148 killer_xp = (xptr_t)hal_remote_l wd( target_join_xp_xp );154 killer_xp = (xptr_t)hal_remote_l64( target_join_xp_xp ); 149 155 150 156 // reset the kill_done flag in target thread … … 155 161 156 162 // release the lock protecting join 157 remote_ spinlock_unlock( target_join_lock_xp );163 remote_busylock_release( target_join_lock_xp ); 158 164 159 165 // restore IRQs … … 162 168 else // joining thread is first 163 169 { 170 171 #if (DEBUG_SYS_THREAD_JOIN & 1) 172 if( DEBUG_SYS_THREAD_JOIN < tm_start ) 173 printk("\n[DBG] %s : thread %x in process %x / joining thread arrived first\n", 174 __FUNCTION__ , joining_ptr->trdid, process->pid ); 175 #endif 164 176 // set the join_done flag in target thread 165 177 hal_remote_atomic_or( target_flags_xp , THREAD_FLAG_JOIN_DONE ); … … 169 181 170 182 // register the joining thread extended pointer in target thread 171 hal_remote_s wd( target_join_xp_xp , joining_xp );183 hal_remote_s64( target_join_xp_xp , joining_xp ); 172 184 173 185 // release the lock protecting the join 174 remote_spinlock_unlock( target_join_lock_xp ); 175 186 remote_busylock_release( target_join_lock_xp ); 187 188 #if (DEBUG_SYS_THREAD_JOIN & 1) 189 if( DEBUG_SYS_THREAD_JOIN < tm_start ) 190 printk("\n[DBG] %s : thread %x in process %x / joining thread deschedule\n", 191 __FUNCTION__ , joining_ptr->trdid, process->pid ); 192 #endif 176 193 // deschedule 177 194 sched_yield( "joining thread waiting killer thread" ); 178 195 196 #if (DEBUG_SYS_THREAD_JOIN & 1) 197 if( DEBUG_SYS_THREAD_JOIN < tm_start ) 198 printk("\n[DBG] %s : thread %x in process %x / joining thread resume\n", 199 __FUNCTION__ , joining_ptr->trdid, process->pid ); 200 #endif 179 201 // restore IRQs 180 202 hal_restore_irq( save_sr ); … … 184 206 tm_end = hal_get_cycles(); 185 207 if( DEBUG_SYS_THREAD_JOIN < tm_end ) 186 printk("\n[DBG] %s : parent thread %x exit / process %x / target trdid %x / cycle %d\n",187 __FUNCTION__, joining_ptr , process->pid, trdid, (uint32_t)tm_end );208 printk("\n[DBG] %s : thread %x in process %x exit / target thread %x / cycle %d\n", 209 __FUNCTION__, joining_ptr->trdid, process->pid, (uint32_t)tm_end ); 188 210 #endif 189 211 -
trunk/kernel/syscalls/sys_thread_sleep.c
r506 r566 39 39 tm_start = hal_get_cycles(); 40 40 if( DEBUG_SYS_THREAD_SLEEP < tm_start ) 41 printk("\n[DBG] %s : thread %x blocked / process %x/ cycle %d\n",42 __FUNCTION__ , this , this->process->pid , (uint32_t)tm_start );41 printk("\n[DBG] %s : thread %x n process %x blocked / cycle %d\n", 42 __FUNCTION__ , this->trdid, this->process->pid , (uint32_t)tm_start ); 43 43 #endif 44 44 … … 49 49 tm_end = hal_get_cycles(); 50 50 if( DEBUG_SYS_THREAD_SLEEP < tm_end ) 51 printk("\n[DBG] %s : thread %x resume / process %x/ cycle %d\n",52 __FUNCTION__ , this , this->process->pid , (uint32_t)tm_end );51 printk("\n[DBG] %s : thread %x in process %x resume / cycle %d\n", 52 __FUNCTION__ , this->trdid, this->process->pid , (uint32_t)tm_end ); 53 53 #endif 54 54 -
trunk/kernel/syscalls/sys_thread_wakeup.c
r506 r566 41 41 tm_start = hal_get_cycles(); 42 42 if( DEBUG_SYS_THREAD_WAKEUP < tm_start ) 43 printk("\n[DBG] %s : thread %x enter / activate thread %x in process%x / cycle %d\n",44 __FUNCTION__ , this, trdid, this->process->pid, (uint32_t)tm_start );43 printk("\n[DBG] %s : thread %x in process enter to activate thread %x / cycle %d\n", 44 __FUNCTION__, this->trdid, process->pid, trdid, (uint32_t)tm_start ); 45 45 #endif 46 46 … … 50 50 51 51 // check trdid argument 52 if( (target_ltid >= CONFIG_THREAD _MAX_PER_CLUSTER) || cluster_is_undefined( target_cxy ) )52 if( (target_ltid >= CONFIG_THREADS_MAX_PER_CLUSTER) || cluster_is_undefined( target_cxy ) ) 53 53 { 54 54 55 55 #if DEBUG_SYSCALLS_ERROR 56 printk("\n[ERROR] in %s : illegal trdid argument %x\n", __FUNCTION__, trdid ); 56 printk("\n[ERROR] in %s : thread %x in process %x / illegal trdid argument %x\n", 57 __FUNCTION__, this->trdid, process->pid, trdid ); 57 58 #endif 58 59 this->errno = EINVAL; … … 67 68 68 69 #if DEBUG_SYSCALLS_ERROR 69 printk("\n[ERROR] in %s : cannot find thread %x in process%x/n",70 __FUNCTION__ , t rdid , this->process->pid );70 printk("\n[ERROR] in %s : thread %x in process %x cannot find thread %x/n", 71 __FUNCTION__ , this->trdid, process->pid, trdid ); 71 72 #endif 72 73 CURRENT_THREAD->errno = EINVAL; … … 80 81 tm_end = hal_get_cycles(); 81 82 if( DEBUG_SYS_THREAD_WAKEUP < tm_end ) 82 printk("\n[DBG] %s : thread %x exit / thread %x in process%x activated / cycle %d\n",83 __FUNCTION__ , this , trdid, this->process->pid, (uint32_t)tm_end );83 printk("\n[DBG] %s : thread %x in process %x exit / thread %x activated / cycle %d\n", 84 __FUNCTION__ , this->trdid, process->pid, trdid, (uint32_t)tm_end ); 84 85 #endif 85 86 -
trunk/kernel/syscalls/sys_thread_yield.c
r506 r566 37 37 tm_start = hal_get_cycles(); 38 38 if( DEBUG_SYS_THREAD_YIELD < tm_start ) 39 printk("\n[DBG] %s : thread %x deschedule / process %x/ cycle %d\n",39 printk("\n[DBG] %s : thread %x in process %x deschedule / cycle %d\n", 40 40 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, (uint32_t)tm_start ); 41 41 #endif … … 47 47 tm_end = hal_get_cycles(); 48 48 if( DEBUG_SYS_THREAD_YIELD < tm_start ) 49 printk("\n[DBG] %s : thread %x resume / process %x/ cycle %d\n",49 printk("\n[DBG] %s : thread %x in process %x resume / cycle %d\n", 50 50 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, (uint32_t)tm_end ); 51 51 #endif -
trunk/kernel/syscalls/sys_trace.c
r457 r566 62 62 63 63 // check core local index 64 ncores = hal_remote_l w( XPTR( cxy , &LOCAL_CLUSTER->cores_nr ) );64 ncores = hal_remote_l32( XPTR( cxy , &LOCAL_CLUSTER->cores_nr ) ); 65 65 if( lid >= ncores ) 66 66 { … … 80 80 xptr_t trace_xp = XPTR( cxy , &core->scheduler.trace ); 81 81 82 if ( active ) hal_remote_s w( trace_xp , 1 );83 else hal_remote_s w( trace_xp , 0 );82 if ( active ) hal_remote_s32( trace_xp , 1 ); 83 else hal_remote_s32( trace_xp , 0 ); 84 84 85 85 hal_fence(); -
trunk/kernel/syscalls/sys_unlink.c
r506 r566 31 31 32 32 ////////////////////////////////// 33 int sys_unlink ( c onst char * pathname )33 int sys_unlink ( char * pathname ) 34 34 { 35 35 error_t error; … … 55 55 cxy_t ref_cxy = GET_CXY( ref_xp ); 56 56 57 // get the cwd lock in readmode from reference process58 remote_rwlock_ rd_lock( XPTR( ref_cxy , &ref_ptr->cwd_lock ) );57 // get the cwd lock in write mode from reference process 58 remote_rwlock_wr_acquire( XPTR( ref_cxy , &ref_ptr->cwd_lock ) ); 59 59 60 60 // get extended pointer on cwd inode 61 xptr_t cwd_xp = hal_remote_l wd( XPTR( ref_cxy , &ref_ptr->vfs_cwd_xp ) );61 xptr_t cwd_xp = hal_remote_l64( XPTR( ref_cxy , &ref_ptr->vfs_cwd_xp ) ); 62 62 63 63 // call relevant VFS function … … 65 65 66 66 // release the cwd lock in reference process 67 remote_rwlock_ rd_unlock( XPTR( ref_cxy , &ref_ptr->cwd_lock ) );67 remote_rwlock_wr_release( XPTR( ref_cxy , &ref_ptr->cwd_lock ) ); 68 68 69 69 if( error ) -
trunk/kernel/syscalls/sys_wait.c
r506 r566 25 25 #include <hal_uspace.h> 26 26 #include <hal_irqmask.h> 27 #include <remote_queuelock.h> 27 28 #include <core.h> 28 29 #include <thread.h> … … 95 96 xptr_t children_lock_xp = XPTR( owner_cxy , &process->children_lock ); 96 97 97 // exit this blockingloop only when a child processes change state98 // exit this loop only when a child processes change state 98 99 while( 1 ) 99 100 { … … 102 103 103 104 // get lock protecting children list 104 remote_ spinlock_lock( children_lock_xp );105 remote_queuelock_acquire( children_lock_xp ); 105 106 106 107 // scan the list of child process … … 113 114 114 115 // get PID, term_state, and main thread from child process 115 child_pid = hal_remote_l w(XPTR( child_cxy , &child_ptr->pid ));116 child_state = hal_remote_l w( XPTR(child_cxy , &child_ptr->term_state ) );116 child_pid = hal_remote_l32 (XPTR( child_cxy , &child_ptr->pid )); 117 child_state = hal_remote_l32 ( XPTR(child_cxy , &child_ptr->term_state ) ); 117 118 child_thread = hal_remote_lpt(XPTR( child_cxy , &child_ptr->th_tbl[0] )); 118 119 119 #if (DEBUG_SYS_WAIT & 1)120 #if (DEBUG_SYS_WAIT & 1) 120 121 cycle = hal_get_cycles(); 121 122 if( DEBUG_SYS_WAIT < cycle ) … … 130 131 ((child_state & PROCESS_TERM_WAIT) == 0) ) 131 132 { 132 // set the PROCESS_ FLAG_WAIT in child process descriptor133 // set the PROCESS_TERM_WAIT in child process descriptor 133 134 hal_remote_atomic_or( XPTR( child_cxy , &child_ptr->term_state ), 134 135 PROCESS_TERM_WAIT ); … … 140 141 141 142 // release lock protecting children list 142 remote_ spinlock_unlock( children_lock_xp );143 remote_queuelock_release( children_lock_xp ); 143 144 144 145 #if DEBUG_SYS_WAIT … … 163 164 } // end loop on children 164 165 166 // we execute this code when no child terminated: 167 // - release the lock protecting children list, 168 // - block on the WAIT condition 169 // - deschedule to keep waiting in the while loop 170 171 // release lock protecting children list 172 remote_queuelock_release( children_lock_xp ); 173 165 174 // block on WAIT condition 166 175 thread_block( XPTR( local_cxy , this ) , THREAD_BLOCKED_WAIT ); 167 168 // release lock protecting children list169 remote_spinlock_unlock( children_lock_xp );170 176 171 177 #if (DEBUG_SYS_WAIT & 1) -
trunk/kernel/syscalls/sys_write.c
r492 r566 1 1 /* 2 * sys_write.c - write bytes to a file2 * sys_write.c - Kernel function implementing the "write" system call. 3 3 * 4 4 * Author Alain Greiner (2016,2017,2018) … … 29 29 #include <errno.h> 30 30 #include <vfs.h> 31 #include <vmm.h> 31 32 #include <thread.h> 32 33 #include <printk.h> 33 34 #include <process.h> 34 35 35 /* TODO: concurrent user page(s) unmap need to be handled [AG] */36 36 37 37 extern uint32_t enter_sys_write; … … 64 64 process_t * process = this->process; 65 65 66 #if (DEBUG_SYS_WRITE || CONFIG_INSTRUMENTATION_SYSCALLS) 67 uint64_t tm_start = hal_get_cycles(); 68 #endif 69 66 70 #if DEBUG_SYS_WRITE 67 uint32_t tm_start;68 uint32_t tm_end;69 71 tm_start = hal_get_cycles(); 70 72 if( DEBUG_SYS_WRITE < tm_start ) … … 123 125 124 126 // get file type 125 vfs_inode_type_t type = hal_remote_l w( XPTR( file_cxy , &file_ptr->type ) );127 vfs_inode_type_t type = hal_remote_l32( XPTR( file_cxy , &file_ptr->type ) ); 126 128 127 129 // enable IRQs … … 132 134 { 133 135 // check file writable 134 uint32_t attr = hal_remote_l w( XPTR( file_cxy , &file_ptr->attr ) );136 uint32_t attr = hal_remote_l32( XPTR( file_cxy , &file_ptr->attr ) ); 135 137 if( (attr & FD_ATTR_WRITE_ENABLE) == 0 ) 136 138 { … … 192 194 hal_fence(); 193 195 196 #if (DEBUG_SYS_WRITE || CONFIG_INSTRUMENTATION_SYSCALLS) 197 uint64_t tm_end = hal_get_cycles(); 198 #endif 199 194 200 #if DEBUG_SYS_WRITE 195 tm_end = hal_get_cycles();196 201 if( DEBUG_SYS_WRITE < tm_end ) 197 printk("\n[DBG] %s : thread %x in process %x exit / cycle %d / cost %d\n", 198 __FUNCTION__, this->trdid, process->pid, (uint32_t)tm_start, (uint32_t)(tm_end - tm_start) ); 199 #endif 200 202 printk("\n[DBG] %s : thread %x in process %x exit / cycle %d\n", 203 __FUNCTION__, this->trdid, process->pid, (uint32_t)tm_end ); 204 #endif 205 206 #if CONFIG_INSTRUMENTATION_SYSCALLS 207 hal_atomic_add( &syscalls_cumul_cost[SYS_WRITE] , tm_end - tm_start ); 208 hal_atomic_add( &syscalls_occurences[SYS_WRITE] , 1 ); 209 #endif 210 201 211 #if (DEBUG_SYS_WRITE & 1) 202 212 exit_sys_write = (uint32_t)tm_end; -
trunk/kernel/syscalls/syscalls.h
r527 r566 36 36 struct mmap_attr_s; // defined in vmm.h 37 37 38 // debug:39 const char * syscall_str( syscalls_t index );40 41 38 /****************************************************************************************** 42 39 * [0] This function terminates the execution of the calling user thread, … … 67 64 * on astructure containing the thread attributes, defined in thread.h file. 68 65 ****************************************************************************************** 69 * @ new_thread : [out] local pointer on created thread descriptor.66 * @ trdid_ptr : [out] pointer on buffer for created thread trdid. 70 67 * @ user_attr : [in] pointer on thread attributes structure. 71 68 * @ start_func : [in] pointer on start function. … … 73 70 * @ return 0 if success / return -1 if failure. 74 71 *****************************************************************************************/ 75 int sys_thread_create( 76 struct thread_s * new_thread, 77 const struct pthread_attr_s * user_attr, 78 const void * start_func, 79 const void * start_args ); 72 int sys_thread_create( trdid_t * trdid_ptr, 73 struct pthread_attr_s * user_attr, 74 void * start_func, 75 void * start_args ); 80 76 81 77 /****************************************************************************************** … … 133 129 /****************************************************************************************** 134 130 * [7] This function implement all operations on a POSIX condition variable. 135 * The kernel structure representing a cond _var is defined in the remote_cv.h file,136 * The code implementing the operations is defined in the remote_c v.c file.131 * The kernel structure representing a condvar is defined in the remote_condvar.h file, 132 * The code implementing the operations is defined in the remote_condvar.c file. 137 133 ****************************************************************************************** 138 134 * @ vaddr : condvar virtual address in user space == identifier. … … 205 201 * @ return file descriptor index in fd_array if success / return -1 if failure. 206 202 *****************************************************************************************/ 207 int sys_open( c onst char* pathname,203 int sys_open( char * pathname, 208 204 uint32_t flags, 209 205 uint32_t mode ); … … 280 276 * @ return 0 if success / returns -1 if failure. 281 277 *****************************************************************************************/ 282 int sys_unlink( c onst char * pathname );278 int sys_unlink( char * pathname ); 283 279 284 280 /****************************************************************************************** … … 299 295 * @ return 0 if success / returns -1 if failure. 300 296 *****************************************************************************************/ 301 int sys_chdir( c onst char * pathname );297 int sys_chdir( char * pathname ); 302 298 303 299 /****************************************************************************************** … … 387 383 * @ return 0 if success / returns -1 if failure. 388 384 *****************************************************************************************/ 389 int sys_rmdir( c onst char * pathname );385 int sys_rmdir( char * pathname ); 390 386 391 387 /****************************************************************************************** … … 408 404 * @ return 0 if success / returns -1 if failure. 409 405 *****************************************************************************************/ 410 int sys_chmod( c onst char* pathname,406 int sys_chmod( char * pathname, 411 407 uint32_t rights ); 412 408 … … 494 490 * @ does not return if success / returns -1 if failure. 495 491 *****************************************************************************************/ 496 int sys_exec( c onst char * filename,497 char 498 char 492 int sys_exec( char * filename, 493 char ** argv, 494 char ** envp ); 499 495 500 496 /****************************************************************************************** … … 506 502 * @ returns O if success / returns -1 if failure. 507 503 *****************************************************************************************/ 508 int sys_stat( c onst char* pathname,504 int sys_stat( char * pathname, 509 505 struct stat * stat ); 510 506 … … 538 534 * @ x_size : [out] number of clusters in a row. 539 535 * @ y_size : [out] number of clusters in a column. 540 * @ y_width : [out] number of bits in Y field for CXY.541 536 * @ ncores : [out] number of cores per cluster. 542 537 * @ return 0 if success / return -1 if illegal arguments … … 544 539 int sys_get_config( uint32_t * x_size, 545 540 uint32_t * y_size, 546 uint32_t * y_width,547 541 uint32_t * ncores ); 548 542
Note: See TracChangeset
for help on using the changeset viewer.