Changeset 433 for trunk/kernel/kern/process.h
- Timestamp:
- Feb 14, 2018, 3:40:19 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/process.h
r428 r433 4 4 * Authors Ghassan Almaless (2008,2009,2010,2011,2012) 5 5 * Mohamed Lamine Karaoui (2015) 6 * Alain Greiner (2016,2017 )6 * Alain Greiner (2016,2017,2018) 7 7 * 8 8 * Copyright (c) UPMC Sorbonne Universites … … 65 65 66 66 /********************************************************************************************* 67 * This enum defines the process states for ALMOS_MKH. 68 ********************************************************************************************/ 69 70 enum process_states 71 { 72 PROCESS_STATE_RUNNING = 0, /*! process is executing */ 73 PROCESS_STATE_STOPPED = 1, /*! process has been stopped by a signal */ 74 PROCESS_STATE_KILLED = 2, /*! process has been killed by a signal */ 75 PROCESS_STATE_EXITED = 3, /*! process terminated with an exit */ 76 }; 67 * The termination state is a 32 bits word: 68 * - the 8 LSB bits contain the user defined exit status 69 * - the 24 other bits contain the flags defined below 70 ********************************************************************************************/ 71 72 #define PROCESS_FLAG_BLOCK 0x100 /*! process received as SIGSTOP signal */ 73 #define PROCESS_FLAG_KILL 0x200 /*! process terminated by a sys_kill() */ 74 #define PROCESS_FLAG_EXIT 0x400 /*! process terminated by a sys_exit() */ 75 #define PROCESS_FLAG_WAIT 0x800 /*! parent process executed successfully a sys_wait() */ 77 76 78 77 /********************************************************************************************* … … 118 117 * 6) The <local_list>, <copies_list>, <th_tbl>, <th_nr>, <th_lock> fields 119 118 * are defined in all process descriptors copies. 119 * 7) The termination <flags> and <exit_status> are only defined in the reference cluster. 120 120 ********************************************************************************************/ 121 121 … … 155 155 remote_spinlock_t sync_lock; /*! lock protecting sem,mutex,barrier,condvar lists */ 156 156 157 uint32_t state; /*! RUNNING / STOPPED / KILLED / EXITED*/157 uint32_t term_state; /*! termination status (flags & exit status) */ 158 158 159 159 bool_t txt_owner; /*! current TXT owner */ … … 168 168 typedef struct exec_info_s 169 169 { 170 pid_t pid; /*! process identifier (both parent and child) */171 172 170 char path[CONFIG_VFS_MAX_PATH_LENGTH]; /*! .elf file path */ 173 171 … … 276 274 277 275 /********************************************************************************************* 278 * This function returns a printable string defining the process state.279 *********************************************************************************************280 * @ state : RUNNING / BLOCKED / EXITED / KILLED281 * @ return a string pointer.282 ********************************************************************************************/283 char * process_state_str( uint32_t state );284 285 /*********************************************************************************************286 276 * This debug function diplays on the kernel terminal TXT0 detailed informations on a 287 277 * reference process identified by the <process_xp> argument. … … 324 314 325 315 /********************************************************************************************* 326 * This function blocks all threads (but the client thread defined by the <client_xp>327 * argument) for a given <process> in a given cluster.316 * This function blocks all threads for a given <process> in a given cluster. 317 * The calling thread cannot be a target thread. 328 318 * It loops on all local threads of the process, set the THREAD_BLOCKED_GLOBAL bit, 329 319 * and request the relevant schedulers to acknowledge the blocking, using IPI if required. … … 332 322 ********************************************************************************************* 333 323 * @ process : pointer on the target process descriptor. 334 * @ client_xp : extended pointer on the client thread, that should not be blocked. 335 ********************************************************************************************/ 336 void process_block_threads( process_t * process, 337 xptr_t client_xp ); 324 ********************************************************************************************/ 325 void process_block_threads( process_t * process ); 338 326 339 327 /********************************************************************************************* … … 345 333 346 334 /********************************************************************************************* 347 * This function delete all threads, (but the client thread defined by the <client_xp> 348 * argument) for a given <process> in a given cluster. 335 * This function marks for deletion all threads - but one _ for a given <process> 336 * in a given cluster. The main thread in owner cluster is NOT marked. 337 * It will be marked for deletion by the parent process sys_wait(). 338 * The calling thread cannot be a target thread. 349 339 * It loops on all local threads of the process, and set the THREAD_FLAG_REQ_DELETE bit. 350 340 * For each marked thread, the following actions will be done by the scheduler at the next … … 357 347 ********************************************************************************************* 358 348 * @ process : pointer on the process descriptor. 359 * @ client_xp : extended pointer on the client thread, that should not be deleted. 360 ********************************************************************************************/ 361 void process_delete_threads( process_t * process, 362 xptr_t client_xp ); 349 ********************************************************************************************/ 350 void process_delete_threads( process_t * process ); 363 351 364 352 /********************************************************************************************* … … 396 384 * associated "child" thread descriptor in the local cluster. This function can involve 397 385 * up to three different clusters : 398 * - the local (child) cluster can be any cluster defined by the sys_fork function.386 * - the child (local) cluster can be any cluster defined by the sys_fork function. 399 387 * - the parent cluster must be the reference cluster for the parent process. 400 388 * - the client cluster containing the thread requesting the fork can be any cluster. … … 416 404 417 405 /********************************************************************************************* 418 * This function implement the "exit" system call, and is called by the sys_exit() function. 419 * It must be executed by a thread running in the calling process owner cluster. 420 * It uses twice the multicast RPC_PROCESS_SIGNAL to first block all process threads 421 * in all clusters, and then delete all threads and process descriptors. 422 ********************************************************************************************* 423 * @ pid : process identifier. 424 * @ status : exit return value. 425 ********************************************************************************************/ 426 void process_make_exit( pid_t pid, 427 uint32_t status ); 428 429 /********************************************************************************************* 430 * This function implement the "kill" system call, and is called by the sys_kill() function. 431 * It must be executed by a thread running in the target process owner cluster. 432 * Only the SIGKILL, SIGSTOP, and SIGCONT signals are supported. 433 * User defined handlers are not supported. 434 * It uses once or twice the multicast RPC_PROCESS_SIGNAL to block, unblock or delete 435 * all process threads in all clusters, and then delete process descriptors. 436 ********************************************************************************************* 437 * @ pid : process identifier. 438 * @ sig_id : signal type. 439 ********************************************************************************************/ 440 void process_make_kill( pid_t pid, 441 uint32_t sig_id ); 406 * This function is called by both the sys_kill() and sys_exit() system calls. 407 * It must be executed by an RPC thread running in the target process owner cluster. 408 * It uses twice the process_sigaction() function: 409 * - first, to block all target process threads, in all clusters. 410 * - second, to delete all target process threads in all clusters. 411 * Finally, it synchronizes with the parent process sys_wait() function that MUST be called 412 * by the parent process main thread. 413 ********************************************************************************************* 414 * @ process : pointer on process descriptor in owner cluster. 415 * @ is_exit : true when called by sys_exit() / false when called by sys_kill(). 416 * @ exit_status : exit status, when called by sys_exit(). 417 ********************************************************************************************/ 418 void process_make_kill( process_t * process, 419 bool_t is_exit, 420 uint32_t exit_status ); 442 421 443 422
Note: See TracChangeset
for help on using the changeset viewer.