Changeset 101 for trunk/kernel/kern/process.h
- Timestamp:
- Jun 29, 2017, 4:44:52 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/process.h
r23 r101 65 65 typedef struct fd_array_s 66 66 { 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 */ 70 70 } 71 71 fd_array_t; … … 136 136 137 137 /********************************************************************************************* 138 * This structure defines the minimal information required by the process_make_exec()139 * function to builda 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. 140 140 ********************************************************************************************/ 141 141 142 142 typedef struct exec_info_s 143 143 { 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 */ 153 147 char path[CONFIG_VFS_MAX_PATH_LENGTH]; /*! .elf file path */ 154 148 … … 180 174 void process_free( process_t * process ); 181 175 182 /*********************************************************************************************183 * This function initializes the kernel process_zero descriptor (global variable) from184 * 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 190 176 /********************************************************************************************* 191 177 * 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 ********************************************************************************************/ 196 188 void process_init_create(); 197 189 … … 202 194 * It set the pid / ppid / ref_xp fields. 203 195 * 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. 205 197 * - the local_list, rooted in the reference cluster manager. 206 198 * - the copies_list, rooted in the owner cluster manager. … … 209 201 * @ process : [in] pointer on process descriptor to initialize. 210 202 * @ pid : [in] process identifier defined by owner cluster. 211 * @ p pid : [in] parent process identifier.203 * @ parent_xp : [in] extended pointer on parent process. 212 204 ********************************************************************************************/ 213 205 void process_reference_init( process_t * process, 214 206 pid_t pid, 215 pid_t ppid);207 xptr_t parent_xp ); 216 208 217 209 /********************************************************************************************* … … 259 251 260 252 /********************************************************************************************* 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. 262 260 * 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 informations264 * found in the local exec_info structure, that must be build by the caller.265 261 * - It can be called by the process_init_create() function to build the "init" process. 266 262 * - 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.