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