Ignore:
Timestamp:
Jun 18, 2017, 10:06:41 PM (4 years ago)
Author:
alain
Message:

Introduce syscalls.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/kernel/libk/remote_sem.h

    r15 r23  
    3030
    3131/*********************************************************************************************
    32  *      This file defines the the POSIX compliant unnamed semaphore.
     32 *      This file defines a POSIX compliant unnamed semaphore.
    3333 *
    3434 * A semaphore is declared by a given user process as a "sem_t" global variable.
     
    4646
    4747/*********************************************************************************************
    48  * This structure defines the kernel remote_sem_t structure.
    49  * It contains the root of a waiting threads queue, implemented as a distributed xlist.
    50  * It contains an xlist of all semaphores, rooted in the reference process descriptor.
    51  * It contains a lock protecting both the semaphore value and the waiting queue.
     48 * This structure defines the kernel semaphore descriptor.
     49 * - It contains the root of a waiting threads queue, implemented as a distributed xlist.
     50 * - It contains an xlist of all semaphores, rooted in the reference process descriptor.
     51 * - It contains a lock protecting both the semaphore value and the waiting queue.
    5252 ********************************************************************************************/
    5353
     
    5757        uint32_t          count;         /*! current value                                      */
    5858    intptr_t          ident;         /*! virtual address in user space == identifier        */
    59     xlist_entry_t     wait_queue;    /*! root of waiting thread queue                       */
    60     xlist_entry_t     sem_list;      /*! member of list of semaphores in same process       */
     59    xlist_entry_t     root;          /*! root of waiting thread queue                       */
     60    xlist_entry_t     list;          /*! member of list of semaphores in same process       */
    6161}
    6262remote_sem_t;
    63 
    64 /*********************************************************************************************
    65  * This enum defines the semaphore operation types supported by the sys_sem() function.
    66  * It must be consistent with the values defined in the semaphore.c file (user library).
    67  ********************************************************************************************/
    68 
    69 typedef enum
    70 {
    71         SEM_INIT,
    72         SEM_GETVALUE,
    73         SEM_WAIT,
    74         SEM_POST,
    75         SEM_DESTROY
    76 }
    77 sem_operation_t;
    78 
    7963
    8064
    8165/*********************************************************************************************
    8266 * This function returns an extended pointer on the remote semaphore identified
    83  * by its virtual address in a given user process. It makes an associative search, scanning
    84  * the list of semaphores rooted in the reference process descriptor.
     67 * by its virtual address in a given user process. It makes an associative search,
     68 * scanning the list of semaphores rooted in the reference process descriptor.
    8569 *********************************************************************************************
    8670 * @ process  : pointer on local process descriptor.
     
    9983 * @ returns 0 if success / returns ENOMEM if error.
    10084 ********************************************************************************************/
    101 error_t remote_sem_init( intptr_t  vaddr,
    102                          uint32_t  value );
     85error_t remote_sem_create( intptr_t  vaddr,
     86                           uint32_t  value );
    10387 
     88/****************************yy***************************************************************
     89 * This function implements the SEM_DESTROY operation.
     90 * It desactivates the semaphore, and releases the physical memory allocated in the
     91 * reference cluster, using a RPC if required.
     92 *********************************************************************************************
     93 * @ sem_xp   : extended pointer on semaphore.
     94 ********************************************************************************************/
     95void remote_sem_destroy( xptr_t sem_xp );
     96
    10497/****************************yy***************************************************************
    10598 * This blocking function implements the SEM_WAIT operation.
     
    123116
    124117/****************************yy***************************************************************
    125  * This function implements the SEM_DESTROY operation.
    126  * It desactivates the semaphore, and releases the physical memory allocated in the
    127  * reference cluster, using a RPC if required.
    128  *********************************************************************************************
    129  * @ sem_xp   : extended pointer on semaphore.
    130  ********************************************************************************************/
    131 void remote_sem_destroy( xptr_t sem_xp );
    132 
    133 /****************************yy***************************************************************
    134118 * This function implements the SEM_GETVALUE operation.
    135119 * It returns in the <data> buffer the semaphore current value.
Note: See TracChangeset for help on using the changeset viewer.