Ignore:
Timestamp:
Jun 29, 2017, 4:44:52 PM (7 years ago)
Author:
alain
Message:

euh...

File:
1 edited

Legend:

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

    r23 r101  
    6565typedef struct fd_array_s
    6666{
    67         remote_spinlock_t lock;             /*! lock protecting fd_array[] change.              */
    68     uint32_t          current;          /*! current number of open files                    */
    69         xptr_t            array[CONFIG_PROCESS_FILE_MAX_NR]; 
     67        remote_spinlock_t lock;                               /*! lock protecting fd_array      */
     68    uint32_t          current;                            /*! current number of open files  */
     69        xptr_t            array[CONFIG_PROCESS_FILE_MAX_NR];  /*! xptr on open file descriptors */
    7070}
    7171fd_array_t;
     
    136136
    137137/*********************************************************************************************
    138  * This structure defines the minimal information required by the process_make_exec()
    139  * function to build a new reference process descriptor, and the associated main thread.
     138 * This structure defines the information required by the process_make_exec() function
     139 * to create a new reference process descriptor, and the associated main thread.
    140140 ********************************************************************************************/
    141141
    142142typedef struct exec_info_s
    143143{
    144     pid_t              pid;            /*! process identifier                               */
    145     pid_t              ppid;           /*! parent process identifier                        */
    146 
    147     xptr_t             fd_array_xp;    /*! extended pointer on parent process fd_array      */
    148 
    149     xptr_t             vfs_root_xp;    /*! extended pointer on file system root             */
    150     xptr_t             vfs_cwd_xp;     /*! extended pointer on current working directory    */
    151     xptr_t             vfs_bin_xp;     /*! extended pointer on process .elf file            */
    152 
     144    xptr_t             parent_xp;      /*! extended pointer on parent process descriptor    */
     145
     146    xptr_t             stdin_xp;       /*! extended pointer on stdin  pseudo-file           */
    153147    char               path[CONFIG_VFS_MAX_PATH_LENGTH];   /*!  .elf file path              */
    154148
     
    180174void process_free( process_t * process );
    181175
    182 /*********************************************************************************************
    183  * This function initializes the kernel process_zero descriptor (global variable) from
    184  * informations found in the boot_info.
    185  *********************************************************************************************
    186  * @ info      : pointer on local boot_info_t structure.
    187  ********************************************************************************************/
    188 void process_zero_init( boot_info_t * info );
    189 
    190176/*********************************************************************************************
    191177 * This function allocates memory and initialises the "process_init" descriptor and the
    192  * associated thread descriptor from information found in the "process_zero" descriptor.
    193  *********************************************************************************************
    194  * Any error gives a kernel panic.
    195  ********************************************************************************************/
     178 * associated "thread_init" descriptor. It should be called once at the end of the kernel
     179 * initialisation procedure, by the kernel "process_zero".
     180 * The "process_init" is the first user process, and all other user process will be forked
     181 * from this process. The code executed by "process_init" is stored in a .elf file, whose
     182 * pathname is defined by the CONFIG_PROCESS_INIT_PATH argument. It use fork/exec syscalls
     183 * to create the "shell" user process, and various other user daemon processes.
     184 * Practically, it build the exec_info structure, register the stdin / stdout / stderr
     185 * pseudo-file descriptors and the vfs_root and vfs_cwd in parent process_zero, and call
     186 * the generic process_make_exec() function, that makes the real job.
     187 ********************************************************************************************/
    196188void process_init_create();
    197189
     
    202194 * It set the pid / ppid / ref_xp fields.
    203195 * It registers this process descriptor in three lists:
    204  * - the children_list in the parent process descriptor.
     196 * - the children_list in the parent reference process descriptor.
    205197 * - the local_list, rooted in the reference cluster manager.
    206198 * - the copies_list, rooted in the owner cluster manager.
     
    209201 * @ process      : [in] pointer on process descriptor to initialize.
    210202 * @ pid          : [in] process identifier defined by owner cluster.
    211  * @ ppid         : [in] parent process identifier.
     203 * @ parent_xp    : [in] extended pointer on parent process.
    212204 ********************************************************************************************/
    213205void process_reference_init( process_t * process,
    214206                             pid_t       pid,
    215                              pid_t       ppid );
     207                             xptr_t      parent_xp );
    216208
    217209/*********************************************************************************************
     
    259251
    260252/*********************************************************************************************
    261  * This function builds a new reference process descriptor and associated main thread.
     253 * This function allocates memory and initializes a new user process descriptor,
     254 * and the associated main thread, from informationd found in the <exec_info> structure
     255 * (defined in the process.h file), that must be build by the caller.
     256 * The new process inherit from the parent process (i) the open file descriptors, (ii) the
     257 * vfs_root and the vfs_cwd inodes.
     258 * It access to the .elf file to get the size of the code and data segments, and initialize
     259 * the vsegs list in the VMM.
    262260 * It is executed in the local cluster, that becomes both "owner" and "reference".
    263  * The new process descriptor and the main_thread are initialised using only informations
    264  * found in the local exec_info structure, that must be build by the caller.
    265261 * - It can be called by the process_init_create() function to build the "init" process.
    266262 * - It can be called directly by the sys_exec() function in case of local exec.
Note: See TracChangeset for help on using the changeset viewer.