OSDN Git Service

* sysdep.c: Problem discovered during IA64 VMS port.
[pf3gnuchains/gcc-fork.git] / gcc / ada / 5tosinte.ads
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 --                                                                          --
9 --          Copyright (C) 1997-2002, 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 --                                                                          --
29 -- GNARL was developed by the GNARL team at Florida State University.       --
30 -- Extensive contributions were provided by Ada Core Technologies, Inc.     --
31 --                                                                          --
32 ------------------------------------------------------------------------------
33
34 --  This is a Solaris (FSU THREADS) version of this package.
35
36 --  This package includes 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 ("-lgthreads");
48    pragma Linker_Options ("-lmalloc");
49
50    subtype int            is Interfaces.C.int;
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 := 45;
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; --  process's lwps blocked (Solaris)
116    SIGLWP     : constant := 33; --  used by thread library (Solaris)
117    SIGFREEZE  : constant := 34; --  used by CPR (Solaris)
118    SIGTHAW    : constant := 35; --  used by CPR (Solaris)
119    SIGCANCEL  : constant := 36; --  used for thread cancel (Solaris)
120    SIGRTMIN   : constant := 38; --  first (highest-priority) realtime signal
121    SIGRTMAX   : constant := 45; --  last (lowest-priority) realtime signal
122
123    type Signal_Set is array (Natural range <>) of Signal;
124
125    Unmasked    : constant Signal_Set :=
126      (SIGTRAP, SIGLWP, SIGTTIN, SIGTTOU, SIGTSTP, SIGPROF);
127
128    Reserved    : constant Signal_Set :=
129      (SIGKILL, SIGSTOP, SIGALRM, SIGVTALRM, SIGWAITING, SIGRTMAX);
130
131    type sigset_t is private;
132
133    function sigaddset (set : access sigset_t; sig : Signal) return int;
134    pragma Import (C, sigaddset, "sigaddset");
135
136    function sigdelset (set : access sigset_t; sig : Signal) return int;
137    pragma Import (C, sigdelset, "sigdelset");
138
139    function sigfillset (set : access sigset_t) return int;
140    pragma Import (C, sigfillset, "sigfillset");
141
142    function sigismember (set : access sigset_t; sig : Signal) return int;
143    pragma Import (C, sigismember, "sigismember");
144
145    function sigemptyset (set : access sigset_t) return int;
146    pragma Import (C, sigemptyset, "sigemptyset");
147
148    type union_type_3 is new String (1 .. 116);
149    type siginfo_t is record
150       si_signo     : int;
151       si_code      : int;
152       si_errno     : int;
153       X_data       : union_type_3;
154    end record;
155    pragma Convention (C, siginfo_t);
156
157    --  The types mcontext_t and gregset_t are part of the ucontext_t
158    --  information, which is specific to Solaris2.4 for SPARC
159    --  The ucontext_t info seems to be used by the handler
160    --  for SIGSEGV to decide whether it is a Storage_Error (stack overflow) or
161    --  a Constraint_Error (bad pointer).  The original code that did this
162    --  is suspect, so it is not clear whether we really need this part of
163    --  the signal context information, or perhaps something else.
164    --  More analysis is needed, after which these declarations may need to
165    --  be changed.
166
167    EMT_TAGOVF  : constant := 1; --  tag overflow
168    FPE_INTDIV  : constant := 1; --  integer divide by zero
169    FPE_INTOVF  : constant := 2; --  integer overflow
170    FPE_FLTDIV  : constant := 3; --  floating point divide by zero
171    FPE_FLTOVF  : constant := 4; --  floating point overflow
172    FPE_FLTUND  : constant := 5; --  floating point underflow
173    FPE_FLTRES  : constant := 6; --  floating point inexact result
174    FPE_FLTINV  : constant := 7; --  invalid floating point operation
175    FPE_FLTSUB  : constant := 8; --  subscript out of range
176
177    SEGV_MAPERR : constant := 1; --  address not mapped to object
178    SEGV_ACCERR : constant := 2; --  invalid permissions
179
180    BUS_ADRALN  : constant := 1; --  invalid address alignment
181    BUS_ADRERR  : constant := 2; --  non-existent physical address
182    BUS_OBJERR  : constant := 3; --  object specific hardware error
183
184    ILL_ILLOPC  : constant := 1; --  illegal opcode
185    ILL_ILLOPN  : constant := 2; --  illegal operand
186    ILL_ILLADR  : constant := 3; --  illegal addressing mode
187    ILL_ILLTRP  : constant := 4; --  illegal trap
188    ILL_PRVOPC  : constant := 5; --  privileged opcode
189    ILL_PRVREG  : constant := 6; --  privileged register
190    ILL_COPROC  : constant := 7; --  co-processor
191    ILL_BADSTK  : constant := 8; --  bad stack
192
193    type greg_t is new int;
194
195    type gregset_t is array (Integer range 0 .. 18) of greg_t;
196
197    REG_O0 : constant := 11;
198    --  index of saved register O0 in ucontext.uc_mcontext.gregs array
199
200    type union_type_2 is new String (1 .. 128);
201    type record_type_1 is record
202       fpu_fr       : union_type_2;
203       fpu_q        : System.Address;
204       fpu_fsr      : unsigned;
205       fpu_qcnt     : unsigned_char;
206       fpu_q_entrysize  : unsigned_char;
207       fpu_en       : unsigned_char;
208    end record;
209    pragma Convention (C, record_type_1);
210    type array_type_7 is array (Integer range 0 .. 20) of long;
211    type mcontext_t is record
212       gregs        : gregset_t;
213       gwins        : System.Address;
214       fpregs       : record_type_1;
215       filler       : array_type_7;
216    end record;
217    pragma Convention (C, mcontext_t);
218
219    type record_type_2 is record
220       ss_sp        : System.Address;
221       ss_size      : int;
222       ss_flags     : int;
223    end record;
224    pragma Convention (C, record_type_2);
225    type array_type_8 is array (Integer range 0 .. 22) of long;
226    type ucontext_t is record
227       uc_flags     : unsigned_long;
228       uc_link      : System.Address;
229       uc_sigmask   : sigset_t;
230       uc_stack     : record_type_2;
231       uc_mcontext  : mcontext_t;
232       uc_filler    : array_type_8;
233    end record;
234    pragma Convention (C, ucontext_t);
235
236    type Signal_Handler is access procedure
237       (signo   : Signal;
238        info    : access siginfo_t;
239        context : access ucontext_t);
240
241    type union_type_1 is new plain_char;
242    type array_type_2 is array (Integer range 0 .. 1) of int;
243    type struct_sigaction is record
244       sa_flags     : int;
245       sa_handler   : System.Address;
246       sa_mask      : sigset_t;
247       sa_resv      : array_type_2;
248    end record;
249    pragma Convention (C, struct_sigaction);
250    type struct_sigaction_ptr is access all struct_sigaction;
251
252    SIG_BLOCK   : constant := 1;
253    SIG_UNBLOCK : constant := 2;
254    SIG_SETMASK : constant := 3;
255
256    SIG_DFL : constant := 0;
257    SIG_IGN : constant := 1;
258
259    function sigaction
260      (sig  : Signal;
261       act  : struct_sigaction_ptr;
262       oact : struct_sigaction_ptr) return int;
263    pragma Import (C, sigaction, "sigaction");
264
265    ----------
266    -- Time --
267    ----------
268
269    Time_Slice_Supported : constant Boolean := False;
270    --  Indicates wether time slicing is supported (i.e FSU threads have been
271    --  compiled with DEF_RR)
272
273    type timespec is private;
274
275    type clockid_t is private;
276
277    CLOCK_REALTIME : constant clockid_t;
278
279    function clock_gettime
280      (clock_id : clockid_t;
281       tp       : access timespec) return int;
282    pragma Import (C, clock_gettime, "clock_gettime");
283
284    function To_Duration (TS : timespec) return Duration;
285    pragma Inline (To_Duration);
286
287    function To_Timespec (D : Duration) return timespec;
288    pragma Inline (To_Timespec);
289
290    type struct_timeval is private;
291
292    function To_Duration (TV : struct_timeval) return Duration;
293    pragma Inline (To_Duration);
294
295    function To_Timeval (D : Duration) return struct_timeval;
296    pragma Inline (To_Timeval);
297
298    -------------------------
299    -- Priority Scheduling --
300    -------------------------
301
302    SCHED_FIFO  : constant := 0;
303    SCHED_RR    : constant := 1;
304    SCHED_OTHER : constant := 2;
305
306    -------------
307    -- Process --
308    -------------
309
310    type pid_t is private;
311
312    function kill (pid : pid_t; sig : Signal) return int;
313    pragma Import (C, kill, "kill");
314
315    function getpid return pid_t;
316    pragma Import (C, getpid, "getpid");
317
318    ---------
319    -- LWP --
320    ---------
321
322    function lwp_self return System.Address;
323    --  lwp_self does not exist on this thread library, revert to pthread_self
324    --  which is the closest approximation (with getpid). This function is
325    --  needed to share 7staprop.adb across POSIX-like targets.
326    pragma Import (C, lwp_self, "pthread_self");
327
328    -------------
329    -- Threads --
330    -------------
331
332    type Thread_Body is access
333      function (arg : System.Address) return System.Address;
334    type pthread_t           is private;
335    subtype Thread_Id        is pthread_t;
336
337    type pthread_mutex_t     is limited private;
338    type pthread_cond_t      is limited private;
339    type pthread_attr_t      is limited private;
340    type pthread_mutexattr_t is limited private;
341    type pthread_condattr_t  is limited private;
342    type pthread_key_t       is private;
343
344    PTHREAD_CREATE_DETACHED : constant := 1;
345
346    -----------
347    -- Stack --
348    -----------
349
350    Stack_Base_Available : constant Boolean := False;
351    --  Indicates wether the stack base is available on this target.
352    --  This allows us to share s-osinte.adb between all the FSU run time.
353    --  Note that this value can only be true if pthread_t has a complete
354    --  definition that corresponds exactly to the C header files.
355
356    function Get_Stack_Base (thread : pthread_t) return Address;
357    pragma Inline (Get_Stack_Base);
358    --  returns the stack base of the specified thread.
359    --  Only call this function when Stack_Base_Available is True.
360
361    function Get_Page_Size return size_t;
362    function Get_Page_Size return Address;
363    pragma Import (C, Get_Page_Size, "getpagesize");
364    --  returns the size of a page, or 0 if this is not relevant on this
365    --  target
366
367    PROT_NONE  : constant := 0;
368    PROT_READ  : constant := 1;
369    PROT_WRITE : constant := 2;
370    PROT_EXEC  : constant := 4;
371    PROT_ALL   : constant := PROT_READ + PROT_WRITE + PROT_EXEC;
372
373    PROT_ON    : constant := PROT_NONE;
374    PROT_OFF   : constant := PROT_ALL;
375
376    function mprotect (addr : Address; len : size_t; prot : int) return int;
377    pragma Import (C, mprotect);
378
379    ---------------------------------------
380    -- Nonstandard Thread Initialization --
381    ---------------------------------------
382
383    procedure pthread_init;
384    --  FSU_THREADS requires pthread_init, which is nonstandard
385    --  and this should be invoked during the elaboration of s-taprop.adb
386    pragma Import (C, pthread_init, "pthread_init");
387
388    -------------------------
389    -- POSIX.1c  Section 3 --
390    -------------------------
391
392    function sigwait (set : access sigset_t; sig : access Signal) return int;
393    --  FSU_THREADS has a nonstandard sigwait
394
395    function pthread_kill (thread : pthread_t; sig : Signal) return int;
396    pragma Import (C, pthread_kill, "pthread_kill");
397
398    type sigset_t_ptr is access all sigset_t;
399
400    function pthread_sigmask
401      (how  : int;
402       set  : sigset_t_ptr;
403       oset : sigset_t_ptr) return int;
404    pragma Import (C, pthread_sigmask, "sigprocmask");
405
406    --------------------------
407    -- POSIX.1c  Section 11 --
408    --------------------------
409
410    function pthread_mutexattr_init
411      (attr : access pthread_mutexattr_t) return int;
412    pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init");
413
414    function pthread_mutexattr_destroy
415      (attr : access pthread_mutexattr_t) return int;
416    pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy");
417
418    function pthread_mutex_init
419      (mutex : access pthread_mutex_t;
420       attr  : access pthread_mutexattr_t) return int;
421    pragma Import (C, pthread_mutex_init, "pthread_mutex_init");
422
423    function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int;
424    pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy");
425
426    function pthread_mutex_lock (mutex : access pthread_mutex_t) return int;
427    --  FSU_THREADS has nonstandard pthread_mutex_lock
428
429    function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int;
430    --  FSU_THREADS has nonstandard pthread_mutex_lock
431
432    function pthread_condattr_init
433      (attr : access pthread_condattr_t) return int;
434    pragma Import (C, pthread_condattr_init, "pthread_condattr_init");
435
436    function pthread_condattr_destroy
437      (attr : access pthread_condattr_t) return int;
438    pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy");
439
440    function pthread_cond_init
441      (cond : access pthread_cond_t;
442       attr : access pthread_condattr_t) return int;
443    pragma Import (C, pthread_cond_init, "pthread_cond_init");
444
445    function pthread_cond_destroy (cond : access pthread_cond_t) return int;
446    pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy");
447
448    function pthread_cond_signal (cond : access pthread_cond_t) return int;
449    pragma Import (C, pthread_cond_signal, "pthread_cond_signal");
450
451    function pthread_cond_wait
452      (cond  : access pthread_cond_t;
453       mutex : access pthread_mutex_t) return int;
454    --  FSU_THREADS has a nonstandard pthread_cond_wait
455
456    function pthread_cond_timedwait
457      (cond    : access pthread_cond_t;
458       mutex   : access pthread_mutex_t;
459       abstime : access timespec) return int;
460    --  FSU_THREADS has a nonstandard pthread_cond_timedwait
461
462    Relative_Timed_Wait : constant Boolean := False;
463    --  pthread_cond_timedwait requires an absolute delay time
464
465    --------------------------
466    -- POSIX.1c  Section 13 --
467    --------------------------
468
469    PTHREAD_PRIO_NONE    : constant := 0;
470    PTHREAD_PRIO_PROTECT : constant := 2;
471    PTHREAD_PRIO_INHERIT : constant := 1;
472
473    function pthread_mutexattr_setprotocol
474      (attr     : access pthread_mutexattr_t;
475       protocol : int) return int;
476    pragma Import (C, pthread_mutexattr_setprotocol);
477
478    function pthread_mutexattr_setprioceiling
479      (attr     : access pthread_mutexattr_t;
480       prioceiling : int) return int;
481    pragma Import
482      (C, pthread_mutexattr_setprioceiling,
483       "pthread_mutexattr_setprio_ceiling");
484
485    type struct_sched_param is record
486       sched_priority : int;  --  scheduling priority
487    end record;
488
489    function pthread_setschedparam
490      (thread : pthread_t;
491       policy : int;
492       param  : access struct_sched_param) return int;
493    --  FSU_THREADS does not have pthread_setschedparam
494
495    function pthread_attr_setscope
496      (attr            : access pthread_attr_t;
497       contentionscope : int) return int;
498    pragma Import (C, pthread_attr_setscope, "pthread_attr_setscope");
499
500    function pthread_attr_setinheritsched
501      (attr            : access pthread_attr_t;
502       inheritsched : int) return int;
503    pragma Import (C, pthread_attr_setinheritsched);
504
505    function pthread_attr_setschedpolicy
506      (attr   : access pthread_attr_t;
507       policy : int) return int;
508    pragma Import (C, pthread_attr_setschedpolicy, "pthread_attr_setsched");
509
510    function sched_yield return int;
511    --  FSU_THREADS does not have sched_yield;
512
513    ---------------------------
514    -- P1003.1c - Section 16 --
515    ---------------------------
516
517    function pthread_attr_init (attributes : access pthread_attr_t) return int;
518    pragma Import (C, pthread_attr_init, "pthread_attr_init");
519
520    function pthread_attr_destroy
521      (attributes : access pthread_attr_t) return int;
522    pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy");
523
524    function pthread_attr_setdetachstate
525      (attr        : access pthread_attr_t;
526       detachstate : int) return int;
527    --  FSU_THREADS has a nonstandard pthread_attr_setdetachstate
528
529    function pthread_attr_setstacksize
530      (attr      : access pthread_attr_t;
531       stacksize : size_t) return int;
532    pragma Import (C, pthread_attr_setstacksize);
533
534    function pthread_create
535      (thread        : access pthread_t;
536       attributes    : access pthread_attr_t;
537       start_routine : Thread_Body;
538       arg           : System.Address) return int;
539    pragma Import (C, pthread_create, "pthread_create");
540
541    procedure pthread_exit (status : System.Address);
542    pragma Import (C, pthread_exit, "pthread_exit");
543
544    function pthread_self return pthread_t;
545    pragma Import (C, pthread_self, "pthread_self");
546
547    --------------------------
548    -- POSIX.1c  Section 17 --
549    --------------------------
550
551    function pthread_setspecific
552      (key   : pthread_key_t;
553       value : System.Address) return int;
554    pragma Import (C, pthread_setspecific, "pthread_setspecific");
555
556    function pthread_getspecific (key : pthread_key_t) return System.Address;
557    --  FSU_THREADS has a nonstandard pthread_getspecific
558
559    type destructor_pointer is access procedure (arg : System.Address);
560
561    function pthread_key_create
562      (key        : access pthread_key_t;
563       destructor : destructor_pointer) return int;
564    pragma Import (C, pthread_key_create, "pthread_key_create");
565
566 private
567
568    type array_type_1 is array (Integer range 0 .. 3) of unsigned_long;
569    type sigset_t is record
570       X_X_sigbits  : array_type_1;
571    end record;
572    pragma Convention (C, sigset_t);
573
574    type pid_t is new long;
575
576    type time_t is new long;
577
578    type timespec is record
579       tv_sec  : time_t;
580       tv_nsec : long;
581    end record;
582    pragma Convention (C, timespec);
583
584    type clockid_t is new int;
585    CLOCK_REALTIME : constant clockid_t := 0;
586
587    type struct_timeval is record
588       tv_sec  : long;
589       tv_usec : long;
590    end record;
591    pragma Convention (C, struct_timeval);
592
593    type pthread_attr_t is record
594       flags           : int;
595       stacksize       : int;
596       contentionscope : int;
597       inheritsched    : int;
598       detachstate     : int;
599       sched           : int;
600       prio            : int;
601       starttime       : timespec;
602       deadline        : timespec;
603       period          : timespec;
604    end record;
605    pragma Convention (C, pthread_attr_t);
606
607    type pthread_condattr_t is record
608       flags : int;
609    end record;
610    pragma Convention (C, pthread_condattr_t);
611
612    type pthread_mutexattr_t is record
613       flags        : int;
614       prio_ceiling : int;
615       protocol     : int;
616    end record;
617    pragma Convention (C, pthread_mutexattr_t);
618
619    type sigjmp_buf is array (Integer range 0 .. 18) of int;
620
621    type pthread_t_struct is record
622       context    : sigjmp_buf;
623       pbody      : sigjmp_buf;
624       errno      : int;
625       ret        : int;
626       stack_base : System.Address;
627    end record;
628    pragma Convention (C, pthread_t_struct);
629
630    type pthread_t is access all pthread_t_struct;
631
632    type queue_t is record
633       head : System.Address;
634       tail : System.Address;
635    end record;
636    pragma Convention (C, queue_t);
637
638    type pthread_mutex_t is record
639       queue                 : queue_t;
640       lock                  : plain_char;
641       owner                 : System.Address;
642       flags                 : int;
643       prio_ceiling          : int;
644       protocol              : int;
645       prev_max_ceiling_prio : int;
646    end record;
647    pragma Convention (C, pthread_mutex_t);
648
649    type pthread_cond_t is record
650       queue        : queue_t;
651       flags        : int;
652       waiters      : int;
653       mutex        : System.Address;
654    end record;
655    pragma Convention (C, pthread_cond_t);
656
657    type pthread_key_t is new int;
658
659 end System.OS_Interface;