1 | /* |
---|
2 | * RTEMS API Initialization Support |
---|
3 | * |
---|
4 | * NOTE: |
---|
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.rtems.com/license/LICENSE. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #if HAVE_CONFIG_H |
---|
17 | #include "config.h" |
---|
18 | #endif |
---|
19 | |
---|
20 | #include <assert.h> |
---|
21 | |
---|
22 | /* |
---|
23 | * POSIX_API_INIT is defined so all of the POSIX API |
---|
24 | * data will be included in this object file. |
---|
25 | */ |
---|
26 | |
---|
27 | #define POSIX_API_INIT |
---|
28 | |
---|
29 | #include <rtems/system.h> /* include this before checking RTEMS_POSIX_API */ |
---|
30 | #ifdef RTEMS_POSIX_API |
---|
31 | |
---|
32 | #include <sys/types.h> |
---|
33 | #include <mqueue.h> |
---|
34 | #include <rtems/config.h> |
---|
35 | #include <rtems/score/object.h> |
---|
36 | #include <rtems/posix/cond.h> |
---|
37 | #include <rtems/posix/config.h> |
---|
38 | #include <rtems/posix/key.h> |
---|
39 | #include <rtems/posix/mqueue.h> |
---|
40 | #include <rtems/posix/mutex.h> |
---|
41 | #include <rtems/posix/priority.h> |
---|
42 | #include <rtems/posix/psignal.h> |
---|
43 | #include <rtems/posix/pthread.h> |
---|
44 | #include <rtems/posix/timer.h> |
---|
45 | #include <rtems/posix/semaphore.h> |
---|
46 | #include <rtems/posix/time.h> |
---|
47 | |
---|
48 | /*PAGE |
---|
49 | * |
---|
50 | * _POSIX_API_Initialize |
---|
51 | * |
---|
52 | * XXX |
---|
53 | */ |
---|
54 | |
---|
55 | posix_api_configuration_table _POSIX_Default_configuration = { |
---|
56 | 0, /* maximum_threads */ |
---|
57 | 0, /* maximum_mutexes */ |
---|
58 | 0, /* maximum_condition_variables */ |
---|
59 | 0, /* maximum_keys */ |
---|
60 | 0, /* maximum_timers */ |
---|
61 | 0, /* maximum_queued_signals */ |
---|
62 | 0, /* number_of_initialization_threads */ |
---|
63 | 0, /* maximum_message_queues */ |
---|
64 | 0, /* maximum_semaphores */ |
---|
65 | NULL /* User_initialization_threads_table */ |
---|
66 | }; |
---|
67 | |
---|
68 | Objects_Information *_POSIX_Objects[ OBJECTS_POSIX_CLASSES_LAST + 1 ]; |
---|
69 | |
---|
70 | |
---|
71 | void _POSIX_API_Initialize( |
---|
72 | rtems_configuration_table *configuration_table |
---|
73 | ) |
---|
74 | { |
---|
75 | posix_api_configuration_table *api_configuration; |
---|
76 | |
---|
77 | /* XXX need to assert here based on size assumptions */ |
---|
78 | |
---|
79 | assert( sizeof(pthread_t) == sizeof(Objects_Id) ); |
---|
80 | |
---|
81 | api_configuration = configuration_table->POSIX_api_configuration; |
---|
82 | if ( !api_configuration ) |
---|
83 | api_configuration = &_POSIX_Default_configuration; |
---|
84 | |
---|
85 | _Objects_Information_table[OBJECTS_POSIX_API] = _POSIX_Objects; |
---|
86 | |
---|
87 | _POSIX_signals_Manager_Initialization( |
---|
88 | api_configuration->maximum_queued_signals |
---|
89 | ); |
---|
90 | |
---|
91 | _POSIX_Threads_Manager_initialization( |
---|
92 | api_configuration->maximum_threads, |
---|
93 | api_configuration->number_of_initialization_threads, |
---|
94 | api_configuration->User_initialization_threads_table |
---|
95 | ); |
---|
96 | |
---|
97 | _POSIX_Condition_variables_Manager_initialization( |
---|
98 | api_configuration->maximum_condition_variables |
---|
99 | ); |
---|
100 | |
---|
101 | _POSIX_Key_Manager_initialization( api_configuration->maximum_keys ); |
---|
102 | |
---|
103 | _POSIX_Mutex_Manager_initialization( |
---|
104 | api_configuration->maximum_mutexes |
---|
105 | ); |
---|
106 | |
---|
107 | _POSIX_Message_queue_Manager_initialization( |
---|
108 | api_configuration->maximum_message_queues |
---|
109 | ); |
---|
110 | |
---|
111 | _POSIX_Semaphore_Manager_initialization( |
---|
112 | api_configuration->maximum_semaphores |
---|
113 | ); |
---|
114 | |
---|
115 | _POSIX_Timer_Manager_initialization ( api_configuration->maximum_timers ); |
---|
116 | } |
---|
117 | |
---|
118 | #endif |
---|
119 | /* end of file */ |
---|