Ignore:
Timestamp:
Nov 7, 2017, 3:08:12 PM (5 years ago)
Author:
alain
Message:

First implementation of fork/exec.

File:
1 edited

Legend:

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

    r204 r407  
    143143{
    144144    xptr_t             parent_xp;      /*! extended pointer on parent process descriptor    */
     145    bool_t             keep_pid;       /*! keep parent PID if true / new PID if false       */
    145146
    146147    char               path[CONFIG_VFS_MAX_PATH_LENGTH];   /*!  .elf file path              */
     
    175176/*********************************************************************************************
    176177 * This function allocates memory and initializes the "process_init" descriptor and the
    177  * associated "thread_init" descriptor. It should be called once at the end of the kernel
    178  * initialisation procedure, by the kernel "process_zero".
     178 * associated "thread_init" descriptor in the local cluster. It is called once at the end
     179 * of the kernel initialisation procedure, by the local kernel process.
    179180 * The "process_init" is the first user process, and all other user processes will be forked
    180181 * from this process. The code executed by "process_init" is stored in a .elf file, whose
    181  * pathname is defined by the CONFIG_PROCESS_INIT_PATH argument. It uses fork/exec syscalls
    182  * to create the "shell" user process, and various other user daemon processes.
    183  * Practically, it builds the exec_info structure, registers the stdin / stdout / stderr
    184  * pseudo-file descriptors and the vfs_root and vfs_cwd in parent process_zero, and calls
    185  * the generic process_make_exec() function, that makes the real job.
     182 * pathname is defined by the CONFIG_PROCESS_INIT_PATH argument.
     183 * Practically, it builds the exec_info structure, and calls the process_make_exec()
     184 * function, that make the real job.
    186185 ********************************************************************************************/
    187186void process_init_create();
     
    253252 * and the associated main thread, from information found in the <exec_info> structure
    254253 * (defined in the process.h file), that must be built by the caller.
     254 * - If the <keep_pid> field is true, the new process inherits its PID from the parent PID.
     255 * - If the <keep_pid> field is false, a new PID is allocated from the local cluster manager.
    255256 * The new process inherits from the parent process (i) the open file descriptors, (ii) the
    256257 * vfs_root and the vfs_cwd inodes.
     
    268269
    269270
    270 /********************   Signal Management Operations   **************************************/
    271 
    272 /*********************************************************************************************
    273  * This function TODO [AG]
    274  ********************************************************************************************/
    275 void process_signal_handler( process_t * process );
    276 
    277 
    278271/********************   File Management Operations   ****************************************/
    279272
     
    287280/*********************************************************************************************
    288281 * This function uses as many remote accesses as required, to reset an entry in fd_array[],
    289  * in all clusters containing a copy. The entry is identified by the <file_id> argument.
     282 * in all clusters containing a copy. The entry is identified by the <fdid> argument.
    290283 * This function must be executed by a thread running reference cluster, that contains
    291284 * the complete list of process descriptors copies.
    292285 *********************************************************************************************
    293286 * @ process  : pointer on the local process descriptor.
    294  * @ file_id  : file descriptor index in the fd_array.
     287 * @ fdid     : file descriptor index in the fd_array.
    295288 ********************************************************************************************/
    296289void process_fd_remove( process_t * process,
    297                         uint32_t    file_id );
     290                        uint32_t    fdid );
    298291
    299292/*********************************************************************************************
     
    306299 *********************************************************************************************
    307300 * @ process  : pointer on the local process descriptor.
    308  * @ file_id  : file descriptor index in the fd_array.
     301 * @ fdid     : file descriptor index in the fd_array.
    309302 * @ return extended pointer on file descriptor if success / return XPTR_NULL if not found.
    310303 ********************************************************************************************/
    311304xptr_t process_fd_get_xptr( process_t * process,
    312                             uint32_t    file_id );
     305                            uint32_t    fdid );
    313306
    314307/*********************************************************************************************
     
    328321 *********************************************************************************************
    329322 * @ file_xp  : extended pointer on the file descriptor to be registered.
    330  * @ file_id  : [out] buffer for fd_array slot index.
     323 * @ fdid     : [out] buffer for fd_array slot index.
    331324 * @ return 0 if success / return EMFILE if array full.
    332325 ********************************************************************************************/
    333 error_t process_fd_register( xptr_t      file_xp,
    334                              uint32_t  * file_id );
     326error_t process_fd_register( process_t * process,
     327                             xptr_t      file_xp,
     328                             uint32_t  * fdid );
    335329
    336330/*********************************************************************************************
Note: See TracChangeset for help on using the changeset viewer.