Ignore:
Timestamp:
Dec 20, 2017, 4:51:09 PM (4 years ago)
Author:
alain
Message:

Fix bugs in exec

File:
1 edited

Legend:

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

    r408 r409  
    3232#include <vseg.h>
    3333#include <remote_fifo.h>
     34#include <signal.h>
    3435
    3536/**** Forward declarations ****/
     
    6061{
    6162    RPC_PMEM_GET_PAGES         = 0,
    62     RPC_PROCESS_MAKE_EXEC      = 1,     
    63     RPC_PROCESS_MAKE_FORK      = 2,
    64     RPC_PROCESS_KILL           = 3,
    65     RPC_THREAD_USER_CREATE     = 4,
    66     RPC_THREAD_KERNEL_CREATE   = 5,
    67     RPC_SIGNAL_RISE            = 6,
     63    RPC_PMEM_RELEASE_PAGES     = 1,
     64    RPC_PROCESS_MAKE_EXEC      = 2,     
     65    RPC_PROCESS_MAKE_FORK      = 3,
     66    RPC_PROCESS_MAKE_EXIT      = 4,
     67    RPC_PROCESS_MAKE_KILL      = 5,
     68    RPC_THREAD_USER_CREATE     = 6,
     69    RPC_THREAD_KERNEL_CREATE   = 7,
     70    RPC_THREAD_KILL            = 8,
     71    RPC_PROCESS_SIGACTION      = 9,
    6872
    6973    RPC_VFS_INODE_CREATE       = 10,
     
    8690    RPC_SCHED_DISPLAY          = 27,
    8791    RPC_VMM_SET_COW            = 28,
     92
    8893    RPC_MAX_INDEX              = 30,
    8994}
     
    116121
    117122/***********************************************************************************
    118  * This blocking function executes on the client core.
    119  * It puts one RPC extended pointer in the remote fifo.
    120  * It sends an IPI if fifo is empty, and waits until RPC response available.
    121  * The RPC descriptor must be allocated in the caller's stack
    122  * and initialised by the caller.  Exit with a Panic message if remote fifo
    123  * is still full after (CONFIG_RPC_PUT_MAX_ITERATIONS) retries.
     123 * This function is executed by the client thread in the client cluster.
     124 * It puts one RPC descriptor defined by the <desc> argument in the remote fifo
     125 * defined by the <cxy> argument.  It sends an IPI to the server if fifo is empty.
     126 * The RPC descriptor must be allocated in the caller's stack, and initialised by
     127 * the caller. It exit with a Panic message if remote fifo is still full after
     128 * (CONFIG_RPC_PUT_MAX_ITERATIONS) retries.
     129 * - When the <block> argument is true, this function blocks and deschedule.
     130 *   It returns only when the server acknowledges the RPC by writing in the RPC
     131 *   "response" field, and unblocks the client.
     132 * - When the <block> argument is false, this function returns as soon as the RPC
     133 *   has been registered in the FIFO, and the server thread must directly signal
     134 *   completion to the client thread.
    124135 ***********************************************************************************
    125136 * @ cxy   : server cluster identifier
    126137 * @ desc  : local pointer on RPC descriptor in client cluster
    127  **********************************************************************************/
    128 void rpc_send_sync( cxy_t        cxy,   
    129                     rpc_desc_t * desc );
     138 * @ block : boolean true when blocking behaviour is required.
     139 **********************************************************************************/
     140void rpc_send( cxy_t        cxy,   
     141               rpc_desc_t * desc,
     142               bool_t       block );
    130143
    131144
     
    186199
    187200/***********************************************************************************
    188  * [1] The RPC_PROCESS_MAKE_EXEC creates a new process descriptor, from an existing
     201 * [1] The RPC_PMEM_RELEASE_PAGES release one or several pages to a remote cluster.
     202 ***********************************************************************************
     203 * @ cxy     : server cluster identifier
     204 * @ page    : [in] local pointer on page descriptor to release.
     205 **********************************************************************************/
     206void rpc_pmem_release_pages_client( cxy_t            cxy,
     207                                    struct page_s  * page );
     208
     209void rpc_pmem_release_pages_server( xptr_t xp );
     210
     211/***********************************************************************************
     212 * [2] The RPC_PROCESS_MAKE_EXEC creates a new process descriptor, from an existing
    189213 * process descriptor in a remote server cluster. This server cluster must be
    190214 * the owner cluster for the existing process. The new process descriptor is
     
    204228
    205229/***********************************************************************************
    206  * [2] The RPC_PROCESS_MAKE_FORK creates a "child" process descriptor, and the
     230 * [3] The RPC_PROCESS_MAKE_FORK creates a "child" process descriptor, and the
    207231 * associated "child" thread descriptor in a target remote cluster that can be
    208232 * any cluster.  The child process is initialized from informations found in the
     
    227251
    228252/***********************************************************************************
    229  * [3] The RPC_PROCESS_KILL is actually a multicast RPC sent by the reference cluster
    230  * to other clusters containing a process descriptor copy, to destroy these copies.
    231  ***********************************************************************************
    232  * @ process  : local pointer on target process.
    233  **********************************************************************************/
    234 void rpc_process_kill_client( struct process_s * process );
    235 
    236 void rpc_process_kill_server( xptr_t xp );
    237 
    238 /***********************************************************************************
    239  * [4] The RPC_THREAD_USER_CREATE creates an user thread in the server cluster,
     253 * [4] The RPC_PROCESS_MAKE_EXIT can be called by any thread to request the owner
     254 * cluster to execute the process_make_exit() function for a calling process.
     255 ***********************************************************************************
     256 * @ cxy      : server cluster identifier.
     257 * @ process  : local pointer on calling process in owner cluster.
     258 * @ status   : calling process exit status.
     259 **********************************************************************************/
     260void rpc_process_make_exit_client( cxy_t              cxy,
     261                                   struct process_s * process,
     262                                   uint32_t           status );
     263
     264void rpc_process_make_exit_server( xptr_t xp );
     265
     266/***********************************************************************************
     267 * [5] The RPC_PROCESS_MAKE_KILL can be called by any thread to request the owner
     268 * cluster to execute the process_make_kill() function for a target process.
     269 ***********************************************************************************
     270 * @ cxy      : server cluster identifier.
     271 * @ process  : local pointer on target process in owner cluster.
     272 * @ seg_id   : signal type (only SIGKILL / SIGSTOP / SIGCONT are supported).
     273 **********************************************************************************/
     274void rpc_process_make_kill_client( cxy_t              cxy,
     275                                   struct process_s * process,
     276                                   uint32_t           seg_id );
     277
     278void rpc_process_make_kill_server( xptr_t xp );
     279
     280/***********************************************************************************
     281 * [6] The RPC_THREAD_USER_CREATE creates an user thread in the server cluster,
    240282 * as specified by the arguments. It returns an extended pointer on the new
    241283 * thread descriptor in server cluster, and an error code.
     
    258300
    259301/***********************************************************************************
    260  * [5] The RPC_THREAD_KERNEL_CREATE creates a kernel thread in the server cluster,
     302 * [7] The RPC_THREAD_KERNEL_CREATE creates a kernel thread in the server cluster,
    261303 * as specified by the type, func and args arguments. It returns the local pointer
    262304 * on the thread descriptor in server cluster and an error code.
     
    280322
    281323/***********************************************************************************
    282  * [6] The RPC_SIGNAL_RISE ask a target cluster to register a given signal in
    283  * all threads descriptors of a given process.
    284  * It is used by the sys_kill() function.
     324 * [8] The RPC_THREAD_KILL ask a target cluster to kill a given thread descriptor.
     325 * It is called by the sys_thread_cancel() function for a remote thread.
    285326 ***********************************************************************************
    286327 * @ cxy       : server cluster identifier.
    287  * @ process   : [in]  local pointer on target process descriptor in server.
    288  * @ sig_id    : [in]  signal index.
    289  **********************************************************************************/
    290 void rpc_signal_rise_client( cxy_t              cxy,
    291                              struct process_s * process,
    292                              uint32_t           sig_id );
     328 * @ thread   : [in]  local pointer on target process descriptor in server.
     329 **********************************************************************************/
     330void rpc_thread_kill_client( cxy_t              cxy,
     331                             struct thread_s  * thread );
    293332                             
    294 void rpc_signal_rise_server( xptr_t xp );
     333void rpc_thread_kill_server( xptr_t xp );
     334
     335/***********************************************************************************
     336 * [9] The RPC_PROCESS_SIGACTION allows the owner cluster to request any other
     337 * cluster to execute a given sigaction (BLOCK / UNBLOCK / DELETE) for all threads
     338 * of a given process.
     339 *
     340 * WARNING : It is implemented as a NON BLOCKING multicast RPC, that can be sent
     341 * in parallel to all process copies. The various server threads must decrement the
     342 * responses counter defined by the <rsp_xp> argument, and the last server thread
     343 * must unblock the <client_xp> thread.
     344 ***********************************************************************************
     345 * @ cxy       : server cluster identifier.
     346 * @ process   : [in]  local pointer on target process in server cluster.
     347 * @ sigaction : [in]  action type (BLOCK / UNBLOCK / DELETE).
     348 * @ rsp_xp    : [in]  extended pointer on response counter.
     349 * @ client_xp : [in]  extended pointer on client thread.
     350 **********************************************************************************/
     351void rpc_process_sigaction_client( cxy_t               cxy,
     352                                   struct process_s  * process,
     353                                   uint32_t            sigaction,
     354                                   xptr_t              rsp_xp,
     355                                   xptr_t              client_xp );
     356                             
     357void rpc_process_sigaction_server( xptr_t xp );
    295358
    296359/***********************************************************************************
Note: See TracChangeset for help on using the changeset viewer.