OSDN Git Service

* gcc.dg/attr-weakref-1.c: Add exit (0) to avoid spurious
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-osinte-solaris-fsu.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                 GNAT 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) 1991-1994, Florida State University            --
10 --             Copyright (C) 1995-2005, Free Software Foundation, Inc.      --
11 --                                                                          --
12 -- GNARL is free software; you can  redistribute it  and/or modify it under --
13 -- terms of the  GNU General Public License as published  by the Free Soft- --
14 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
15 -- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
18 -- for  more details.  You should have  received  a copy of the GNU General --
19 -- Public License  distributed with GNARL; see file COPYING.  If not, write --
20 -- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
21 -- Boston, MA 02110-1301, USA.                                              --
22 --                                                                          --
23 -- As a special exception,  if other files  instantiate  generics from this --
24 -- unit, or you link  this unit with other files  to produce an executable, --
25 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
26 -- covered  by the  GNU  General  Public  License.  This exception does not --
27 -- however invalidate  any other reasons why  the executable file  might be --
28 -- covered by the  GNU Public License.                                      --
29 --                                                                          --
30 -- GNARL was developed by the GNARL team at Florida State University.       --
31 -- Extensive contributions were provided by Ada Core Technologies, Inc.     --
32 --                                                                          --
33 ------------------------------------------------------------------------------
34
35 --  This is a Solaris (FSU THREADS) version of this package
36
37 --  This package includes all direct interfaces to OS services
38 --  that are needed by children of System.
39
40 --  PLEASE DO NOT add any with-clauses to this package or remove the pragma
41 --  Preelaborate. This package is designed to be a bottom-level (leaf) package.
42
43 with Interfaces.C;
44 with Unchecked_Conversion;
45
46 package System.OS_Interface is
47    pragma Preelaborate;
48
49    pragma Linker_Options ("-lgthreads");
50    pragma Linker_Options ("-lmalloc");
51
52    subtype int            is Interfaces.C.int;
53    subtype short          is Interfaces.C.short;
54    subtype long           is Interfaces.C.long;
55    subtype unsigned       is Interfaces.C.unsigned;
56    subtype unsigned_short is Interfaces.C.unsigned_short;
57    subtype unsigned_long  is Interfaces.C.unsigned_long;
58    subtype unsigned_char  is Interfaces.C.unsigned_char;
59    subtype plain_char     is Interfaces.C.plain_char;
60    subtype size_t         is Interfaces.C.size_t;
61
62    -----------
63    -- Errno --
64    -----------
65
66    function errno return int;
67    pragma Import (C, errno, "__get_errno");
68
69    EAGAIN    : constant := 11;
70    EINTR     : constant := 4;
71    EINVAL    : constant := 22;
72    ENOMEM    : constant := 12;
73    ETIMEDOUT : constant := 145;
74
75    -------------
76    -- Signals --
77    -------------
78
79    Max_Interrupt : constant := 45;
80    type Signal is new int range 0 .. Max_Interrupt;
81    for Signal'Size use int'Size;
82
83    SIGHUP     : constant := 1; --  hangup
84    SIGINT     : constant := 2; --  interrupt (rubout)
85    SIGQUIT    : constant := 3; --  quit (ASCD FS)
86    SIGILL     : constant := 4; --  illegal instruction (not reset)
87    SIGTRAP    : constant := 5; --  trace trap (not reset)
88    SIGIOT     : constant := 6; --  IOT instruction
89    SIGABRT    : constant := 6; --  used by abort, replace SIGIOT in the  future
90    SIGEMT     : constant := 7; --  EMT instruction
91    SIGFPE     : constant := 8; --  floating point exception
92    SIGKILL    : constant := 9; --  kill (cannot be caught or ignored)
93    SIGBUS     : constant := 10; --  bus error
94    SIGSEGV    : constant := 11; --  segmentation violation
95    SIGSYS     : constant := 12; --  bad argument to system call
96    SIGPIPE    : constant := 13; --  write on a pipe with no one to read it
97    SIGALRM    : constant := 14; --  alarm clock
98    SIGTERM    : constant := 15; --  software termination signal from kill
99    SIGUSR1    : constant := 16; --  user defined signal 1
100    SIGUSR2    : constant := 17; --  user defined signal 2
101    SIGCLD     : constant := 18; --  alias for SIGCHLD
102    SIGCHLD    : constant := 18; --  child status change
103    SIGPWR     : constant := 19; --  power-fail restart
104    SIGWINCH   : constant := 20; --  window size change
105    SIGURG     : constant := 21; --  urgent condition on IO channel
106    SIGPOLL    : constant := 22; --  pollable event occurred
107    SIGIO      : constant := 22; --  I/O possible (Solaris SIGPOLL alias)
108    SIGSTOP    : constant := 23; --  stop (cannot be caught or ignored)
109    SIGTSTP    : constant := 24; --  user stop requested from tty
110    SIGCONT    : constant := 25; --  stopped process has been continued
111    SIGTTIN    : constant := 26; --  background tty read attempted
112    SIGTTOU    : constant := 27; --  background tty write attempted
113    SIGVTALRM  : constant := 28; --  virtual timer expired
114    SIGPROF    : constant := 29; --  profiling timer expired
115    SIGXCPU    : constant := 30; --  CPU time limit exceeded
116    SIGXFSZ    : constant := 31; --  filesize limit exceeded
117    SIGWAITING : constant := 32; --  process's lwps blocked (Solaris)
118    SIGLWP     : constant := 33; --  used by thread library (Solaris)
119    SIGFREEZE  : constant := 34; --  used by CPR (Solaris)
120    SIGTHAW    : constant := 35; --  used by CPR (Solaris)
121    SIGCANCEL  : constant := 36; --  used for thread cancel (Solaris)
122    SIGRTMIN   : constant := 38; --  first (highest-priority) realtime signal
123    SIGRTMAX   : constant := 45; --  last (lowest-priority) realtime signal
124
125    type Signal_Set is array (Natural range <>) of Signal;
126
127    Unmasked    : constant Signal_Set :=
128      (SIGTRAP, SIGLWP, SIGTTIN, SIGTTOU, SIGTSTP, SIGPROF);
129
130    Reserved    : constant Signal_Set :=
131      (SIGKILL, SIGSTOP, SIGALRM, SIGVTALRM, SIGWAITING, SIGRTMAX);
132
133    type sigset_t is private;
134
135    function sigaddset (set : access sigset_t; sig : Signal) return int;
136    pragma Import (C, sigaddset, "sigaddset");
137
138    function sigdelset (set : access sigset_t; sig : Signal) return int;
139    pragma Import (C, sigdelset, "sigdelset");
140
141    function sigfillset (set : access sigset_t) return int;
142    pragma Import (C, sigfillset, "sigfillset");
143
144    function sigismember (set : access sigset_t; sig : Signal) return int;
145    pragma Import (C, sigismember, "sigismember");
146
147    function sigemptyset (set : access sigset_t) return int;
148    pragma Import (C, sigemptyset, "sigemptyset");
149
150    type union_type_3 is new String (1 .. 116);
151    type siginfo_t is record
152       si_signo     : int;
153       si_code      : int;
154       si_errno     : int;
155       X_data       : union_type_3;
156    end record;
157    pragma Convention (C, siginfo_t);
158
159    --  The types mcontext_t and gregset_t are part of the ucontext_t
160    --  information, which is specific to Solaris2.4 for SPARC
161    --  The ucontext_t info seems to be used by the handler
162    --  for SIGSEGV to decide whether it is a Storage_Error (stack overflow) or
163    --  a Constraint_Error (bad pointer).  The original code that did this
164    --  is suspect, so it is not clear whether we really need this part of
165    --  the signal context information, or perhaps something else.
166    --  More analysis is needed, after which these declarations may need to
167    --  be changed.
168
169    EMT_TAGOVF  : constant := 1; --  tag overflow
170    FPE_INTDIV  : constant := 1; --  integer divide by zero
171    FPE_INTOVF  : constant := 2; --  integer overflow
172    FPE_FLTDIV  : constant := 3; --  floating point divide by zero
173    FPE_FLTOVF  : constant := 4; --  floating point overflow
174    FPE_FLTUND  : constant := 5; --  floating point underflow
175    FPE_FLTRES  : constant := 6; --  floating point inexact result
176    FPE_FLTINV  : constant := 7; --  invalid floating point operation
177    FPE_FLTSUB  : constant := 8; --  subscript out of range
178
179    SEGV_MAPERR : constant := 1; --  address not mapped to object
180    SEGV_ACCERR : constant := 2; --  invalid permissions
181
182    BUS_ADRALN  : constant := 1; --  invalid address alignment
183    BUS_ADRERR  : constant := 2; --  non-existent physical address
184    BUS_OBJERR  : constant := 3; --  object specific hardware error
185
186    ILL_ILLOPC  : constant := 1; --  illegal opcode
187    ILL_ILLOPN  : constant := 2; --  illegal operand
188    ILL_ILLADR  : constant := 3; --  illegal addressing mode
189    ILL_ILLTRP  : constant := 4; --  illegal trap
190    ILL_PRVOPC  : constant := 5; --  privileged opcode
191    ILL_PRVREG  : constant := 6; --  privileged register
192    ILL_COPROC  : constant := 7; --  co-processor
193    ILL_BADSTK  : constant := 8; --  bad stack
194
195    type greg_t is new int;
196
197    type gregset_t is array (Integer range 0 .. 18) of greg_t;
198
199    REG_O0 : constant := 11;
200    --  index of saved register O0 in ucontext.uc_mcontext.gregs array
201
202    type union_type_2 is new String (1 .. 128);
203    type record_type_1 is record
204       fpu_fr       : union_type_2;
205       fpu_q        : System.Address;
206       fpu_fsr      : unsigned;
207       fpu_qcnt     : unsigned_char;
208       fpu_q_entrysize  : unsigned_char;
209       fpu_en       : unsigned_char;
210    end record;
211    pragma Convention (C, record_type_1);
212    type array_type_7 is array (Integer range 0 .. 20) of long;
213    type mcontext_t is record
214       gregs        : gregset_t;
215       gwins        : System.Address;
216       fpregs       : record_type_1;
217       filler       : array_type_7;
218    end record;
219    pragma Convention (C, mcontext_t);
220
221    type record_type_2 is record
222       ss_sp        : System.Address;
223       ss_size      : int;
224       ss_flags     : int;
225    end record;
226    pragma Convention (C, record_type_2);
227    type array_type_8 is array (Integer range 0 .. 22) of long;
228    type ucontext_t is record
229       uc_flags     : unsigned_long;
230       uc_link      : System.Address;
231       uc_sigmask   : sigset_t;
232       uc_stack     : record_type_2;
233       uc_mcontext  : mcontext_t;
234       uc_filler    : array_type_8;
235    end record;
236    pragma Convention (C, ucontext_t);
237
238    type Signal_Handler is access procedure
239       (signo   : Signal;
240        info    : access siginfo_t;
241        context : access ucontext_t);
242
243    type union_type_1 is new plain_char;
244    type array_type_2 is array (Integer range 0 .. 1) of int;
245    type struct_sigaction is record
246       sa_flags     : int;
247       sa_handler   : System.Address;
248       sa_mask      : sigset_t;
249       sa_resv      : array_type_2;
250    end record;
251    pragma Convention (C, struct_sigaction);
252    type struct_sigaction_ptr is access all struct_sigaction;
253
254    SA_SIGINFO  : constant := 16#08#;
255
256    SIG_BLOCK   : constant := 1;
257    SIG_UNBLOCK : constant := 2;
258    SIG_SETMASK : constant := 3;
259
260    SIG_DFL : constant := 0;
261    SIG_IGN : constant := 1;
262
263    function sigaction
264      (sig  : Signal;
265       act  : struct_sigaction_ptr;
266       oact : struct_sigaction_ptr) return int;
267    pragma Import (C, sigaction, "sigaction");
268
269    ----------
270    -- Time --
271    ----------
272
273    Time_Slice_Supported : constant Boolean := False;
274    --  Indicates wether time slicing is supported (i.e FSU threads have been
275    --  compiled with DEF_RR)
276
277    type timespec is private;
278
279    type clockid_t is private;
280
281    CLOCK_REALTIME : constant clockid_t;
282
283    function clock_gettime
284      (clock_id : clockid_t;
285       tp       : access timespec) return int;
286    pragma Import (C, clock_gettime, "clock_gettime");
287
288    function To_Duration (TS : timespec) return Duration;
289    pragma Inline (To_Duration);
290
291    function To_Timespec (D : Duration) return timespec;
292    pragma Inline (To_Timespec);
293
294    type struct_timeval is private;
295
296    function To_Duration (TV : struct_timeval) return Duration;
297    pragma Inline (To_Duration);
298
299    function To_Timeval (D : Duration) return struct_timeval;
300    pragma Inline (To_Timeval);
301
302    -------------------------
303    -- Priority Scheduling --
304    -------------------------
305
306    SCHED_FIFO  : constant := 0;
307    SCHED_RR    : constant := 1;
308    SCHED_OTHER : constant := 2;
309
310    -------------
311    -- Process --
312    -------------
313
314    type pid_t is private;
315
316    function kill (pid : pid_t; sig : Signal) return int;
317    pragma Import (C, kill, "kill");
318
319    function getpid return pid_t;
320    pragma Import (C, getpid, "getpid");
321
322    ---------
323    -- LWP --
324    ---------
325
326    function lwp_self return System.Address;
327    --  lwp_self does not exist on this thread library, revert to pthread_self
328    --  which is the closest approximation (with getpid). This function is
329    --  needed to share 7staprop.adb across POSIX-like targets.
330    pragma Import (C, lwp_self, "pthread_self");
331
332    -------------
333    -- Threads --
334    -------------
335
336    type Thread_Body is access
337      function (arg : System.Address) return System.Address;
338
339    function Thread_Body_Access is new
340      Unchecked_Conversion (System.Address, Thread_Body);
341
342    type pthread_t           is private;
343    subtype Thread_Id        is pthread_t;
344
345    type pthread_mutex_t     is limited private;
346    type pthread_cond_t      is limited private;
347    type pthread_attr_t      is limited private;
348    type pthread_mutexattr_t is limited private;
349    type pthread_condattr_t  is limited private;
350    type pthread_key_t       is private;
351
352    PTHREAD_CREATE_DETACHED : constant := 1;
353
354    -----------
355    -- Stack --
356    -----------
357
358    Stack_Base_Available : constant Boolean := False;
359    --  Indicates wether the stack base is available on this target.
360    --  This allows us to share s-osinte.adb between all the FSU run time.
361    --  Note that this value can only be true if pthread_t has a complete
362    --  definition that corresponds exactly to the C header files.
363
364    function Get_Stack_Base (thread : pthread_t) return Address;
365    pragma Inline (Get_Stack_Base);
366    --  returns the stack base of the specified thread.
367    --  Only call this function when Stack_Base_Available is True.
368
369    function Get_Page_Size return size_t;
370    function Get_Page_Size return Address;
371    pragma Import (C, Get_Page_Size, "getpagesize");
372    --  returns the size of a page, or 0 if this is not relevant on this
373    --  target
374
375    PROT_NONE  : constant := 0;
376    PROT_READ  : constant := 1;
377    PROT_WRITE : constant := 2;
378    PROT_EXEC  : constant := 4;
379    PROT_ALL   : constant := PROT_READ + PROT_WRITE + PROT_EXEC;
380
381    PROT_ON    : constant := PROT_NONE;
382    PROT_OFF   : constant := PROT_ALL;
383
384    function mprotect (addr : Address; len : size_t; prot : int) return int;
385    pragma Import (C, mprotect);
386
387    ---------------------------------------
388    -- Nonstandard Thread Initialization --
389    ---------------------------------------
390
391    procedure pthread_init;
392    --  FSU_THREADS requires pthread_init, which is nonstandard
393    --  and this should be invoked during the elaboration of s-taprop.adb
394    pragma Import (C, pthread_init, "pthread_init");
395
396    -------------------------
397    -- POSIX.1c  Section 3 --
398    -------------------------
399
400    function sigwait (set : access sigset_t; sig : access Signal) return int;
401    --  FSU_THREADS has a nonstandard sigwait
402
403    function pthread_kill (thread : pthread_t; sig : Signal) return int;
404    pragma Import (C, pthread_kill, "pthread_kill");
405
406    type sigset_t_ptr is access all sigset_t;
407
408    function pthread_sigmask
409      (how  : int;
410       set  : sigset_t_ptr;
411       oset : sigset_t_ptr) return int;
412    pragma Import (C, pthread_sigmask, "sigprocmask");
413
414    --------------------------
415    -- POSIX.1c  Section 11 --
416    --------------------------
417
418    function pthread_mutexattr_init
419      (attr : access pthread_mutexattr_t) return int;
420    pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init");
421
422    function pthread_mutexattr_destroy
423      (attr : access pthread_mutexattr_t) return int;
424    pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy");
425
426    function pthread_mutex_init
427      (mutex : access pthread_mutex_t;
428       attr  : access pthread_mutexattr_t) return int;
429    pragma Import (C, pthread_mutex_init, "pthread_mutex_init");
430
431    function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int;
432    pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy");
433
434    function pthread_mutex_lock (mutex : access pthread_mutex_t) return int;
435    --  FSU_THREADS has nonstandard pthread_mutex_lock
436
437    function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int;
438    --  FSU_THREADS has nonstandard pthread_mutex_lock
439
440    function pthread_condattr_init
441      (attr : access pthread_condattr_t) return int;
442    pragma Import (C, pthread_condattr_init, "pthread_condattr_init");
443
444    function pthread_condattr_destroy
445      (attr : access pthread_condattr_t) return int;
446    pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy");
447
448    function pthread_cond_init
449      (cond : access pthread_cond_t;
450       attr : access pthread_condattr_t) return int;
451    pragma Import (C, pthread_cond_init, "pthread_cond_init");
452
453    function pthread_cond_destroy (cond : access pthread_cond_t) return int;
454    pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy");
455
456    function pthread_cond_signal (cond : access pthread_cond_t) return int;
457    pragma Import (C, pthread_cond_signal, "pthread_cond_signal");
458
459    function pthread_cond_wait
460      (cond  : access pthread_cond_t;
461       mutex : access pthread_mutex_t) return int;
462    --  FSU_THREADS has a nonstandard pthread_cond_wait
463
464    function pthread_cond_timedwait
465      (cond    : access pthread_cond_t;
466       mutex   : access pthread_mutex_t;
467       abstime : access timespec) return int;
468    --  FSU_THREADS has a nonstandard pthread_cond_timedwait
469
470    Relative_Timed_Wait : constant Boolean := False;
471    --  pthread_cond_timedwait requires an absolute delay time
472
473    --------------------------
474    -- POSIX.1c  Section 13 --
475    --------------------------
476
477    PTHREAD_PRIO_NONE    : constant := 0;
478    PTHREAD_PRIO_PROTECT : constant := 2;
479    PTHREAD_PRIO_INHERIT : constant := 1;
480
481    function pthread_mutexattr_setprotocol
482      (attr     : access pthread_mutexattr_t;
483       protocol : int) return int;
484    pragma Import (C, pthread_mutexattr_setprotocol);
485
486    function pthread_mutexattr_setprioceiling
487      (attr     : access pthread_mutexattr_t;
488       prioceiling : int) return int;
489    pragma Import
490      (C, pthread_mutexattr_setprioceiling,
491       "pthread_mutexattr_setprio_ceiling");
492
493    type struct_sched_param is record
494       sched_priority : int;  --  scheduling priority
495    end record;
496
497    function pthread_setschedparam
498      (thread : pthread_t;
499       policy : int;
500       param  : access struct_sched_param) return int;
501    --  FSU_THREADS does not have pthread_setschedparam
502
503    function pthread_attr_setscope
504      (attr            : access pthread_attr_t;
505       contentionscope : int) return int;
506    pragma Import (C, pthread_attr_setscope, "pthread_attr_setscope");
507
508    function pthread_attr_setinheritsched
509      (attr            : access pthread_attr_t;
510       inheritsched : int) return int;
511    pragma Import (C, pthread_attr_setinheritsched);
512
513    function pthread_attr_setschedpolicy
514      (attr   : access pthread_attr_t;
515       policy : int) return int;
516    pragma Import (C, pthread_attr_setschedpolicy, "pthread_attr_setsched");
517
518    function sched_yield return int;
519    --  FSU_THREADS does not have sched_yield;
520
521    ---------------------------
522    -- P1003.1c - Section 16 --
523    ---------------------------
524
525    function pthread_attr_init (attributes : access pthread_attr_t) return int;
526    pragma Import (C, pthread_attr_init, "pthread_attr_init");
527
528    function pthread_attr_destroy
529      (attributes : access pthread_attr_t) return int;
530    pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy");
531
532    function pthread_attr_setdetachstate
533      (attr        : access pthread_attr_t;
534       detachstate : int) return int;
535    --  FSU_THREADS has a nonstandard pthread_attr_setdetachstate
536
537    function pthread_attr_setstacksize
538      (attr      : access pthread_attr_t;
539       stacksize : size_t) return int;
540    pragma Import (C, pthread_attr_setstacksize);
541
542    function pthread_create
543      (thread        : access pthread_t;
544       attributes    : access pthread_attr_t;
545       start_routine : Thread_Body;
546       arg           : System.Address) return int;
547    pragma Import (C, pthread_create, "pthread_create");
548
549    procedure pthread_exit (status : System.Address);
550    pragma Import (C, pthread_exit, "pthread_exit");
551
552    function pthread_self return pthread_t;
553    pragma Import (C, pthread_self, "pthread_self");
554
555    --------------------------
556    -- POSIX.1c  Section 17 --
557    --------------------------
558
559    function pthread_setspecific
560      (key   : pthread_key_t;
561       value : System.Address) return int;
562    pragma Import (C, pthread_setspecific, "pthread_setspecific");
563
564    function pthread_getspecific (key : pthread_key_t) return System.Address;
565    --  FSU_THREADS has a nonstandard pthread_getspecific
566
567    type destructor_pointer is access procedure (arg : System.Address);
568
569    function pthread_key_create
570      (key        : access pthread_key_t;
571       destructor : destructor_pointer) return int;
572    pragma Import (C, pthread_key_create, "pthread_key_create");
573
574 private
575
576    type array_type_1 is array (Integer range 0 .. 3) of unsigned_long;
577    type sigset_t is record
578       X_X_sigbits  : array_type_1;
579    end record;
580    pragma Convention (C, sigset_t);
581
582    type pid_t is new long;
583
584    type time_t is new long;
585
586    type timespec is record
587       tv_sec  : time_t;
588       tv_nsec : long;
589    end record;
590    pragma Convention (C, timespec);
591
592    type clockid_t is new int;
593    CLOCK_REALTIME : constant clockid_t := 0;
594
595    type struct_timeval is record
596       tv_sec  : long;
597       tv_usec : long;
598    end record;
599    pragma Convention (C, struct_timeval);
600
601    type pthread_attr_t is record
602       flags           : int;
603       stacksize       : int;
604       contentionscope : int;
605       inheritsched    : int;
606       detachstate     : int;
607       sched           : int;
608       prio            : int;
609       starttime       : timespec;
610       deadline        : timespec;
611       period          : timespec;
612    end record;
613    pragma Convention (C, pthread_attr_t);
614
615    type pthread_condattr_t is record
616       flags : int;
617    end record;
618    pragma Convention (C, pthread_condattr_t);
619
620    type pthread_mutexattr_t is record
621       flags        : int;
622       prio_ceiling : int;
623       protocol     : int;
624    end record;
625    pragma Convention (C, pthread_mutexattr_t);
626
627    type sigjmp_buf is array (Integer range 0 .. 18) of int;
628
629    type pthread_t_struct is record
630       context    : sigjmp_buf;
631       pbody      : sigjmp_buf;
632       errno      : int;
633       ret        : int;
634       stack_base : System.Address;
635    end record;
636    pragma Convention (C, pthread_t_struct);
637
638    type pthread_t is access all pthread_t_struct;
639
640    type queue_t is record
641       head : System.Address;
642       tail : System.Address;
643    end record;
644    pragma Convention (C, queue_t);
645
646    type pthread_mutex_t is record
647       queue                 : queue_t;
648       lock                  : plain_char;
649       owner                 : System.Address;
650       flags                 : int;
651       prio_ceiling          : int;
652       protocol              : int;
653       prev_max_ceiling_prio : int;
654    end record;
655    pragma Convention (C, pthread_mutex_t);
656
657    type pthread_cond_t is record
658       queue        : queue_t;
659       flags        : int;
660       waiters      : int;
661       mutex        : System.Address;
662    end record;
663    pragma Convention (C, pthread_cond_t);
664
665    type pthread_key_t is new int;
666
667 end System.OS_Interface;