Changeset 23 for trunk/kernel/libk/remote_sem.h
- Timestamp:
- Jun 18, 2017, 10:06:41 PM (6 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/libk/remote_sem.h
r15 r23 30 30 31 31 /********************************************************************************************* 32 * This file defines the thePOSIX compliant unnamed semaphore.32 * This file defines a POSIX compliant unnamed semaphore. 33 33 * 34 34 * A semaphore is declared by a given user process as a "sem_t" global variable. … … 46 46 47 47 /********************************************************************************************* 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. 52 52 ********************************************************************************************/ 53 53 … … 57 57 uint32_t count; /*! current value */ 58 58 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 */ 61 61 } 62 62 remote_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 enum70 {71 SEM_INIT,72 SEM_GETVALUE,73 SEM_WAIT,74 SEM_POST,75 SEM_DESTROY76 }77 sem_operation_t;78 79 63 80 64 81 65 /********************************************************************************************* 82 66 * 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, scanning84 * 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. 85 69 ********************************************************************************************* 86 70 * @ process : pointer on local process descriptor. … … 99 83 * @ returns 0 if success / returns ENOMEM if error. 100 84 ********************************************************************************************/ 101 error_t remote_sem_ init( intptr_t vaddr,102 uint32_t value );85 error_t remote_sem_create( intptr_t vaddr, 86 uint32_t value ); 103 87 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 ********************************************************************************************/ 95 void remote_sem_destroy( xptr_t sem_xp ); 96 104 97 /****************************yy*************************************************************** 105 98 * This blocking function implements the SEM_WAIT operation. … … 123 116 124 117 /****************************yy*************************************************************** 125 * This function implements the SEM_DESTROY operation.126 * It desactivates the semaphore, and releases the physical memory allocated in the127 * 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***************************************************************134 118 * This function implements the SEM_GETVALUE operation. 135 119 * It returns in the <data> buffer the semaphore current value.
Note: See TracChangeset
for help on using the changeset viewer.