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