Changeset 457 for trunk/kernel/kern/process.h
- Timestamp:
- Aug 2, 2018, 11:47:13 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/process.h
r450 r457 29 29 #include <kernel_config.h> 30 30 #include <errno.h> 31 #include <hal_ types.h>31 #include <hal_kernel_types.h> 32 32 #include <list.h> 33 33 #include <xlist.h> … … 146 146 147 147 uint32_t term_state; /*! termination status (flags & exit status) */ 148 149 bool_t txt_owner; /*! current TXT owner */150 148 } 151 149 process_t; … … 213 211 /********************************************************************************************* 214 212 * This function initializes a local, reference, user process descriptor from another process 215 * descriptor, defined by the <model_xp> argument. The <process> and <pid> arguments must 216 * be previously allocated by he caller. This function can be called by three functions: 217 * 1) process_init_create() : process is the reference INIT process / pid = 1 / 218 * the parent and model process descriptors are both the kernel process_zero. 219 * 2) process_make_fork() : the model process descriptor is the (generally remote) 220 * parent process. 221 * 3) process_make exec() : the model process is the local old_process, the new_process 222 * parent is the same as the old_process parent. 213 * descriptor, defined by the <parent_xp> argument. The <process> and <pid> arguments must 214 * be previously allocated by the caller. This function can be called by two functions: 215 * 1) process_init_create() : process is the INIT process; parent is process-zero. 216 * 2) process_make_fork() : the parent process descriptor is generally remote. 223 217 * The following fields are initialised : 224 218 * - It set the pid / ppid / ref_xp / parent_xp / state fields. 225 219 * - It initializes the VMM (register the kentry, args, envs vsegs in VSL) 226 220 * - It initializes the FDT, defining the three pseudo files STDIN / STDOUT / STDERR. 221 * . if INIT process => link to kernel TXT[0]. 222 * . if KSH[i] process => allocate a free TXT[i] and give TXT ownership. 223 * . if USER process => same TXT[i] as parent process and give TXT ownership. 227 224 * - It set the root_xp, bin_xp, cwd_xp fields. 228 225 * - It reset the children list as empty, but does NOT register it in parent children list. … … 236 233 * @ pid : [in] process identifier. 237 234 * @ parent_xp : [in] extended pointer on parent process descriptor. 238 * @ model_xp : [in] extended pointer on model process descriptor.239 235 ********************************************************************************************/ 240 236 void process_reference_init( process_t * process, 241 237 pid_t pid, 242 xptr_t parent_xp, 243 xptr_t model_xp ); 238 xptr_t parent_xp ); 244 239 245 240 /********************************************************************************************* … … 515 510 * It is called only by the process_reference_init() function when creating a KSH process. 516 511 * It makes a kernel panic if no free TXT terminal is found. 517 * The allocated TXT terminal is only released if the KSH process is deleted, 518 * which is a rare and abnormal event. 512 * The allocated TXT terminal is only released when the KSH process is deleted. 519 513 ********************************************************************************************* 520 514 * @ return TXT terminal index if succes / kernel panic if no terminal found. … … 547 541 548 542 /********************************************************************************************* 549 * This function gives t o a process identified by the <owner_xp> argument, and attached550 * to terminal TXT[i] the exclusive ownership of the TXT_RX[i] terminal.551 * The process descriptor must be in the process owner cluster.543 * This function gives the TXT ownership to a process identified by the <process_xp> argument. 544 * It can be called by a thread running in any cluster, but the <process_xp> must be the 545 * owner cluster process descriptor. 552 546 ********************************************************************************************* 553 547 * @ owner_xp : extended pointer on process descriptor in owner cluster. 554 548 ********************************************************************************************/ 555 void process_txt_set_ownership( xptr_t owner_xp );556 557 /********************************************************************************************* 558 * When the process dentified by the <owner_xp> argument has the exclusive ownership of549 void process_txt_set_ownership( xptr_t process_xp ); 550 551 /********************************************************************************************* 552 * When the process identified by the <owner_xp> argument has the exclusive ownership of 559 553 * the TXT_RX terminal, this function transfer this ownership to another attached process. 560 554 * The process descriptor must be the process owner. … … 565 559 * - If there is no other attached process, the TXT has no more defined owner. 566 560 ********************************************************************************************* 567 * @ owner_xp : extended pointer on process descriptor in owner cluster. 568 ********************************************************************************************/ 569 void process_txt_transfer_ownership( xptr_t owner_xp ); 570 571 /********************************************************************************************* 572 * This function returns the TXT owner process (foreground process) 573 * for a given TXT terminal identified by its <channel> index. 574 ********************************************************************************************* 575 * @ channel : TXT terminal channel. 576 * @ return extentded pointer on TXT owner process in owner cluster. 561 * @ process_xp : extended pointer on process descriptor in owner cluster. 562 ********************************************************************************************/ 563 void process_txt_transfer_ownership( xptr_t process_xp ); 564 565 /********************************************************************************************* 566 * This function returns true if the process identified by the <process_xp> argument 567 * is the TXT owner. It can be called by a thread running in any cluster, but the 568 * process_xp must be the owner cluster process descriptor. 569 ********************************************************************************************* 570 * @ return a non-zero value if target process is TXT owner. 571 ********************************************************************************************/ 572 uint32_t process_txt_is_owner( xptr_t process_xp ); 573 574 /********************************************************************************************* 575 * This function returns an extended ponter on the current TXT owner process, 576 * for the TXT terminal identified by the <channel> index. 577 ********************************************************************************************* 578 * @ channel : TXT channel. 579 * @ return extended pointer on TXT owner process. 577 580 ********************************************************************************************/ 578 581 xptr_t process_txt_get_owner( uint32_t channel );
Note: See TracChangeset
for help on using the changeset viewer.