Changeset 457 for trunk/kernel/syscalls/sys_exec.c
- Timestamp:
- Aug 2, 2018, 11:47:13 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/sys_exec.c
r441 r457 23 23 24 24 #include <kernel_config.h> 25 #include <hal_ types.h>25 #include <hal_kernel_types.h> 26 26 #include <hal_uspace.h> 27 27 #include <errno.h> … … 152 152 // It build an exec_info_t structure containing all informations 153 153 // required to initialize the new process descriptor and the associated thread. 154 // It includes the process main() arguments, the environment variables,154 // It includes the new process main() arguments, the environment variables, 155 155 // and the pathname to the new process .elf file. 156 156 // It calls the process_exec_get_strings() functions to copy the main() arguments and 157 157 // the environment variables from user buffers to the exec_info_t structure, allocate 158 158 // and call the process_make_exec() function. 159 // As it must destroy all parent process copies, and all parent threads in all clusters, 160 // the process_make_exec() function must be executed in the parent owner cluster, 161 // and this sys_exec() function uses a RPC to access the owner cluster if required. 159 // As it must destroy all process copies, and all othert threads in all clusters, 160 // the process_make_exec() function must be executed in the owner cluster. 162 161 // 163 162 // TODO : the args & envs arguments are not supported yet : both must be NULL [AG] … … 187 186 "args not supported yet\n" ); 188 187 189 // get owner cluster190 191 188 // check pathname length 192 189 if( hal_strlen_from_uspace( pathname ) >= CONFIG_VFS_MAX_PATH_LENGTH ) … … 205 202 #if DEBUG_SYS_EXEC 206 203 uint64_t tm_start; 207 uint64_t tm_end;208 204 tm_start = hal_get_cycles(); 209 205 if( DEBUG_SYS_EXEC < tm_start ) 210 206 printk("\n[DBG] %s : thread %x in process %x enter for path <%s> / cycle = %d\n", 211 __FUNCTION__, this , pid, exec_info.path, (uint32_t)tm_start );207 __FUNCTION__, this->trdid, pid, exec_info.path, (uint32_t)tm_start ); 212 208 #endif 213 209 … … 220 216 #if DEBUG_SYSCALLS_ERROR 221 217 printk("\n[ERROR] in %s : thread %x in process %x cannot access args\n", 222 __FUNCTION__ , this , pid );218 __FUNCTION__ , this->trdid, pid ); 223 219 #endif 224 220 this->errno = EINVAL; … … 235 231 #if DEBUG_SYCALLS_ERROR 236 232 printk("\n[ERROR] in %s : thread %x in process %x cannot access envs\n", 237 __FUNCTION__ , this , pid );233 __FUNCTION__ , this->trdid, pid ); 238 234 #endif 239 235 this->errno = EINVAL; … … 250 246 #if DEBUG_SYSCALLS_ERROR 251 247 printk("\n[ERROR] in %s : thread %x in process %x cannot create process for <%s>\n", 252 __FUNCTION__, this , pid, exec_info.path );248 __FUNCTION__, this->trdid, pid, exec_info.path ); 253 249 #endif 254 250 this->errno = error; … … 256 252 } 257 253 258 #if DEBUG_SYS_EXEC 259 tm_end = hal_get_cycles(); 260 if( DEBUG_SYS_EXEC < tm_end ) 261 printk("\n[DBG] %s : thread %x in process %x exit / cost = %d / cycle %d\n", 262 __FUNCTION__, this, pid, (uint32_t)(tm_end - tm_start), (uint32_t)tm_end ); 263 #endif 264 265 // In case of success, this calling thread deschedules, causing suicide, 266 // because a new process descriptor and its associated main thread 267 // have been created by the process_make_exec() function, and the 268 // BLOCKED_GLOBAL & FLAG_REQ_DELETE bits have been set for the calling thread. 269 sched_yield( "old process suicide in sys_exec()" ); 254 assert( false , __FUNCTION__, "we should not execute this code" ); 270 255 271 256 return 0;
Note: See TracChangeset
for help on using the changeset viewer.