OSDN Git Service

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