Ignore:
Timestamp:
Aug 2, 2018, 11:47:13 AM (6 years ago)
Author:
alain
Message:

This version modifies the exec syscall and fixes a large number of small bugs.
The version number has been updated (0.1)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/process.h

    r450 r457  
    2929#include <kernel_config.h>
    3030#include <errno.h>
    31 #include <hal_types.h>
     31#include <hal_kernel_types.h>
    3232#include <list.h>
    3333#include <xlist.h>
     
    146146
    147147    uint32_t          term_state;       /*! termination status (flags & exit status)        */
    148 
    149     bool_t            txt_owner;        /*! current TXT owner                               */
    150148}
    151149process_t;
     
    213211/*********************************************************************************************
    214212 * 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.
    223217 * The following fields are initialised :
    224218 * - It set the pid / ppid / ref_xp / parent_xp / state fields.
    225219 * - It initializes the VMM (register the kentry, args, envs vsegs in VSL)
    226220 * - 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.
    227224 * - It set the root_xp, bin_xp, cwd_xp fields.
    228225 * - It reset the children list as empty, but does NOT register it in parent children list.
     
    236233 * @ pid          : [in] process identifier.
    237234 * @ parent_xp    : [in] extended pointer on parent process descriptor.
    238  * @ model_xp     : [in] extended pointer on model process descriptor.
    239235 ********************************************************************************************/
    240236void process_reference_init( process_t * process,
    241237                             pid_t       pid,
    242                              xptr_t      parent_xp,
    243                              xptr_t      model_xp );
     238                             xptr_t      parent_xp );
    244239
    245240/*********************************************************************************************
     
    515510 * It is called only by the process_reference_init() function when creating a KSH process.
    516511 * 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.
    519513 *********************************************************************************************
    520514 * @ return TXT terminal index if succes / kernel panic if no terminal found.
     
    547541
    548542/*********************************************************************************************
    549  * This function gives to a process identified by the <owner_xp> argument, and attached
    550  * 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.
    552546 *********************************************************************************************
    553547 * @ owner_xp  : extended pointer on process descriptor in owner cluster.
    554548 ********************************************************************************************/
    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 of
     549void 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
    559553 * the TXT_RX terminal, this function transfer this ownership to another attached process.
    560554 * The process descriptor must be the process owner.
     
    565559 * - If there is no other attached process, the TXT has no more defined owner.
    566560 *********************************************************************************************
    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 ********************************************************************************************/
     563void 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 ********************************************************************************************/
     572uint32_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.
    577580 ********************************************************************************************/
    578581xptr_t process_txt_get_owner( uint32_t channel );
Note: See TracChangeset for help on using the changeset viewer.