1 | /* rtems/posix/semaphore.h |
---|
2 | * |
---|
3 | * This include file contains all the private support information for |
---|
4 | * POSIX Semaphores. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * All rights assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
11 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
12 | * notice must appear in all copies of this file and its derivatives. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef __RTEMS_POSIX_SEMAPHORE_h |
---|
18 | #define __RTEMS_POSIX_SEMAPHORE_h |
---|
19 | |
---|
20 | #ifdef __cplusplus |
---|
21 | extern "C" { |
---|
22 | #endif |
---|
23 | |
---|
24 | #include <rtems/score/coresem.h> |
---|
25 | |
---|
26 | /* |
---|
27 | * Data Structure used to manage a POSIX semaphore |
---|
28 | */ |
---|
29 | |
---|
30 | typedef struct { |
---|
31 | Objects_Control Object; |
---|
32 | int process_shared; |
---|
33 | boolean named; |
---|
34 | boolean linked; |
---|
35 | unsigned32 open_count; |
---|
36 | CORE_semaphore_Control Semaphore; |
---|
37 | } POSIX_Semaphore_Control; |
---|
38 | |
---|
39 | /* |
---|
40 | * The following defines the information control block used to manage |
---|
41 | * this class of objects. |
---|
42 | */ |
---|
43 | |
---|
44 | EXTERN Objects_Information _POSIX_Semaphore_Information; |
---|
45 | |
---|
46 | /* |
---|
47 | * _POSIX_Semaphore_Manager_initialization |
---|
48 | * |
---|
49 | * DESCRIPTION: |
---|
50 | * |
---|
51 | * This routine performs the initialization necessary for this manager. |
---|
52 | */ |
---|
53 | |
---|
54 | void _POSIX_Semaphore_Manager_initialization( |
---|
55 | unsigned32 maximum_semaphorees |
---|
56 | ); |
---|
57 | |
---|
58 | /* |
---|
59 | * _POSIX_Semaphore_Allocate |
---|
60 | * |
---|
61 | * DESCRIPTION: |
---|
62 | * |
---|
63 | * This function allocates a semaphore control block from |
---|
64 | * the inactive chain of free semaphore control blocks. |
---|
65 | */ |
---|
66 | |
---|
67 | STATIC INLINE POSIX_Semaphore_Control *_POSIX_Semaphore_Allocate( void ); |
---|
68 | |
---|
69 | /* |
---|
70 | * _POSIX_Semaphore_Free |
---|
71 | * |
---|
72 | * DESCRIPTION: |
---|
73 | * |
---|
74 | * This routine frees a semaphore control block to the |
---|
75 | * inactive chain of free semaphore control blocks. |
---|
76 | */ |
---|
77 | |
---|
78 | STATIC INLINE void _POSIX_Semaphore_Free ( |
---|
79 | POSIX_Semaphore_Control *the_semaphore |
---|
80 | ); |
---|
81 | |
---|
82 | /* |
---|
83 | * _POSIX_Semaphore_Get |
---|
84 | * |
---|
85 | * DESCRIPTION: |
---|
86 | * |
---|
87 | * This function maps semaphore IDs to semaphore control blocks. |
---|
88 | * If ID corresponds to a local semaphore, then it returns |
---|
89 | * the_semaphore control pointer which maps to ID and location |
---|
90 | * is set to OBJECTS_LOCAL. if the semaphore ID is global and |
---|
91 | * resides on a remote node, then location is set to OBJECTS_REMOTE, |
---|
92 | * and the_semaphore is undefined. Otherwise, location is set |
---|
93 | * to OBJECTS_ERROR and the_semaphore is undefined. |
---|
94 | */ |
---|
95 | |
---|
96 | STATIC INLINE POSIX_Semaphore_Control *_POSIX_Semaphore_Get ( |
---|
97 | Objects_Id *id, |
---|
98 | Objects_Locations *location |
---|
99 | ); |
---|
100 | |
---|
101 | /* |
---|
102 | * _POSIX_Semaphore_Is_null |
---|
103 | * |
---|
104 | * DESCRIPTION: |
---|
105 | * |
---|
106 | * This function returns TRUE if the_semaphore is NULL and FALSE otherwise. |
---|
107 | */ |
---|
108 | |
---|
109 | STATIC INLINE boolean _POSIX_Semaphore_Is_null ( |
---|
110 | POSIX_Semaphore_Control *the_semaphore |
---|
111 | ); |
---|
112 | |
---|
113 | /* |
---|
114 | * _POSIX_Semaphore_Name_to_id |
---|
115 | * |
---|
116 | * DESCRIPTION: |
---|
117 | * |
---|
118 | * XXX |
---|
119 | */ |
---|
120 | |
---|
121 | int _POSIX_Semaphore_Name_to_id( |
---|
122 | const char *name, |
---|
123 | Objects_Id *id |
---|
124 | ); |
---|
125 | |
---|
126 | #include <rtems/posix/semaphore.inl> |
---|
127 | #include <rtems/posix/semaphoremp.h> |
---|
128 | |
---|
129 | #ifdef __cplusplus |
---|
130 | } |
---|
131 | #endif |
---|
132 | |
---|
133 | #endif |
---|
134 | /* end of include file */ |
---|
135 | |
---|