OSDN Git Service

2003-12-11 Ed Falis <falis@gnat.com>
[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-2003, 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    SA_SIGINFO  : constant := 16#08#;
253
254    SIG_BLOCK   : constant := 1;
255    SIG_UNBLOCK : constant := 2;
256    SIG_SETMASK : constant := 3;
257
258    SIG_DFL : constant := 0;
259    SIG_IGN : constant := 1;
260
261    function sigaction
262      (sig  : Signal;
263       act  : struct_sigaction_ptr;
264       oact : struct_sigaction_ptr) return int;
265    pragma Import (C, sigaction, "sigaction");
266
267    ----------
268    -- Time --
269    ----------
270
271    Time_Slice_Supported : constant Boolean := False;
272    --  Indicates wether time slicing is supported (i.e FSU threads have been
273    --  compiled with DEF_RR)
274
275    type timespec is private;
276
277    type clockid_t is private;
278
279    CLOCK_REALTIME : constant clockid_t;
280
281    function clock_gettime
282      (clock_id : clockid_t;
283       tp       : access timespec) return int;
284    pragma Import (C, clock_gettime, "clock_gettime");
285
286    function To_Duration (TS : timespec) return Duration;
287    pragma Inline (To_Duration);
288
289    function To_Timespec (D : Duration) return timespec;
290    pragma Inline (To_Timespec);
291
292    type struct_timeval is private;
293
294    function To_Duration (TV : struct_timeval) return Duration;
295    pragma Inline (To_Duration);
296
297    function To_Timeval (D : Duration) return struct_timeval;
298    pragma Inline (To_Timeval);
299
300    -------------------------
301    -- Priority Scheduling --
302    -------------------------
303
304    SCHED_FIFO  : constant := 0;
305    SCHED_RR    : constant := 1;
306    SCHED_OTHER : constant := 2;
307
308    -------------
309    -- Process --
310    -------------
311
312    type pid_t is private;
313
314    function kill (pid : pid_t; sig : Signal) return int;
315    pragma Import (C, kill, "kill");
316
317    function getpid return pid_t;
318    pragma Import (C, getpid, "getpid");
319
320    ---------
321    -- LWP --
322    ---------
323
324    function lwp_self return System.Address;
325    --  lwp_self does not exist on this thread library, revert to pthread_self
326    --  which is the closest approximation (with getpid). This function is
327    --  needed to share 7staprop.adb across POSIX-like targets.
328    pragma Import (C, lwp_self, "pthread_self");
329
330    -------------
331    -- Threads --
332    -------------
333
334    type Thread_Body is access
335      function (arg : System.Address) return System.Address;
336    type pthread_t           is private;
337    subtype Thread_Id        is pthread_t;
338
339    type pthread_mutex_t     is limited private;
340    type pthread_cond_t      is limited private;
341    type pthread_attr_t      is limited private;
342    type pthread_mutexattr_t is limited private;
343    type pthread_condattr_t  is limited private;
344    type pthread_key_t       is private;
345
346    PTHREAD_CREATE_DETACHED : constant := 1;
347
348    -----------
349    -- Stack --
350    -----------
351
352    Stack_Base_Available : constant Boolean := False;
353    --  Indicates wether the stack base is available on this target.
354    --  This allows us to share s-osinte.adb between all the FSU run time.
355    --  Note that this value can only be true if pthread_t has a complete
356    --  definition that corresponds exactly to the C header files.
357
358    function Get_Stack_Base (thread : pthread_t) return Address;
359    pragma Inline (Get_Stack_Base);
360    --  returns the stack base of the specified thread.
361    --  Only call this function when Stack_Base_Available is True.
362
363    function Get_Page_Size return size_t;
364    function Get_Page_Size return Address;
365    pragma Import (C, Get_Page_Size, "getpagesize");
366    --  returns the size of a page, or 0 if this is not relevant on this
367    --  target
368
369    PROT_NONE  : constant := 0;
370    PROT_READ  : constant := 1;
371    PROT_WRITE : constant := 2;
372    PROT_EXEC  : constant := 4;
373    PROT_ALL   : constant := PROT_READ + PROT_WRITE + PROT_EXEC;
374
375    PROT_ON    : constant := PROT_NONE;
376    PROT_OFF   : constant := PROT_ALL;
377
378    function mprotect (addr : Address; len : size_t; prot : int) return int;
379    pragma Import (C, mprotect);
380
381    ---------------------------------------
382    -- Nonstandard Thread Initialization --
383    ---------------------------------------
384
385    procedure pthread_init;
386    --  FSU_THREADS requires pthread_init, which is nonstandard
387    --  and this should be invoked during the elaboration of s-taprop.adb
388    pragma Import (C, pthread_init, "pthread_init");
389
390    -------------------------
391    -- POSIX.1c  Section 3 --
392    -------------------------
393
394    function sigwait (set : access sigset_t; sig : access Signal) return int;
395    --  FSU_THREADS has a nonstandard sigwait
396
397    function pthread_kill (thread : pthread_t; sig : Signal) return int;
398    pragma Import (C, pthread_kill, "pthread_kill");
399
400    type sigset_t_ptr is access all sigset_t;
401
402    function pthread_sigmask
403      (how  : int;
404       set  : sigset_t_ptr;
405       oset : sigset_t_ptr) return int;
406    pragma Import (C, pthread_sigmask, "sigprocmask");
407
408    --------------------------
409    -- POSIX.1c  Section 11 --
410    --------------------------
411
412    function pthread_mutexattr_init
413      (attr : access pthread_mutexattr_t) return int;
414    pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init");
415
416    function pthread_mutexattr_destroy
417      (attr : access pthread_mutexattr_t) return int;
418    pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy");
419
420    function pthread_mutex_init
421      (mutex : access pthread_mutex_t;
422       attr  : access pthread_mutexattr_t) return int;
423    pragma Import (C, pthread_mutex_init, "pthread_mutex_init");
424
425    function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int;
426    pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy");
427
428    function pthread_mutex_lock (mutex : access pthread_mutex_t) return int;
429    --  FSU_THREADS has nonstandard pthread_mutex_lock
430
431    function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int;
432    --  FSU_THREADS has nonstandard pthread_mutex_lock
433
434    function pthread_condattr_init
435      (attr : access pthread_condattr_t) return int;
436    pragma Import (C, pthread_condattr_init, "pthread_condattr_init");
437
438    function pthread_condattr_destroy
439      (attr : access pthread_condattr_t) return int;
440    pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy");
441
442    function pthread_cond_init
443      (cond : access pthread_cond_t;
444       attr : access pthread_condattr_t) return int;
445    pragma Import (C, pthread_cond_init, "pthread_cond_init");
446
447    function pthread_cond_destroy (cond : access pthread_cond_t) return int;
448    pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy");
449
450    function pthread_cond_signal (cond : access pthread_cond_t) return int;
451    pragma Import (C, pthread_cond_signal, "pthread_cond_signal");
452
453    function pthread_cond_wait
454      (cond  : access pthread_cond_t;
455       mutex : access pthread_mutex_t) return int;
456    --  FSU_THREADS has a nonstandard pthread_cond_wait
457
458    function pthread_cond_timedwait
459      (cond    : access pthread_cond_t;
460       mutex   : access pthread_mutex_t;
461       abstime : access timespec) return int;
462    --  FSU_THREADS has a nonstandard pthread_cond_timedwait
463
464    Relative_Timed_Wait : constant Boolean := False;
465    --  pthread_cond_timedwait requires an absolute delay time
466
467    --------------------------
468    -- POSIX.1c  Section 13 --
469    --------------------------
470
471    PTHREAD_PRIO_NONE    : constant := 0;
472    PTHREAD_PRIO_PROTECT : constant := 2;
473    PTHREAD_PRIO_INHERIT : constant := 1;
474
475    function pthread_mutexattr_setprotocol
476      (attr     : access pthread_mutexattr_t;
477       protocol : int) return int;
478    pragma Import (C, pthread_mutexattr_setprotocol);
479
480    function pthread_mutexattr_setprioceiling
481      (attr     : access pthread_mutexattr_t;
482       prioceiling : int) return int;
483    pragma Import
484      (C, pthread_mutexattr_setprioceiling,
485       "pthread_mutexattr_setprio_ceiling");
486
487    type struct_sched_param is record
488       sched_priority : int;  --  scheduling priority
489    end record;
490
491    function pthread_setschedparam
492      (thread : pthread_t;
493       policy : int;
494       param  : access struct_sched_param) return int;
495    --  FSU_THREADS does not have pthread_setschedparam
496
497    function pthread_attr_setscope
498      (attr            : access pthread_attr_t;
499       contentionscope : int) return int;
500    pragma Import (C, pthread_attr_setscope, "pthread_attr_setscope");
501
502    function pthread_attr_setinheritsched
503      (attr            : access pthread_attr_t;
504       inheritsched : int) return int;
505    pragma Import (C, pthread_attr_setinheritsched);
506
507    function pthread_attr_setschedpolicy
508      (attr   : access pthread_attr_t;
509       policy : int) return int;
510    pragma Import (C, pthread_attr_setschedpolicy, "pthread_attr_setsched");
511
512    function sched_yield return int;
513    --  FSU_THREADS does not have sched_yield;
514
515    ---------------------------
516    -- P1003.1c - Section 16 --
517    ---------------------------
518
519    function pthread_attr_init (attributes : access pthread_attr_t) return int;
520    pragma Import (C, pthread_attr_init, "pthread_attr_init");
521
522    function pthread_attr_destroy
523      (attributes : access pthread_attr_t) return int;
524    pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy");
525
526    function pthread_attr_setdetachstate
527      (attr        : access pthread_attr_t;
528       detachstate : int) return int;
529    --  FSU_THREADS has a nonstandard pthread_attr_setdetachstate
530
531    function pthread_attr_setstacksize
532      (attr      : access pthread_attr_t;
533       stacksize : size_t) return int;
534    pragma Import (C, pthread_attr_setstacksize);
535
536    function pthread_create
537      (thread        : access pthread_t;
538       attributes    : access pthread_attr_t;
539       start_routine : Thread_Body;
540       arg           : System.Address) return int;
541    pragma Import (C, pthread_create, "pthread_create");
542
543    procedure pthread_exit (status : System.Address);
544    pragma Import (C, pthread_exit, "pthread_exit");
545
546    function pthread_self return pthread_t;
547    pragma Import (C, pthread_self, "pthread_self");
548
549    --------------------------
550    -- POSIX.1c  Section 17 --
551    --------------------------
552
553    function pthread_setspecific
554      (key   : pthread_key_t;
555       value : System.Address) return int;
556    pragma Import (C, pthread_setspecific, "pthread_setspecific");
557
558    function pthread_getspecific (key : pthread_key_t) return System.Address;
559    --  FSU_THREADS has a nonstandard pthread_getspecific
560
561    type destructor_pointer is access procedure (arg : System.Address);
562
563    function pthread_key_create
564      (key        : access pthread_key_t;
565       destructor : destructor_pointer) return int;
566    pragma Import (C, pthread_key_create, "pthread_key_create");
567
568 private
569
570    type array_type_1 is array (Integer range 0 .. 3) of unsigned_long;
571    type sigset_t is record
572       X_X_sigbits  : array_type_1;
573    end record;
574    pragma Convention (C, sigset_t);
575
576    type pid_t is new long;
577
578    type time_t is new long;
579
580    type timespec is record
581       tv_sec  : time_t;
582       tv_nsec : long;
583    end record;
584    pragma Convention (C, timespec);
585
586    type clockid_t is new int;
587    CLOCK_REALTIME : constant clockid_t := 0;
588
589    type struct_timeval is record
590       tv_sec  : long;
591       tv_usec : long;
592    end record;
593    pragma Convention (C, struct_timeval);
594
595    type pthread_attr_t is record
596       flags           : int;
597       stacksize       : int;
598       contentionscope : int;
599       inheritsched    : int;
600       detachstate     : int;
601       sched           : int;
602       prio            : int;
603       starttime       : timespec;
604       deadline        : timespec;
605       period          : timespec;
606    end record;
607    pragma Convention (C, pthread_attr_t);
608
609    type pthread_condattr_t is record
610       flags : int;
611    end record;
612    pragma Convention (C, pthread_condattr_t);
613
614    type pthread_mutexattr_t is record
615       flags        : int;
616       prio_ceiling : int;
617       protocol     : int;
618    end record;
619    pragma Convention (C, pthread_mutexattr_t);
620
621    type sigjmp_buf is array (Integer range 0 .. 18) of int;
622
623    type pthread_t_struct is record
624       context    : sigjmp_buf;
625       pbody      : sigjmp_buf;
626       errno      : int;
627       ret        : int;
628       stack_base : System.Address;
629    end record;
630    pragma Convention (C, pthread_t_struct);
631
632    type pthread_t is access all pthread_t_struct;
633
634    type queue_t is record
635       head : System.Address;
636       tail : System.Address;
637    end record;
638    pragma Convention (C, queue_t);
639
640    type pthread_mutex_t is record
641       queue                 : queue_t;
642       lock                  : plain_char;
643       owner                 : System.Address;
644       flags                 : int;
645       prio_ceiling          : int;
646       protocol              : int;
647       prev_max_ceiling_prio : int;
648    end record;
649    pragma Convention (C, pthread_mutex_t);
650
651    type pthread_cond_t is record
652       queue        : queue_t;
653       flags        : int;
654       waiters      : int;
655       mutex        : System.Address;
656    end record;
657    pragma Convention (C, pthread_cond_t);
658
659    type pthread_key_t is new int;
660
661 end System.OS_Interface;