Ignore:
Timestamp:
Jan 13, 2021, 12:36:17 AM (3 years ago)
Author:
alain
Message:

All modifications required to support the <tcp_chat> application
including error recovery in case of packet loss.A

File:
1 edited

Legend:

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

    r669 r683  
    9898 * This structure defines the information required by the process_make_exec() function
    9999 * to create a new reference process descriptor, and the associated main thread.
    100  * All fields in this structure are filled by the sys_exec() function, using the
    101  * process_exec_get_strings() function.
     100 * All fields in this structure are filled by the sys_exec() function.
    102101 *
    103102 * It contains three parts:
     
    106105 * - the "envs_pointers" & "envs_nr" fields define the env variables (one env == one string).
    107106 *
    108  * For both the arguments, and the environment variables, the array of pointers and the
    109  * strings themselve are stored in kernel space in the same kernel buffer containing
    110  * an integer number of pages, defined by CONFIG_VMM_ARGS_SIZE and CONFIG_VMM_ENVS_SIZE.
    111  * This aligned kernel buffer (one or several contiguous physical pages) contains :
     107 * For both the arguments and the environment variables, the array of pointers and the
     108 * strings themselve are stored in the same kernel buffer. These kernel buffers contain
     109 * an integer number of contiguous pages, defined by the CONFIG_VMM_ARGS_SIZE and
     110 * CONFIG_VMM_ENVS_SIZE parameters respectively.
     111 * Each kernel (args / envs) buffer contains :
    112112 * - in the first bytes, a fixed size kernel array of pointers on the strings.
    113113 * - in the following bytes, the strings themselves.
    114  * The size of these arrays of pointers is defined by CONFIG_PROCESS_ARGS_MAX_NR
    115  * and CONFIG¨PROCESS_ENVS_MAX_NR.
    116  *
    117  * WARNING: The "args_pointers" & "envs_pointers" kernel buffer are directly mapped to
    118  *          the "args" and "envs" user vsegs to be accessed by the user process.
    119  *          Therefore, the arrays of pointers build by the sys_exec() function contain
    120  *          kernel pointers, but the process_make_exec() function replace these pointers
    121  *          by user pointers in the new process user space.
     114 * The size of these arrays of pointers is defined by the CONFIG_PROCESS_ARGS_MAX_NR and
     115 * CONFIG_PROCESS_ENVS_MAX_NR parameters respectively.
     116 *
     117 * WARNING (1) The "args_pointers[i]" & "envs_pointers[i] stored in the dynamically
     118 *             allocated kernel buffers are local pointers. They must be extended by the
     119 *             local cluster identifier to compute a valid PPN.
     120 * WARNING (2) The "args" & "envs" kernel buffers will be mapped to the "args" and "envs"
     121 *             user vsegs, to be accessed by the new user process.
     122 *             The process_make_exec() function must therefore replace the kernel pointers
     123 *             set by sys_exec(), by user pointers in the new process user space.
    122124 ********************************************************************************************/
    123125
     
    232234 * The process GPT is initialised as required by the target architecture.
    233235 * The "kcode" and "kdata" segments are registered in the process VSL.
     236 * This function does not return an error code: in case of failure, it print a PANIC message
     237 * on kernel terminal TXT0, and the core goes to sleep mode.
    234238 *********************************************************************************************
    235239 * @ process  : [in] pointer on process descriptor to initialize.
     
    241245/*********************************************************************************************
    242246 * This function allocates memory and initializes the "process_init" descriptor and the
    243  * associated "thread_init" descriptor. It is called once at the end of the kernel
    244  * initialisation procedure. Its local process identifier is 1, and parent process
    245  * is the kernel process in cluster 0.
     247 * associated "thread_init" descriptor. It is called once at the end of the kernel_init()
     248 * procedure. Its local process identifier is 1, and parent process is the kernel process.
    246249 * The "process_init" is the first user process, and all other user processes will be forked
    247250 * from this process. The code executed by "process_init" is stored in a .elf file, whose
    248251 * pathname is defined by the CONFIG_PROCESS_INIT_PATH configuration variable.
    249  * The process_init does not use the [STDIN/STDOUT/STDERR] streams, but it is linked
    250  * to kernel TXT0, because these streams must be defined for all user processes.
     252 * This function does not return an error code: in case of failure, it print a PANIC message
     253 * on kernel terminal TXT0, and the core goes to sleep mode.
    251254 ********************************************************************************************/
    252255void process_init_create( void );
     
    415418
    416419/*********************************************************************************************
    417  * This function is called twice by the sys_exec() function :
    418  * - to register the main() arguments (args) in the process <exec_info> structure.
    419  * - to register the environment variables (envs) in the <exec_info> structure.
    420  * In both cases the input is an array of NULL terminated string pointers in user space,
    421  * identified by the <u_pointers> argument. The strings can be dispatched anywhere in
    422  * the calling user process space. The max number of envs, and the max number of args are
    423  * defined by the CONFIG_PROCESS_ARGS_NR and CONFIG_PROCESS_ENVS_MAX_NR parameters.
    424  *********************************************************************************************
    425  * Implementation Note:
    426  * Both the array of pointers and the strings themselve are stored in kernel space in one
    427  * single, dynamically allocated, kernel buffer containing an integer number of pages,
    428  * defined by the CONFIG_VMM_ENVS_SIZE and CONFIG_VMM_STACK_SIZE parameters.
    429  * This aligned kernel buffer (one or several contiguous physical pages) contains :
    430  * - in the first bytes a fixed size kernel array of kernel pointers on the strings.
    431  * - in the following bytes the strings themselves.
    432  * All the pointers, and the actual number of strings are stored in the process exec_info
    433  * structure defined in the <process.h> file.
    434  *********************************************************************************************
    435  * @ is_args     : [in]    true if called for (args) / false if called for (envs).
    436  * @ u_pointers  : [in]    array of pointers on the strings (in user space).
    437  * @ exec_info   : [inout] pointer on the exec_info structure.
    438  * @ return 0 if success / non-zero if too many strings or no memory.
    439  ********************************************************************************************/
    440 error_t process_exec_get_strings( bool_t         is_args,
    441                                   char        ** u_pointers,
    442                                   exec_info_t  * exec_info );
    443 
    444 /*********************************************************************************************
    445420 * This function implements the "execve" system call, and is called by sys_exec() function.
    446421 * It must be called by the main thread of the calling "old" process.
     
    595570 * @ dst_xp   : extended pointer on the source process descriptor (in owner cluster).
    596571 * @ src_xp   : extended pointer on the destination process descriptor (in owner cluster).
    597  ********************************************************************************************/
    598 void process_fd_replicate( xptr_t dst_xp,
    599                            xptr_t src_xp );
     572 * @ return 0 if success / return -1 if failure
     573 ********************************************************************************************/
     574error_t process_fd_replicate( xptr_t dst_xp,
     575                              xptr_t src_xp );
    600576
    601577/*********************************************************************************************
     
    617593 ********************************************************************************************/
    618594void process_fd_display( xptr_t process_xp );
     595
     596/*********************************************************************************************
     597 * This utility function builds in the buffer defined by the <buffer> and <size> arguments
     598 * a printable string describing the current state of a process descriptor identified
     599 * by the <process_xp> argument, or a WARNING message if the buffer size is too small.
     600 *********************************************************************************************
     601 * @ process_xp  : extended pointer on target process descriptor.
     602 * @ buffer      : kernel buffer for string.
     603 * @ size        : buffer size in bytes.
     604 * @ return always the string length (not including NUL), that can be a warning message.
     605 ********************************************************************************************/
     606uint32_t process_build_string( xptr_t   process_xp,
     607                               char   * buffer,
     608                               uint32_t size );
    619609
    620610/********************   Thread Related Operations   *****************************************/
Note: See TracChangeset for help on using the changeset viewer.