1 | /* rtems/posix/key.h |
---|
2 | * |
---|
3 | * This include file contains all the private support information for |
---|
4 | * POSIX key. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989-1999. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * |
---|
9 | * The license and distribution terms for this file may be |
---|
10 | * found in the file LICENSE in this distribution or at |
---|
11 | * http://www.OARcorp.com/rtems/license.html. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #ifndef __RTEMS_POSIX_KEY_h |
---|
17 | #define __RTEMS_POSIX_KEY_h |
---|
18 | |
---|
19 | #ifdef __cplusplus |
---|
20 | extern "C" { |
---|
21 | #endif |
---|
22 | |
---|
23 | /* |
---|
24 | * Data Structure used to manage a POSIX key |
---|
25 | * |
---|
26 | * NOTE: The Values is a table indexed by the index portion of the |
---|
27 | * ID of the currently executing thread. |
---|
28 | */ |
---|
29 | |
---|
30 | typedef struct { |
---|
31 | Objects_Control Object; |
---|
32 | boolean is_active; |
---|
33 | void (*destructor)( void * ); |
---|
34 | void **Values[ OBJECTS_CLASSES_LAST_THREAD_CLASS + 1 ]; |
---|
35 | } POSIX_Keys_Control; |
---|
36 | |
---|
37 | /* |
---|
38 | * The following defines the information control block used to manage |
---|
39 | * this class of objects. |
---|
40 | */ |
---|
41 | |
---|
42 | POSIX_EXTERN Objects_Information _POSIX_Keys_Information; |
---|
43 | |
---|
44 | /* |
---|
45 | * _POSIX_Keys_Manager_initialization |
---|
46 | * |
---|
47 | * DESCRIPTION: |
---|
48 | * |
---|
49 | * This routine performs the initialization necessary for this manager. |
---|
50 | */ |
---|
51 | |
---|
52 | void _POSIX_Key_Manager_initialization( |
---|
53 | unsigned32 maximum_keys |
---|
54 | ); |
---|
55 | |
---|
56 | /* |
---|
57 | * _POSIX_Keys_Run_destructors |
---|
58 | * |
---|
59 | * DESCRIPTION: |
---|
60 | * |
---|
61 | * This function executes all the destructors associated with the thread's |
---|
62 | * keys. This function will execute until all values have been set to NULL. |
---|
63 | * |
---|
64 | * NOTE: This is the routine executed when a thread exits to |
---|
65 | * run through all the keys and do the destructor action. |
---|
66 | */ |
---|
67 | |
---|
68 | void _POSIX_Keys_Run_destructors( |
---|
69 | Thread_Control *thread |
---|
70 | ); |
---|
71 | |
---|
72 | /* |
---|
73 | * _POSIX_Keys_Allocate |
---|
74 | * |
---|
75 | * DESCRIPTION: |
---|
76 | * |
---|
77 | * This function allocates a keys control block from |
---|
78 | * the inactive chain of free keys control blocks. |
---|
79 | */ |
---|
80 | |
---|
81 | RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Allocate( void ); |
---|
82 | |
---|
83 | /* |
---|
84 | * _POSIX_Keys_Free |
---|
85 | * |
---|
86 | * DESCRIPTION: |
---|
87 | * |
---|
88 | * This routine frees a keys control block to the |
---|
89 | * inactive chain of free keys control blocks. |
---|
90 | */ |
---|
91 | |
---|
92 | RTEMS_INLINE_ROUTINE void _POSIX_Keys_Free ( |
---|
93 | POSIX_Keys_Control *the_key |
---|
94 | ); |
---|
95 | |
---|
96 | /* |
---|
97 | * _POSIX_Keys_Get |
---|
98 | * |
---|
99 | * DESCRIPTION: |
---|
100 | * |
---|
101 | * This function maps key IDs to key control blocks. |
---|
102 | * If ID corresponds to a local keys, then it returns |
---|
103 | * the_key control pointer which maps to ID and location |
---|
104 | * is set to OBJECTS_LOCAL. if the keys ID is global and |
---|
105 | * resides on a remote node, then location is set to OBJECTS_REMOTE, |
---|
106 | * and the_key is undefined. Otherwise, location is set |
---|
107 | * to OBJECTS_ERROR and the_key is undefined. |
---|
108 | */ |
---|
109 | |
---|
110 | RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Get ( |
---|
111 | Objects_Id id, |
---|
112 | Objects_Locations *location |
---|
113 | ); |
---|
114 | |
---|
115 | /* |
---|
116 | * _POSIX_Keys_Is_null |
---|
117 | * |
---|
118 | * DESCRIPTION: |
---|
119 | * |
---|
120 | * This function returns TRUE if the_key is NULL and FALSE otherwise. |
---|
121 | */ |
---|
122 | |
---|
123 | RTEMS_INLINE_ROUTINE boolean _POSIX_Keys_Is_null ( |
---|
124 | POSIX_Keys_Control *the_key |
---|
125 | ); |
---|
126 | |
---|
127 | #include <rtems/posix/key.inl> |
---|
128 | |
---|
129 | #ifdef __cplusplus |
---|
130 | } |
---|
131 | #endif |
---|
132 | |
---|
133 | #endif |
---|
134 | /* end of include file */ |
---|
135 | |
---|