]>
Commit | Line | Data |
---|---|---|
84481f76 RK |
1 | ------------------------------------------------------------------------------ |
2 | -- -- | |
3 | -- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS -- | |
4 | -- -- | |
5 | -- S Y S T E M . O S _ I N T E R F A C E -- | |
6 | -- -- | |
7 | -- S p e c -- | |
8 | -- -- | |
84481f76 RK |
9 | -- Copyright (C) 1999-2001 Free Software Foundation, Inc. -- |
10 | -- -- | |
11 | -- GNARL is free software; you can redistribute it and/or modify it under -- | |
12 | -- terms of the GNU General Public License as published by the Free Soft- -- | |
13 | -- ware Foundation; either version 2, or (at your option) any later ver- -- | |
14 | -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- | |
15 | -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- | |
16 | -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- | |
17 | -- for more details. You should have received a copy of the GNU General -- | |
18 | -- Public License distributed with GNARL; see file COPYING. If not, write -- | |
19 | -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- | |
20 | -- MA 02111-1307, USA. -- | |
21 | -- -- | |
22 | -- As a special exception, if other files instantiate generics from this -- | |
23 | -- unit, or you link this unit with other files to produce an executable, -- | |
24 | -- this unit does not by itself cause the resulting executable to be -- | |
25 | -- covered by the GNU General Public License. This exception does not -- | |
26 | -- however invalidate any other reasons why the executable file might be -- | |
27 | -- covered by the GNU Public License. -- | |
28 | -- -- | |
71ff80dc | 29 | -- GNARL was developed by the GNARL team at Florida State University. -- |
fbf5a39b | 30 | -- Extensive contributions were provided by Ada Core Technologies, Inc. -- |
84481f76 RK |
31 | -- -- |
32 | ------------------------------------------------------------------------------ | |
33 | ||
34 | -- This is a UnixWare (Native THREADS) version of this package. | |
35 | ||
36 | -- This package encapsulates all direct interfaces to OS services | |
37 | -- that are needed by children of System. | |
38 | ||
39 | -- PLEASE DO NOT add any with-clauses to this package | |
40 | -- or remove the pragma Elaborate_Body. | |
41 | -- It is designed to be a bottom-level (leaf) package. | |
42 | ||
43 | with Interfaces.C; | |
44 | package System.OS_Interface is | |
45 | pragma Preelaborate; | |
46 | ||
47 | pragma Linker_Options ("-lthread"); | |
48 | ||
49 | subtype int is Interfaces.C.int; | |
50 | subtype char is Interfaces.C.char; | |
51 | subtype short is Interfaces.C.short; | |
52 | subtype long is Interfaces.C.long; | |
53 | subtype unsigned is Interfaces.C.unsigned; | |
54 | subtype unsigned_short is Interfaces.C.unsigned_short; | |
55 | subtype unsigned_long is Interfaces.C.unsigned_long; | |
56 | subtype unsigned_char is Interfaces.C.unsigned_char; | |
57 | subtype plain_char is Interfaces.C.plain_char; | |
58 | subtype size_t is Interfaces.C.size_t; | |
59 | ||
60 | ----------- | |
61 | -- Errno -- | |
62 | ----------- | |
63 | ||
64 | function errno return int; | |
65 | pragma Import (C, errno, "__get_errno"); | |
66 | ||
67 | EAGAIN : constant := 11; | |
68 | EINTR : constant := 4; | |
69 | EINVAL : constant := 22; | |
70 | ENOMEM : constant := 12; | |
71 | ETIMEDOUT : constant := 145; | |
72 | ||
73 | ------------- | |
74 | -- Signals -- | |
75 | ------------- | |
76 | ||
77 | Max_Interrupt : constant := 34; | |
78 | type Signal is new int range 0 .. Max_Interrupt; | |
79 | for Signal'Size use int'Size; | |
80 | ||
81 | SIGHUP : constant := 1; -- hangup | |
82 | SIGINT : constant := 2; -- interrupt (rubout) | |
83 | SIGQUIT : constant := 3; -- quit (ASCD FS) | |
84 | SIGILL : constant := 4; -- illegal instruction (not reset) | |
85 | SIGTRAP : constant := 5; -- trace trap (not reset) | |
86 | SIGIOT : constant := 6; -- IOT instruction | |
87 | SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future | |
88 | SIGEMT : constant := 7; -- EMT instruction | |
89 | SIGFPE : constant := 8; -- floating point exception | |
90 | SIGKILL : constant := 9; -- kill (cannot be caught or ignored) | |
91 | SIGBUS : constant := 10; -- bus error | |
92 | SIGSEGV : constant := 11; -- segmentation violation | |
93 | SIGSYS : constant := 12; -- bad argument to system call | |
94 | SIGPIPE : constant := 13; -- write on a pipe with no one to read it | |
95 | SIGALRM : constant := 14; -- alarm clock | |
96 | SIGTERM : constant := 15; -- software termination signal from kill | |
97 | SIGUSR1 : constant := 16; -- user defined signal 1 | |
98 | SIGUSR2 : constant := 17; -- user defined signal 2 | |
99 | SIGCLD : constant := 18; -- alias for SIGCHLD | |
100 | SIGCHLD : constant := 18; -- child status change | |
101 | SIGPWR : constant := 19; -- power-fail restart | |
102 | SIGWINCH : constant := 20; -- window size change | |
103 | SIGURG : constant := 21; -- urgent condition on IO channel | |
104 | SIGPOLL : constant := 22; -- pollable event occurred | |
105 | SIGIO : constant := 22; -- I/O possible (Solaris SIGPOLL alias) | |
106 | SIGSTOP : constant := 23; -- stop (cannot be caught or ignored) | |
107 | SIGTSTP : constant := 24; -- user stop requested from tty | |
108 | SIGCONT : constant := 25; -- stopped process has been continued | |
109 | SIGTTIN : constant := 26; -- background tty read attempted | |
110 | SIGTTOU : constant := 27; -- background tty write attempted | |
111 | SIGVTALRM : constant := 28; -- virtual timer expired | |
112 | SIGPROF : constant := 29; -- profiling timer expired | |
113 | SIGXCPU : constant := 30; -- CPU time limit exceeded | |
114 | SIGXFSZ : constant := 31; -- filesize limit exceeded | |
115 | SIGWAITING : constant := 32; -- all LWPs blocked interruptibly notific. | |
116 | SIGLWP : constant := 33; -- signal reserved for thread lib impl. | |
117 | SIGAIO : constant := 34; -- Asynchronous I/O signal | |
118 | ||
119 | SIGADAABORT : constant := SIGABRT; | |
120 | -- Change this if you want to use another signal for task abort. | |
121 | -- SIGTERM might be a good one. | |
122 | ||
123 | type Signal_Set is array (Natural range <>) of Signal; | |
124 | ||
125 | Unmasked : constant Signal_Set := | |
126 | (SIGTRAP, SIGLWP, SIGWAITING, SIGTTIN, SIGTTOU, SIGTSTP, SIGPROF); | |
127 | Reserved : constant Signal_Set := (SIGABRT, SIGKILL, SIGSTOP); | |
128 | ||
129 | type sigset_t is private; | |
130 | ||
131 | function sigaddset (set : access sigset_t; sig : Signal) return int; | |
132 | pragma Import (C, sigaddset, "sigaddset"); | |
133 | ||
134 | function sigdelset (set : access sigset_t; sig : Signal) return int; | |
135 | pragma Import (C, sigdelset, "sigdelset"); | |
136 | ||
137 | function sigfillset (set : access sigset_t) return int; | |
138 | pragma Import (C, sigfillset, "sigfillset"); | |
139 | ||
140 | function sigismember (set : access sigset_t; sig : Signal) return int; | |
141 | pragma Import (C, sigismember, "sigismember"); | |
142 | ||
143 | function sigemptyset (set : access sigset_t) return int; | |
144 | pragma Import (C, sigemptyset, "sigemptyset"); | |
145 | ||
146 | type struct_sigaction is record | |
147 | sa_flags : int; | |
148 | sa_handler : System.Address; | |
149 | sa_mask : sigset_t; | |
150 | sa_resv1 : int; | |
151 | sa_resv2 : int; | |
152 | end record; | |
153 | pragma Convention (C, struct_sigaction); | |
154 | type struct_sigaction_ptr is access all struct_sigaction; | |
155 | ||
156 | SIG_BLOCK : constant := 1; | |
157 | SIG_UNBLOCK : constant := 2; | |
158 | SIG_SETMASK : constant := 3; | |
159 | ||
160 | SIG_DFL : constant := 0; | |
161 | SIG_IGN : constant := 1; | |
162 | -- SIG_ERR : constant := -1; | |
163 | -- not used | |
164 | ||
165 | function sigaction | |
166 | (sig : Signal; | |
167 | act : struct_sigaction_ptr; | |
168 | oact : struct_sigaction_ptr) return int; | |
169 | pragma Import (C, sigaction, "sigaction"); | |
170 | ||
171 | ---------- | |
172 | -- Time -- | |
173 | ---------- | |
174 | ||
175 | Time_Slice_Supported : constant Boolean := False; | |
176 | -- Indicates wether time slicing is supported | |
177 | ||
178 | type timespec is private; | |
179 | ||
180 | type clockid_t is private; | |
181 | ||
182 | CLOCK_REALTIME : constant clockid_t; | |
183 | ||
184 | function clock_gettime | |
185 | (clock_id : clockid_t; | |
186 | tp : access timespec) return int; | |
187 | -- UnixWare threads don't have clock_gettime | |
188 | -- We instead use gettimeofday() | |
189 | ||
190 | function To_Duration (TS : timespec) return Duration; | |
191 | pragma Inline (To_Duration); | |
192 | ||
193 | function To_Timespec (D : Duration) return timespec; | |
194 | pragma Inline (To_Timespec); | |
195 | ||
196 | type struct_timezone is record | |
197 | tz_minuteswest : int; | |
198 | tz_dsttime : int; | |
199 | end record; | |
200 | pragma Convention (C, struct_timezone); | |
201 | type struct_timezone_ptr is access all struct_timezone; | |
202 | ||
203 | type struct_timeval is private; | |
204 | -- This is needed on systems that do not have clock_gettime() | |
205 | -- but do have gettimeofday(). | |
206 | ||
207 | function To_Duration (TV : struct_timeval) return Duration; | |
208 | pragma Inline (To_Duration); | |
209 | ||
210 | function To_Timeval (D : Duration) return struct_timeval; | |
211 | pragma Inline (To_Timeval); | |
212 | ||
213 | ------------------------- | |
214 | -- Priority Scheduling -- | |
215 | ------------------------- | |
216 | ||
217 | SCHED_FIFO : constant := 2; | |
218 | SCHED_RR : constant := 3; | |
219 | SCHED_OTHER : constant := 1; | |
220 | ||
221 | ------------- | |
222 | -- Process -- | |
223 | ------------- | |
224 | ||
225 | type pid_t is private; | |
226 | ||
227 | function kill (pid : pid_t; sig : Signal) return int; | |
228 | pragma Import (C, kill, "kill"); | |
229 | ||
230 | function getpid return pid_t; | |
231 | pragma Import (C, getpid, "getpid"); | |
232 | ||
233 | --------- | |
234 | -- LWP -- | |
235 | --------- | |
236 | ||
237 | function lwp_self return System.Address; | |
238 | pragma Import (C, lwp_self, "_lwp_self"); | |
239 | ||
240 | ------------- | |
241 | -- Threads -- | |
242 | ------------- | |
243 | ||
244 | type Thread_Body is access | |
245 | function (arg : System.Address) return System.Address; | |
246 | type pthread_t is private; | |
247 | subtype Thread_Id is pthread_t; | |
248 | ||
249 | type pthread_mutex_t is limited private; | |
250 | type pthread_cond_t is limited private; | |
251 | type pthread_attr_t is limited private; | |
252 | type pthread_mutexattr_t is limited private; | |
253 | type pthread_condattr_t is limited private; | |
254 | type pthread_key_t is private; | |
255 | ||
256 | PTHREAD_CREATE_DETACHED : constant := 0; | |
257 | ||
258 | ----------- | |
259 | -- Stack -- | |
260 | ----------- | |
261 | ||
262 | Stack_Base_Available : constant Boolean := False; | |
263 | -- Indicates wether the stack base is available on this target. | |
264 | ||
265 | function Get_Stack_Base (thread : pthread_t) return Address; | |
266 | pragma Inline (Get_Stack_Base); | |
267 | -- returns the stack base of the specified thread. | |
268 | -- Only call this function when Stack_Base_Available is True. | |
269 | ||
270 | function Get_Page_Size return size_t; | |
271 | function Get_Page_Size return Address; | |
272 | pragma Import (C, Get_Page_Size, "getpagesize"); | |
273 | -- returns the size of a page, or 0 if this is not relevant on this | |
274 | -- target | |
275 | ||
276 | PROT_NONE : constant := 0; | |
277 | PROT_READ : constant := 1; | |
278 | PROT_WRITE : constant := 2; | |
279 | PROT_EXEC : constant := 4; | |
280 | PROT_USER : constant := 8; | |
281 | PROT_ALL : constant := PROT_READ + PROT_WRITE + PROT_EXEC + PROT_USER; | |
282 | ||
283 | PROT_ON : constant := PROT_READ; | |
284 | PROT_OFF : constant := PROT_ALL; | |
285 | ||
286 | function mprotect (addr : Address; len : size_t; prot : int) return int; | |
287 | pragma Import (C, mprotect); | |
288 | ||
289 | ------------------------- | |
290 | -- POSIX.1c Section 3 -- | |
291 | ------------------------- | |
292 | ||
293 | function sigwait (set : access sigset_t; sig : access Signal) return int; | |
294 | pragma Inline (sigwait); | |
295 | -- UnixWare provides a non standard sigwait | |
296 | ||
297 | function pthread_kill (thread : pthread_t; sig : Signal) return int; | |
298 | pragma Inline (pthread_kill); | |
299 | -- UnixWare provides a non standard pthread_kill | |
300 | ||
301 | type sigset_t_ptr is access all sigset_t; | |
302 | ||
303 | function pthread_sigmask | |
304 | (how : int; | |
305 | set : sigset_t_ptr; | |
306 | oset : sigset_t_ptr) return int; | |
307 | pragma Import (C, pthread_sigmask, "pthread_sigmask"); | |
308 | ||
309 | -------------------------- | |
310 | -- POSIX.1c Section 11 -- | |
311 | -------------------------- | |
312 | ||
313 | function pthread_mutexattr_init | |
314 | (attr : access pthread_mutexattr_t) return int; | |
315 | pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init"); | |
316 | ||
317 | function pthread_mutexattr_destroy | |
318 | (attr : access pthread_mutexattr_t) return int; | |
319 | pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy"); | |
320 | ||
321 | function pthread_mutex_init | |
322 | (mutex : access pthread_mutex_t; | |
323 | attr : access pthread_mutexattr_t) return int; | |
324 | pragma Import (C, pthread_mutex_init, "pthread_mutex_init"); | |
325 | ||
326 | function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int; | |
327 | pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy"); | |
328 | ||
329 | function pthread_mutex_lock (mutex : access pthread_mutex_t) return int; | |
330 | pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock"); | |
331 | ||
332 | function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int; | |
333 | pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock"); | |
334 | ||
335 | function pthread_condattr_init | |
336 | (attr : access pthread_condattr_t) return int; | |
337 | pragma Import (C, pthread_condattr_init, "pthread_condattr_init"); | |
338 | ||
339 | function pthread_condattr_destroy | |
340 | (attr : access pthread_condattr_t) return int; | |
341 | pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy"); | |
342 | ||
343 | function pthread_cond_init | |
344 | (cond : access pthread_cond_t; | |
345 | attr : access pthread_condattr_t) return int; | |
346 | pragma Import (C, pthread_cond_init, "pthread_cond_init"); | |
347 | ||
348 | function pthread_cond_destroy (cond : access pthread_cond_t) return int; | |
349 | pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy"); | |
350 | ||
351 | function pthread_cond_signal (cond : access pthread_cond_t) return int; | |
352 | pragma Import (C, pthread_cond_signal, "pthread_cond_signal"); | |
353 | ||
354 | function pthread_cond_wait | |
355 | (cond : access pthread_cond_t; | |
356 | mutex : access pthread_mutex_t) return int; | |
357 | pragma Import (C, pthread_cond_wait, "pthread_cond_wait"); | |
358 | ||
359 | function pthread_cond_timedwait | |
360 | (cond : access pthread_cond_t; | |
361 | mutex : access pthread_mutex_t; | |
362 | abstime : access timespec) return int; | |
363 | pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait"); | |
364 | ||
365 | Relative_Timed_Wait : constant Boolean := False; | |
366 | -- pthread_cond_timedwait requires an absolute delay time | |
367 | ||
368 | -------------------------- | |
369 | -- POSIX.1c Section 13 -- | |
370 | -------------------------- | |
371 | ||
372 | PTHREAD_PRIO_NONE : constant := 1; | |
373 | PTHREAD_PRIO_INHERIT : constant := 2; | |
374 | PTHREAD_PRIO_PROTECT : constant := 3; | |
375 | ||
376 | function pthread_mutexattr_setprotocol | |
377 | (attr : access pthread_mutexattr_t; | |
378 | protocol : int) return int; | |
379 | pragma Import (C, pthread_mutexattr_setprotocol); | |
380 | ||
381 | function pthread_mutexattr_setprioceiling | |
382 | (attr : access pthread_mutexattr_t; | |
383 | prioceiling : int) return int; | |
384 | pragma Import (C, pthread_mutexattr_setprioceiling); | |
385 | ||
386 | type sched_union is record | |
387 | sched_fifo : int; | |
388 | sched_fcfs : int; | |
389 | sched_other : int; | |
390 | sched_ts : int; | |
391 | policy_params : long; | |
392 | end record; | |
393 | ||
394 | type struct_sched_param is record | |
395 | sched_priority : int; | |
396 | sched_other_stuff : sched_union; | |
397 | end record; | |
398 | ||
399 | function pthread_setschedparam | |
400 | (thread : pthread_t; | |
401 | policy : int; | |
402 | param : access struct_sched_param) return int; | |
403 | pragma Import (C, pthread_setschedparam, "pthread_setschedparam"); | |
404 | ||
405 | function pthread_attr_setscope | |
406 | (attr : access pthread_attr_t; | |
407 | contentionscope : int) return int; | |
408 | pragma Import (C, pthread_attr_setscope, "pthread_attr_setscope"); | |
409 | ||
410 | function pthread_attr_setinheritsched | |
411 | (attr : access pthread_attr_t; | |
412 | inheritsched : int) return int; | |
413 | pragma Import (C, pthread_attr_setinheritsched); | |
414 | ||
415 | function pthread_attr_setschedpolicy | |
416 | (attr : access pthread_attr_t; | |
417 | policy : int) return int; | |
418 | pragma Import (C, pthread_attr_setschedpolicy); | |
419 | ||
420 | function sched_yield return int; | |
421 | pragma Import (C, sched_yield, "sched_yield"); | |
422 | ||
423 | --------------------------- | |
424 | -- P1003.1c - Section 16 -- | |
425 | --------------------------- | |
426 | ||
427 | function pthread_attr_init (attributes : access pthread_attr_t) return int; | |
428 | pragma Import (C, pthread_attr_init, "pthread_attr_init"); | |
429 | ||
430 | function pthread_attr_destroy | |
431 | (attributes : access pthread_attr_t) return int; | |
432 | pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy"); | |
433 | ||
434 | function pthread_attr_setdetachstate | |
435 | (attr : access pthread_attr_t; | |
436 | detachstate : int) return int; | |
437 | pragma Import (C, pthread_attr_setdetachstate); | |
438 | ||
439 | function pthread_attr_setstacksize | |
440 | (attr : access pthread_attr_t; | |
441 | stacksize : size_t) return int; | |
442 | pragma Import (C, pthread_attr_setstacksize); | |
443 | ||
444 | function pthread_create | |
445 | (thread : access pthread_t; | |
446 | attributes : access pthread_attr_t; | |
447 | start_routine : Thread_Body; | |
448 | arg : System.Address) return int; | |
449 | pragma Import (C, pthread_create, "pthread_create"); | |
450 | ||
451 | procedure pthread_exit (status : System.Address); | |
452 | pragma Import (C, pthread_exit, "pthread_exit"); | |
453 | ||
454 | function pthread_self return pthread_t; | |
455 | pragma Import (C, pthread_self, "pthread_self"); | |
456 | ||
457 | -------------------------- | |
458 | -- POSIX.1c Section 17 -- | |
459 | -------------------------- | |
460 | ||
461 | function pthread_setspecific | |
462 | (key : pthread_key_t; | |
463 | value : System.Address) return int; | |
464 | pragma Import (C, pthread_setspecific, "pthread_setspecific"); | |
465 | ||
466 | function pthread_getspecific (key : pthread_key_t) return System.Address; | |
467 | pragma Import (C, pthread_getspecific, "pthread_getspecific"); | |
468 | ||
469 | type destructor_pointer is access procedure (arg : System.Address); | |
470 | ||
471 | function pthread_key_create | |
472 | (key : access pthread_key_t; | |
473 | destructor : destructor_pointer) return int; | |
474 | pragma Import (C, pthread_key_create, "pthread_key_create"); | |
475 | ||
476 | procedure pthread_init; | |
477 | -- This is a dummy procedure to share some GNULLI files | |
478 | ||
479 | private | |
480 | ||
481 | type sigbit_array is array (1 .. 4) of unsigned; | |
482 | type sigset_t is record | |
483 | sa_sigbits : sigbit_array; | |
484 | end record; | |
485 | pragma Convention (C_Pass_By_Copy, sigset_t); | |
486 | ||
487 | type pid_t is new unsigned; | |
488 | ||
489 | type time_t is new long; | |
490 | ||
491 | type timespec is record | |
492 | tv_sec : time_t; | |
493 | tv_nsec : long; | |
494 | end record; | |
495 | pragma Convention (C, timespec); | |
496 | ||
497 | type clockid_t is new int; | |
498 | CLOCK_REALTIME : constant clockid_t := 0; | |
499 | ||
500 | type struct_timeval is record | |
501 | tv_sec : long; | |
502 | tv_usec : long; | |
503 | end record; | |
504 | pragma Convention (C, struct_timeval); | |
505 | ||
506 | type pthread_attr_t is record | |
507 | pt_attr_status : int; | |
508 | pt_attr_stacksize : size_t; | |
509 | pt_attr_stackaddr : System.Address; | |
510 | pt_attr_detachstate : int; | |
511 | pt_attr_contentionscope : int; | |
512 | pt_attr_inheritsched : int; | |
513 | pt_attr_schedpolicy : int; | |
514 | pt_attr_sched_param : struct_sched_param; | |
515 | pt_attr_tlflags : int; | |
516 | end record; | |
517 | pragma Convention (C, pthread_attr_t); | |
518 | ||
519 | type pthread_condattr_t is record | |
520 | pt_condattr_status : int; | |
521 | pt_condattr_pshared : int; | |
522 | end record; | |
523 | pragma Convention (C, pthread_condattr_t); | |
524 | ||
525 | type pthread_mutexattr_t is record | |
526 | pt_mutexattr_status : int; | |
527 | pt_mutexattr_pshared : int; | |
528 | pt_mutexattr_type : int; | |
529 | end record; | |
530 | pragma Convention (C, pthread_mutexattr_t); | |
531 | ||
532 | type thread_t is new long; | |
533 | type pthread_t is new thread_t; | |
534 | ||
535 | type thrq_elt_t; | |
536 | type thrq_elt_t_ptr is access all thrq_elt_t; | |
537 | ||
538 | type thrq_elt_t is record | |
539 | thrq_next : thrq_elt_t_ptr; | |
540 | thrq_prev : thrq_elt_t_ptr; | |
541 | end record; | |
542 | pragma Convention (C, thrq_elt_t); | |
543 | ||
544 | type lwp_mutex_t is record | |
545 | wanted : char; | |
546 | lock : unsigned_char; | |
547 | end record; | |
548 | pragma Convention (C, lwp_mutex_t); | |
549 | pragma Volatile (lwp_mutex_t); | |
550 | ||
551 | type mutex_t is record | |
552 | m_lmutex : lwp_mutex_t; | |
553 | m_sync_lock : lwp_mutex_t; | |
554 | m_type : int; | |
555 | m_sleepq : thrq_elt_t; | |
556 | filler1 : int; | |
557 | filler2 : int; | |
558 | end record; | |
559 | pragma Convention (C, mutex_t); | |
560 | pragma Volatile (mutex_t); | |
561 | ||
562 | type pthread_mutex_t is record | |
563 | pt_mutex_mutex : mutex_t; | |
564 | pt_mutex_pid : pid_t; | |
565 | pt_mutex_owner : thread_t; | |
566 | pt_mutex_depth : int; | |
567 | pt_mutex_attr : pthread_mutexattr_t; | |
568 | end record; | |
569 | pragma Convention (C, pthread_mutex_t); | |
570 | ||
571 | type lwp_cond_t is record | |
572 | wanted : char; | |
573 | end record; | |
574 | pragma Convention (C, lwp_cond_t); | |
575 | pragma Volatile (lwp_cond_t); | |
576 | ||
577 | type cond_t is record | |
578 | c_lcond : lwp_cond_t; | |
579 | c_sync_lock : lwp_mutex_t; | |
580 | c_type : int; | |
581 | c_syncq : thrq_elt_t; | |
582 | end record; | |
583 | pragma Convention (C, cond_t); | |
584 | pragma Volatile (cond_t); | |
585 | ||
586 | type pthread_cond_t is record | |
587 | pt_cond_cond : cond_t; | |
588 | pt_cond_attr : pthread_condattr_t; | |
589 | end record; | |
590 | pragma Convention (C, pthread_cond_t); | |
591 | ||
592 | type pthread_key_t is new unsigned; | |
593 | ||
594 | end System.OS_Interface; |