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-2012, Free Software Foundation, Inc.         --
11--                                                                          --
12-- GNAT 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 3,  or (at your option) any later ver- --
15-- sion.  GNAT 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.                                     --
18--                                                                          --
19-- As a special exception under Section 7 of GPL version 3, you are granted --
20-- additional permissions described in the GCC Runtime Library Exception,   --
21-- version 3.1, as published by the Free Software Foundation.               --
22--                                                                          --
23-- You should have received a copy of the GNU General Public License and    --
24-- a copy of the GCC Runtime Library Exception along with this program;     --
25-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
26-- <http://www.gnu.org/licenses/>.                                          --
27--                                                                          --
28-- GNARL was developed by the GNARL team at Florida State University.       --
29-- Extensive contributions were provided by Ada Core Technologies, Inc.     --
30--                                                                          --
31------------------------------------------------------------------------------
32
33--  This is the OpenVMS version of this package
34
35--  This package encapsulates all direct interfaces to OS services
36--  that are needed by the tasking run-time (libgnarl).
37
38--  PLEASE DO NOT add any with-clauses to this package or remove the pragma
39--  Preelaborate. This package is designed to be a bottom-level (leaf) package.
40
41with Interfaces.C;
42
43with Ada.Unchecked_Conversion;
44
45with System.Aux_DEC;
46
47package System.OS_Interface is
48   pragma Preelaborate;
49
50   --  pragma Linker_Options ("--for-linker=/threads_enable");
51   --  Enable upcalls and multiple kernel threads.
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   -- Signals (Interrupt IDs) --
65   -----------------------------
66
67   --  Type signal has an arbitrary limit of 31
68
69   Max_Interrupt : constant := 31;
70   type Signal is new unsigned range 0 .. Max_Interrupt;
71   for Signal'Size use unsigned'Size;
72
73   type sigset_t is array (Signal) of Boolean;
74   pragma Pack (sigset_t);
75
76   --  Interrupt_Number_Type
77   --  Unsigned long integer denoting the number of an interrupt
78
79   subtype Interrupt_Number_Type is unsigned_long;
80
81   --  OpenVMS system services return values of type Cond_Value_Type
82
83   subtype Cond_Value_Type is unsigned_long;
84   subtype Short_Cond_Value_Type is unsigned_short;
85
86   type IO_Status_Block_Type is record
87      Status   : Short_Cond_Value_Type;
88      Count    : unsigned_short;
89      Dev_Info : unsigned_long;
90   end record;
91
92   type AST_Handler is access procedure (Param : Address);
93   pragma Convention (C, AST_Handler);
94   No_AST_Handler : constant AST_Handler := null;
95
96   CMB_M_READONLY  : constant := 16#00000001#;
97   CMB_M_WRITEONLY : constant := 16#00000002#;
98   AGN_M_READONLY  : constant := 16#00000001#;
99   AGN_M_WRITEONLY : constant := 16#00000002#;
100
101   IO_WRITEVBLK : constant := 48;  --  WRITE VIRTUAL BLOCK
102   IO_READVBLK  : constant := 49;  --  READ VIRTUAL BLOCK
103
104   ----------------
105   -- Sys_Assign --
106   ----------------
107   --
108   --  Assign I/O Channel
109   --
110   --  Status = returned status
111   --  Devnam = address  of  device  name  or  logical  name   string
112   --               descriptor
113   --  Chan   = address of word to receive channel number assigned
114   --  Acmode = access mode associated with channel
115   --  Mbxnam = address of mailbox logical name string descriptor, if
116   --               mailbox associated with device
117   --  Flags  = optional channel flags longword for specifying options
118   --           for the $ASSIGN operation
119   --
120
121   procedure Sys_Assign
122     (Status : out Cond_Value_Type;
123      Devnam : String;
124      Chan   : out unsigned_short;
125      Acmode : unsigned_short := 0;
126      Mbxnam : String := String'Null_Parameter;
127      Flags  : unsigned_long := 0);
128   pragma Import (External, Sys_Assign);
129   pragma Import_Valued_Procedure
130     (Sys_Assign, "SYS$ASSIGN",
131      (Cond_Value_Type, String,         unsigned_short,
132       unsigned_short,  String,         unsigned_long),
133      (Value,           Descriptor (s), Reference,
134       Value,           Descriptor (s), Value),
135      Flags);
136
137   ----------------
138   -- Sys_Cantim --
139   ----------------
140   --
141   --  Cancel Timer
142   --
143   --  Status  = returned status
144   --  Reqidt  = ID of timer to be cancelled
145   --  Acmode  = Access mode
146   --
147   procedure Sys_Cantim
148     (Status : out Cond_Value_Type;
149      Reqidt : Address;
150      Acmode : unsigned);
151   pragma Import (External, Sys_Cantim);
152   pragma Import_Valued_Procedure
153     (Sys_Cantim, "SYS$CANTIM",
154      (Cond_Value_Type, Address, unsigned),
155      (Value,           Value,   Value));
156
157   ----------------
158   -- Sys_Crembx --
159   ----------------
160   --
161   --  Create mailbox
162   --
163   --     Status  = returned status
164   --     Prmflg  = permanent flag
165   --     Chan    = channel
166   --     Maxmsg  = maximum message
167   --     Bufquo  = buufer quote
168   --     Promsk  = protection mast
169   --     Acmode  = access mode
170   --     Lognam  = logical name
171   --     Flags   = flags
172   --
173   procedure Sys_Crembx
174     (Status : out Cond_Value_Type;
175      Prmflg : unsigned_char;
176      Chan   : out unsigned_short;
177      Maxmsg : unsigned_long := 0;
178      Bufquo : unsigned_long := 0;
179      Promsk : unsigned_short := 0;
180      Acmode : unsigned_short := 0;
181      Lognam : String;
182      Flags  : unsigned_long := 0);
183   pragma Import (External, Sys_Crembx);
184   pragma Import_Valued_Procedure
185     (Sys_Crembx, "SYS$CREMBX",
186      (Cond_Value_Type, unsigned_char,  unsigned_short,
187       unsigned_long,   unsigned_long,  unsigned_short,
188       unsigned_short,  String,         unsigned_long),
189      (Value,           Value,          Reference,
190       Value,           Value,          Value,
191       Value,           Descriptor (s), Value));
192
193   -------------
194   -- Sys_QIO --
195   -------------
196   --
197   --    Queue I/O
198   --
199   --     Status = Returned status of call
200   --     EFN    = event flag to be set when I/O completes
201   --     Chan   = channel
202   --     Func   = function
203   --     Iosb   = I/O status block
204   --     Astadr = system trap to be generated when I/O completes
205   --     Astprm = AST parameter
206   --     P1-6   = optional parameters
207
208   procedure Sys_QIO
209     (Status : out Cond_Value_Type;
210      EFN    : unsigned_long := 0;
211      Chan   : unsigned_short;
212      Func   : unsigned_long := 0;
213      Iosb   : out IO_Status_Block_Type;
214      Astadr : AST_Handler := No_AST_Handler;
215      Astprm : Address := Null_Address;
216      P1     : unsigned_long := 0;
217      P2     : unsigned_long := 0;
218      P3     : unsigned_long := 0;
219      P4     : unsigned_long := 0;
220      P5     : unsigned_long := 0;
221      P6     : unsigned_long := 0);
222
223   procedure Sys_QIO
224     (Status : out Cond_Value_Type;
225      EFN    : unsigned_long := 0;
226      Chan   : unsigned_short;
227      Func   : unsigned_long := 0;
228      Iosb   : Address := Null_Address;
229      Astadr : AST_Handler := No_AST_Handler;
230      Astprm : Address := Null_Address;
231      P1     : unsigned_long := 0;
232      P2     : unsigned_long := 0;
233      P3     : unsigned_long := 0;
234      P4     : unsigned_long := 0;
235      P5     : unsigned_long := 0;
236      P6     : unsigned_long := 0);
237
238   pragma Import (External, Sys_QIO);
239   pragma Import_Valued_Procedure
240     (Sys_QIO, "SYS$QIO",
241      (Cond_Value_Type,      unsigned_long, unsigned_short, unsigned_long,
242       IO_Status_Block_Type, AST_Handler,   Address,
243       unsigned_long,        unsigned_long, unsigned_long,
244       unsigned_long,        unsigned_long, unsigned_long),
245      (Value,                Value,         Value,          Value,
246       Reference,            Value,         Value,
247       Value,                Value,         Value,
248       Value,                Value,         Value));
249
250   pragma Import_Valued_Procedure
251     (Sys_QIO, "SYS$QIO",
252      (Cond_Value_Type, unsigned_long, unsigned_short, unsigned_long,
253       Address,         AST_Handler,   Address,
254       unsigned_long,   unsigned_long, unsigned_long,
255       unsigned_long,   unsigned_long, unsigned_long),
256      (Value,           Value,         Value,          Value,
257       Value,           Value,         Value,
258       Value,           Value,         Value,
259       Value,           Value,         Value));
260
261   ----------------
262   -- Sys_Setimr --
263   ----------------
264   --
265   --    Set Timer
266   --
267   --     Status = Returned status of call
268   --     EFN    = event flag to be set when timer expires
269   --     Tim    = expiration time
270   --     AST    = system trap to be generated when timer expires
271   --     Redidt = returned ID of timer (e.g. to cancel timer)
272   --     Flags  = flags
273   --
274   procedure Sys_Setimr
275     (Status : out Cond_Value_Type;
276      EFN    : unsigned_long;
277      Tim    : Long_Integer;
278      AST    : AST_Handler;
279      Reqidt : Address;
280      Flags  : unsigned_long);
281   pragma Import (External, Sys_Setimr);
282   pragma Import_Valued_Procedure
283     (Sys_Setimr, "SYS$SETIMR",
284      (Cond_Value_Type, unsigned_long,     Long_Integer,
285       AST_Handler,     Address,           unsigned_long),
286      (Value,           Value,             Reference,
287       Value,           Value,             Value));
288
289   Interrupt_ID_0   : constant  := 0;
290   Interrupt_ID_1   : constant  := 1;
291   Interrupt_ID_2   : constant  := 2;
292   Interrupt_ID_3   : constant  := 3;
293   Interrupt_ID_4   : constant  := 4;
294   Interrupt_ID_5   : constant  := 5;
295   Interrupt_ID_6   : constant  := 6;
296   Interrupt_ID_7   : constant  := 7;
297   Interrupt_ID_8   : constant  := 8;
298   Interrupt_ID_9   : constant  := 9;
299   Interrupt_ID_10  : constant  := 10;
300   Interrupt_ID_11  : constant  := 11;
301   Interrupt_ID_12  : constant  := 12;
302   Interrupt_ID_13  : constant  := 13;
303   Interrupt_ID_14  : constant  := 14;
304   Interrupt_ID_15  : constant  := 15;
305   Interrupt_ID_16  : constant  := 16;
306   Interrupt_ID_17  : constant  := 17;
307   Interrupt_ID_18  : constant  := 18;
308   Interrupt_ID_19  : constant  := 19;
309   Interrupt_ID_20  : constant  := 20;
310   Interrupt_ID_21  : constant  := 21;
311   Interrupt_ID_22  : constant  := 22;
312   Interrupt_ID_23  : constant  := 23;
313   Interrupt_ID_24  : constant  := 24;
314   Interrupt_ID_25  : constant  := 25;
315   Interrupt_ID_26  : constant  := 26;
316   Interrupt_ID_27  : constant  := 27;
317   Interrupt_ID_28  : constant  := 28;
318   Interrupt_ID_29  : constant  := 29;
319   Interrupt_ID_30  : constant  := 30;
320   Interrupt_ID_31  : constant  := 31;
321
322   -----------
323   -- Errno --
324   -----------
325
326   function errno return int;
327   pragma Import (C, errno, "__get_errno");
328
329   EINTR  : constant := 4;   --  Interrupted system call
330   EAGAIN : constant := 11;  --  No more processes
331   ENOMEM : constant := 12;  --  Not enough core
332
333   -------------------------
334   -- Priority Scheduling --
335   -------------------------
336
337   SCHED_FIFO  : constant := 1;
338   SCHED_RR    : constant := 2;
339   SCHED_OTHER : constant := 3;
340   SCHED_BG    : constant := 4;
341   SCHED_LFI   : constant := 5;
342   SCHED_LRR   : constant := 6;
343
344   -------------
345   -- Process --
346   -------------
347
348   type pid_t is private;
349
350   function kill (pid : pid_t; sig : Signal) return int;
351   pragma Import (C, kill);
352
353   function getpid return pid_t;
354   pragma Import (C, getpid);
355
356   -------------
357   -- Threads --
358   -------------
359
360   type Thread_Body is access
361     function (arg : System.Address) return System.Address;
362   pragma Convention (C, Thread_Body);
363
364   function Thread_Body_Access is new
365     Ada.Unchecked_Conversion (System.Aux_DEC.Short_Address, Thread_Body);
366
367   type pthread_t           is private;
368   subtype Thread_Id        is pthread_t;
369
370   type pthread_mutex_t     is limited private;
371   type pthread_cond_t      is limited private;
372   type pthread_attr_t      is limited private;
373   type pthread_mutexattr_t is limited private;
374   type pthread_condattr_t  is limited private;
375   type pthread_key_t       is private;
376
377   PTHREAD_CREATE_JOINABLE     : constant := 0;
378   PTHREAD_CREATE_DETACHED     : constant := 1;
379
380   PTHREAD_CANCEL_DISABLE      : constant := 0;
381   PTHREAD_CANCEL_ENABLE       : constant := 1;
382
383   PTHREAD_CANCEL_DEFERRED     : constant := 0;
384   PTHREAD_CANCEL_ASYNCHRONOUS : constant := 1;
385
386   --  Don't use ERRORCHECK mutexes, they don't work when a thread is not
387   --  the owner.  AST's, at least, unlock others threads mutexes. Even
388   --  if the error is ignored, they don't work.
389   PTHREAD_MUTEX_NORMAL_NP     : constant := 0;
390   PTHREAD_MUTEX_RECURSIVE_NP  : constant := 1;
391   PTHREAD_MUTEX_ERRORCHECK_NP : constant := 2;
392
393   PTHREAD_INHERIT_SCHED       : constant := 0;
394   PTHREAD_EXPLICIT_SCHED      : constant := 1;
395
396   function pthread_cancel (thread : pthread_t) return int;
397   pragma Import (C, pthread_cancel, "PTHREAD_CANCEL");
398
399   procedure pthread_testcancel;
400   pragma Import (C, pthread_testcancel, "PTHREAD_TESTCANCEL");
401
402   function pthread_setcancelstate
403     (newstate : int; oldstate : access int) return int;
404   pragma Import (C, pthread_setcancelstate, "PTHREAD_SETCANCELSTATE");
405
406   function pthread_setcanceltype
407     (newtype : int; oldtype : access int) return int;
408   pragma Import (C, pthread_setcanceltype, "PTHREAD_SETCANCELTYPE");
409
410   -------------------------
411   -- POSIX.1c  Section 3 --
412   -------------------------
413
414   function pthread_lock_global_np return int;
415   pragma Import (C, pthread_lock_global_np, "PTHREAD_LOCK_GLOBAL_NP");
416
417   function pthread_unlock_global_np return int;
418   pragma Import (C, pthread_unlock_global_np, "PTHREAD_UNLOCK_GLOBAL_NP");
419
420   --------------------------
421   -- POSIX.1c  Section 11 --
422   --------------------------
423
424   function pthread_mutexattr_init
425     (attr : access pthread_mutexattr_t) return int;
426   pragma Import (C, pthread_mutexattr_init, "PTHREAD_MUTEXATTR_INIT");
427
428   function pthread_mutexattr_destroy
429     (attr : access pthread_mutexattr_t) return int;
430   pragma Import (C, pthread_mutexattr_destroy, "PTHREAD_MUTEXATTR_DESTROY");
431
432   function pthread_mutexattr_settype_np
433     (attr      : access pthread_mutexattr_t;
434      mutextype : int) return int;
435   pragma Import (C, pthread_mutexattr_settype_np,
436                     "PTHREAD_MUTEXATTR_SETTYPE_NP");
437
438   function pthread_mutex_init
439     (mutex : access pthread_mutex_t;
440      attr  : access pthread_mutexattr_t) return int;
441   pragma Import (C, pthread_mutex_init, "PTHREAD_MUTEX_INIT");
442
443   function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int;
444   pragma Import (C, pthread_mutex_destroy, "PTHREAD_MUTEX_DESTROY");
445
446   function pthread_mutex_lock (mutex : access pthread_mutex_t) return int;
447   pragma Import (C, pthread_mutex_lock, "PTHREAD_MUTEX_LOCK");
448
449   function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int;
450   pragma Import (C, pthread_mutex_unlock, "PTHREAD_MUTEX_UNLOCK");
451
452   function pthread_mutex_setname_np
453     (attr : access pthread_mutex_t;
454      name : System.Address;
455      mbz  : System.Address) return int;
456   pragma Import (C, pthread_mutex_setname_np, "PTHREAD_MUTEX_SETNAME_NP");
457
458   function pthread_condattr_init
459     (attr : access pthread_condattr_t) return int;
460   pragma Import (C, pthread_condattr_init, "PTHREAD_CONDATTR_INIT");
461
462   function pthread_condattr_destroy
463     (attr : access pthread_condattr_t) return int;
464   pragma Import (C, pthread_condattr_destroy, "PTHREAD_CONDATTR_DESTROY");
465
466   function pthread_cond_init
467     (cond : access pthread_cond_t;
468      attr : access pthread_condattr_t) return int;
469   pragma Import (C, pthread_cond_init, "PTHREAD_COND_INIT");
470
471   function pthread_cond_destroy (cond : access pthread_cond_t) return int;
472   pragma Import (C, pthread_cond_destroy, "PTHREAD_COND_DESTROY");
473
474   function pthread_cond_signal (cond : access pthread_cond_t) return int;
475   pragma Import (C, pthread_cond_signal, "PTHREAD_COND_SIGNAL");
476
477   function pthread_cond_signal_int_np
478     (cond : access pthread_cond_t) return int;
479   pragma Import (C, pthread_cond_signal_int_np,
480                  "PTHREAD_COND_SIGNAL_INT_NP");
481
482   function pthread_cond_wait
483     (cond  : access pthread_cond_t;
484      mutex : access pthread_mutex_t) return int;
485   pragma Import (C, pthread_cond_wait, "PTHREAD_COND_WAIT");
486
487   --------------------------
488   -- POSIX.1c  Section 13 --
489   --------------------------
490
491   function pthread_mutexattr_setprotocol
492     (attr : access pthread_mutexattr_t; protocol : int) return int;
493   pragma Import (C, pthread_mutexattr_setprotocol,
494                     "PTHREAD_MUTEXATTR_SETPROTOCOL");
495
496   type struct_sched_param is record
497      sched_priority : int;  --  scheduling priority
498   end record;
499   for struct_sched_param'Size use 8*4;
500   pragma Convention (C, struct_sched_param);
501
502   function pthread_setschedparam
503     (thread : pthread_t;
504      policy : int;
505      param  : access struct_sched_param) return int;
506   pragma Import (C, pthread_setschedparam, "PTHREAD_SETSCHEDPARAM");
507
508   function pthread_attr_setscope
509     (attr            : access pthread_attr_t;
510      contentionscope : int) return int;
511   pragma Import (C, pthread_attr_setscope, "PTHREAD_ATTR_SETSCOPE");
512
513   function pthread_attr_setinheritsched
514     (attr            : access pthread_attr_t;
515      inheritsched : int) return int;
516   pragma Import (C, pthread_attr_setinheritsched,
517                     "PTHREAD_ATTR_SETINHERITSCHED");
518
519   function pthread_attr_setschedpolicy
520     (attr : access pthread_attr_t; policy : int) return int;
521   pragma Import (C, pthread_attr_setschedpolicy,
522                     "PTHREAD_ATTR_SETSCHEDPOLICY");
523
524   function pthread_attr_setschedparam
525     (attr        : access pthread_attr_t;
526      sched_param : int) return int;
527   pragma Import (C, pthread_attr_setschedparam, "PTHREAD_ATTR_SETSCHEDPARAM");
528
529   function pthread_attr_setname_np
530     (attr : access pthread_attr_t;
531      name : System.Address;
532      mbz  : System.Address) return int;
533   pragma Import (C, pthread_attr_setname_np, "PTHREAD_ATTR_SETNAME_NP");
534
535   function sched_yield return int;
536
537   --------------------------
538   -- P1003.1c  Section 16 --
539   --------------------------
540
541   function pthread_attr_init (attributes : access pthread_attr_t) return int;
542   pragma Import (C, pthread_attr_init, "PTHREAD_ATTR_INIT");
543
544   function pthread_attr_destroy
545     (attributes : access pthread_attr_t) return int;
546   pragma Import (C, pthread_attr_destroy, "PTHREAD_ATTR_DESTROY");
547
548   function pthread_attr_setdetachstate
549     (attr        : access pthread_attr_t;
550      detachstate : int) return int;
551   pragma Import (C, pthread_attr_setdetachstate,
552                     "PTHREAD_ATTR_SETDETACHSTATE");
553
554   function pthread_attr_setstacksize
555     (attr      : access pthread_attr_t;
556      stacksize : size_t) return int;
557   pragma Import (C, pthread_attr_setstacksize, "PTHREAD_ATTR_SETSTACKSIZE");
558
559   function pthread_create
560     (thread        : access pthread_t;
561      attributes    : access pthread_attr_t;
562      start_routine : Thread_Body;
563      arg           : System.Address) return int;
564   pragma Import (C, pthread_create, "PTHREAD_CREATE");
565
566   procedure pthread_exit (status : System.Address);
567   pragma Import (C, pthread_exit, "PTHREAD_EXIT");
568
569   function pthread_self return pthread_t;
570   pragma Import (C, pthread_self, "PTHREAD_SELF");
571
572   --------------------------
573   -- POSIX.1c  Section 17 --
574   --------------------------
575
576   function pthread_setspecific
577     (key   : pthread_key_t;
578      value : System.Address) return  int;
579   pragma Import (C, pthread_setspecific, "PTHREAD_SETSPECIFIC");
580
581   function pthread_getspecific (key : pthread_key_t) return System.Address;
582   pragma Import (C, pthread_getspecific, "PTHREAD_GETSPECIFIC");
583
584   type destructor_pointer is access procedure (arg : System.Address);
585   pragma Convention (C, destructor_pointer);
586
587   function pthread_key_create
588     (key        : access pthread_key_t;
589      destructor : destructor_pointer) return int;
590   pragma Import (C, pthread_key_create, "PTHREAD_KEY_CREATE");
591
592private
593
594   type pid_t is new int;
595
596   type pthreadLongAddr_p is mod 2 ** Long_Integer'Size;
597
598   type pthreadLongAddr_t is mod 2 ** Long_Integer'Size;
599   type pthreadLongAddr_t_ptr is mod 2 ** Long_Integer'Size;
600
601   type pthreadLongString_t is mod 2 ** Long_Integer'Size;
602
603   type pthreadLongUint_t is mod 2 ** Long_Integer'Size;
604   type pthreadLongUint_array is array (Natural range <>)
605     of pthreadLongUint_t;
606
607   type pthread_t is mod 2 ** Long_Integer'Size;
608
609   type pthread_cond_t is record
610      state    : unsigned;
611      valid    : unsigned;
612      name     : pthreadLongString_t;
613      arg      : unsigned;
614      sequence : unsigned;
615      block    : pthreadLongAddr_t_ptr;
616   end record;
617   for pthread_cond_t'Size use 8*32;
618   pragma Convention (C, pthread_cond_t);
619
620   type pthread_attr_t is record
621      valid    : long;
622      name     : pthreadLongString_t;
623      arg      : pthreadLongUint_t;
624      reserved : pthreadLongUint_array (0 .. 18);
625   end record;
626   for pthread_attr_t'Size use 8*176;
627   pragma Convention (C, pthread_attr_t);
628
629   type pthread_mutex_t is record
630      lock     : unsigned;
631      valid    : unsigned;
632      name     : pthreadLongString_t;
633      arg      : unsigned;
634      sequence : unsigned;
635      block    : pthreadLongAddr_p;
636      owner    : unsigned;
637      depth    : unsigned;
638   end record;
639   for pthread_mutex_t'Size use 8*40;
640   pragma Convention (C, pthread_mutex_t);
641
642   type pthread_mutexattr_t is record
643      valid    : long;
644      reserved : pthreadLongUint_array (0 .. 14);
645   end record;
646   for pthread_mutexattr_t'Size use 8*128;
647   pragma Convention (C, pthread_mutexattr_t);
648
649   type pthread_condattr_t is record
650      valid    : long;
651      reserved : pthreadLongUint_array (0 .. 12);
652   end record;
653   for pthread_condattr_t'Size use 8*112;
654   pragma Convention (C, pthread_condattr_t);
655
656   type pthread_key_t is new unsigned;
657
658   pragma Inline (pthread_self);
659
660end System.OS_Interface;
661