Changeset 625 for trunk/kernel/kern/process.h
- Timestamp:
- Apr 10, 2019, 10:09:39 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/process.h
r623 r625 228 228 229 229 /********************************************************************************************* 230 * This function initializes a reference ,user process descriptor from another process230 * This function initializes a reference user process descriptor from another process 231 231 * descriptor, defined by the <parent_xp> argument. The <process> and <pid> arguments 232 232 * are previously allocated by the caller. This function can be called by two functions: 233 * 1) process_init_create() : process is the INIT process ;parent is process-zero.233 * 1) process_init_create() : process is the INIT process, and parent is process-zero. 234 234 * 2) process_make_fork() : the parent process descriptor is generally remote. 235 235 * The following fields are initialised : 236 236 * - It set the pid / ppid / ref_xp / parent_xp / state fields. 237 * - It initializes the VMM (register the kentry, args, envs vsegs in VSL) 237 * - It creates an empty GPT and an empty VSL. 238 * - It initializes the locks protecting the GPT and the VSL. 239 * - It registers the "kernel" vsegs in VSL, using the hal_vmm_kernel_update() function. 240 * - It registers the "args" and "envs" vsegs in VSL, using the vmm_user_init() function. 241 * - The "code and "data" must be registered later, using the elf_load_process() function. 238 242 * - It initializes the FDT, defining the three pseudo files STDIN / STDOUT / STDERR. 239 243 * . if INIT process => link to kernel TXT[0]. 240 * . if KSH[i] process => allocate a free TXT[i] and give TXT ownership.241 * . if USER process => same TXT[i] as parent process and give TXT ownership.244 * . if KSH[i] process => allocate a free TXT[i]. 245 * . if USER process => link to parent process TXT[i]. 242 246 * - It set the root_xp, bin_xp, cwd_xp fields. 243 247 * - It reset the children list as empty, but does NOT register it in parent children list. … … 251 255 * @ pid : [in] process identifier. 252 256 * @ parent_xp : [in] extended pointer on parent process descriptor. 253 ********************************************************************************************/ 254 void process_reference_init( process_t * process, 255 pid_t pid, 256 xptr_t parent_xp ); 257 * @ return 0 if success / return -1 if failure 258 ********************************************************************************************/ 259 error_t process_reference_init( process_t * process, 260 pid_t pid, 261 xptr_t parent_xp ); 257 262 258 263 /********************************************************************************************* 259 264 * This function initializes a copy process descriptor, in the local cluster, 260 265 * from information defined in the reference remote process descriptor. 266 * As the VSL and the GPT of a process copy are handled as local caches, the GPT copy is 267 * created empty, and the VSL copy contains only the "kernel", "args", and "envs" vsegs. 261 268 ********************************************************************************************* 262 269 * @ process : [in] local pointer on process descriptor to initialize. 263 270 * @ reference_process_xp : [in] extended pointer on reference process descriptor. 264 * @ return 0 if success / return ENOMEMif failure271 * @ return 0 if success / return -1 if failure 265 272 ********************************************************************************************/ 266 273 error_t process_copy_init( process_t * local_process, … … 272 279 * The local th_tbl[] array must be empty. 273 280 ********************************************************************************************* 274 * @ process : pointer on the process descriptor.281 * @ process : [in] pointer on the process descriptor. 275 282 ********************************************************************************************/ 276 283 void process_destroy( process_t * process ); … … 283 290 * taken by the caller function. 284 291 ********************************************************************************************* 285 * @ process_xp :extended pointer on process descriptor.292 * @ process_xp : [in] extended pointer on process descriptor. 286 293 ********************************************************************************************/ 287 294 void process_display( xptr_t process_xp ); … … 396 403 /********************************************************************************************* 397 404 * This function implements the "fork" system call, and is called by the sys_fork() function, 398 * likely throu ch the RPC_PROCESS_MAKE_FORK.399 * It allocates memory and initializes a new "child"process descriptor, and the associated400 * "child" thread descriptor in local cluster. It involves up to three different clusters:405 * likely through the RPC_PROCESS_MAKE_FORK. 406 * It allocates memory and initializes a new child process descriptor, and the associated 407 * child thread descriptor in local cluster. It involves up to three different clusters: 401 408 * - the child (local) cluster can be any cluster selected by the sys_fork function. 402 409 * - the parent cluster must be the reference cluster for the parent process. 403 410 * - the client cluster containing the thread requesting the fork can be any cluster. 404 * The new "child" process descriptor is initialised from informations found in the "parent"411 * The new child process descriptor is initialised from informations found in the parent 405 412 * reference process descriptor, containing the complete process description. 406 * The new "child" thread descriptor is initialised from informations found in the "parent"413 * The new child thread descriptor is initialised from informations found in the parent 407 414 * thread descriptor. 408 415 ********************************************************************************************* … … 504 511 505 512 /********************************************************************************************* 506 * This function atomically registers a new thread in the local process descriptor. 507 * It checks that there is an available slot in the local th_tbl[] array, and allocates 508 * a new LTID using the relevant lock depending on the kernel/user type. 509 ********************************************************************************************* 510 * @ process : pointer on the local process descriptor. 511 * @ thread : pointer on new thread to be registered. 513 * This function atomically registers a new thread identified by the <thread> argument 514 * in the th_tbl[] array of the local process descriptor identified by the <process> 515 * argument. It checks that there is an available slot in the local th_tbl[] array, 516 * and allocates a new LTID using the relevant lock depending on the kernel/user type, 517 * and returns the global thread identifier in the <trdid> buffer. 518 ********************************************************************************************* 519 * @ process : [in] pointer on the local process descriptor. 520 * @ thread : [in] pointer on new thread to be registered. 512 521 * @ trdid : [out] buffer for allocated trdid. 513 522 * @ returns 0 if success / returns non zero if no slot available. … … 516 525 struct thread_s * thread, 517 526 trdid_t * trdid ); 527 528 /********************************************************************************************* 529 * This function atomically removes a thread identified by the <thread> argument from 530 * the local process descriptor th_tbl[] array, and returns the number of thread currently 531 * registered in th_tbl[] array before this remove. 532 ********************************************************************************************* 533 * @ thread : pointer on thread to be removed. 534 * @ returns number of threads registered in th_tbl before thread remove. 535 ********************************************************************************************/ 536 uint32_t process_remove_thread( struct thread_s * thread ); 518 537 519 538 … … 556 575 557 576 /********************************************************************************************* 558 * This function gives a process identified by the <process_xp> argument the exclusive577 * This function gives a process identified by the <process_xp> argument the 559 578 * ownership of its attached TXT_RX terminal (i.e. put the process in foreground). 560 * It can be called by a thread running in any cluster, but the <process_xp> must be the561 * owner cluster process descriptor.579 * It can be called by a thread running in any cluster, but the target process descriptor 580 * must be the process owner. 562 581 ********************************************************************************************* 563 582 * @ owner_xp : extended pointer on process descriptor in owner cluster. … … 566 585 567 586 /********************************************************************************************* 568 * When the process identified by the <owner_xp> argument has the exclusive ownership of 569 * the TXT_RX terminal, this function transfer this ownership to another attached process. 570 * The process descriptor must be the process owner. 571 * This function does nothing if the process identified by the <process_xp> is not 572 * the TXT owner. 587 * When the target process identified by the <owner_xp> argument has the exclusive ownership 588 * of the TXT_RX terminal, this function transfer this ownership to another process attached 589 * to the same terminal. The target process descriptor must be the process owner. 590 * This function does nothing if the target process is not the TXT owner. 573 591 * - If the current owner is not the KSH process, the new owner is the KSH process. 574 592 * - If the current owner is the KSH process, the new owner is another attached process.
Note: See TracChangeset
for help on using the changeset viewer.