File : s-osinte-lynxos178.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-2015, 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 --                                                                          --
  20 --                                                                          --
  21 --                                                                          --
  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 a LynxOS-178 (POSIX Threads) version of this package
  34 
  35 --  This package encapsulates all direct interfaces to OS services that are
  36 --  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 
  41 with Ada.Unchecked_Conversion;
  42 
  43 with Interfaces.C;
  44 
  45 with System.Multiprocessors;
  46 
  47 package System.OS_Interface is
  48    pragma Preelaborate;
  49 
  50    pragma Linker_Options ("-mthreads");
  51    --  Selects the POSIX 1.c runtime, rather than the non-threading runtime or
  52    --  the deprecated legacy threads library.
  53 
  54    subtype int            is Interfaces.C.int;
  55    subtype short          is Interfaces.C.short;
  56    subtype long           is Interfaces.C.long;
  57    subtype unsigned       is Interfaces.C.unsigned;
  58    subtype unsigned_short is Interfaces.C.unsigned_short;
  59    subtype unsigned_long  is Interfaces.C.unsigned_long;
  60    subtype unsigned_char  is Interfaces.C.unsigned_char;
  61    subtype plain_char     is Interfaces.C.plain_char;
  62    subtype size_t         is Interfaces.C.size_t;
  63 
  64    -----------
  65    -- Errno --
  66    -----------
  67 
  68    function errno return int;
  69    pragma Import (C, errno, "__get_errno");
  70 
  71    EAGAIN    : constant := 11;
  72    EINTR     : constant := 4;
  73    EINVAL    : constant := 22;
  74    ENOMEM    : constant := 12;
  75    ETIMEDOUT : constant := 60;
  76    --  Error codes
  77 
  78    -------------
  79    -- Signals --
  80    -------------
  81 
  82    Max_Interrupt : constant := 63;
  83    --  Max_Interrupt is the number of OS signals, as defined in:
  84    --
  85    --   /usr/include/sys/signal.h
  86    --
  87    --  The lowest numbered signal is 1, but 0 is a valid argument to some
  88    --  library functions, e.g. kill(2). However, 0 is not just another signal:
  89    --  For instance 'I in Signal' and similar should be used with caution.
  90 
  91    type Signal is new int range 0 .. Max_Interrupt;
  92    for  Signal'Size use int'Size;
  93 
  94    SIGHUP        : constant := 1;  --  hangup
  95    SIGINT        : constant := 2;  --  interrupt (rubout)
  96    SIGQUIT       : constant := 3;  --  quit (ASCD FS)
  97    SIGILL        : constant := 4;  --  illegal instruction (not reset)
  98    SIGTRAP       : constant := 5;  --  trace trap (not reset)
  99    SIGBRK        : constant := 6;  --  break
 100    SIGIOT        : constant := 6;  --  IOT instruction
 101    SIGABRT       : constant := 6;  --  used by abort, replace SIGIOT in future
 102    SIGCORE       : constant := 7;  --  kill with core dump
 103    SIGEMT        : constant := 7;  --  EMT instruction
 104    SIGFPE        : constant := 8;  --  floating point exception
 105    SIGKILL       : constant := 9;  --  kill (cannot be caught or ignored)
 106    SIGBUS        : constant := 10; --  bus error
 107    SIGSEGV       : constant := 11; --  segmentation violation
 108    SIGSYS        : constant := 12; --  bad argument to system call
 109    SIGPIPE       : constant := 13; --  write on a pipe with no one to read it
 110    SIGALRM       : constant := 14; --  alarm clock
 111    SIGTERM       : constant := 15; --  software termination signal from kill
 112    SIGURG        : constant := 16; --  urgent condition on IO channel
 113    SIGSTOP       : constant := 17; --  stop (cannot be caught or ignored)
 114    SIGTSTP       : constant := 18; --  user stop requested from tty
 115    SIGCONT       : constant := 19; --  stopped process has been continued
 116    SIGCLD        : constant := 20; --  alias for SIGCHLD
 117    SIGCHLD       : constant := 20; --  child status change
 118    SIGTTIN       : constant := 21; --  background tty read attempted
 119    SIGTTOU       : constant := 22; --  background tty write attempted
 120    SIGIO         : constant := 23; --  I/O possible (Solaris SIGPOLL alias)
 121    SIGPOLL       : constant := 23; --  pollable event occurred
 122    SIGTHREADKILL : constant := 24; --  Reserved by LynxOS runtime
 123    SIGXCPU       : constant := 24; --  CPU time limit exceeded
 124    SIGXFSZ       : constant := 25; --  filesize limit exceeded
 125    SIGVTALRM     : constant := 26; --  virtual timer expired
 126    SIGPROF       : constant := 27; --  profiling timer expired
 127    SIGWINCH      : constant := 28; --  window size change
 128    SIGLOST       : constant := 29; --  SUN 4.1 compatibility
 129    SIGUSR1       : constant := 30; --  user defined signal 1
 130    SIGUSR2       : constant := 31; --  user defined signal 2
 131 
 132    SIGPRIO       : constant := 32;
 133    --  Sent to a process with its priority or group is changed
 134 
 135    SIGADAABORT : constant := SIGABRT;
 136    --  Change this if you want to use another signal for task abort. SIGTERM
 137    --  might be a good one.
 138 
 139    type Signal_Set is array (Natural range <>) of Signal;
 140 
 141    Unmasked    : constant Signal_Set :=
 142      (SIGTRAP, SIGTTIN, SIGTTOU, SIGTSTP, SIGPROF, SIGTHREADKILL);
 143    Reserved    : constant Signal_Set := (SIGABRT, SIGKILL, SIGSTOP, SIGPRIO);
 144 
 145    type sigset_t is private;
 146 
 147    function sigaddset (set : access sigset_t; sig : Signal) return int;
 148    pragma Import (C, sigaddset, "sigaddset");
 149 
 150    function sigdelset (set : access sigset_t; sig : Signal) return int;
 151    pragma Import (C, sigdelset, "sigdelset");
 152 
 153    function sigfillset (set : access sigset_t) return int;
 154    pragma Import (C, sigfillset, "sigfillset");
 155 
 156    function sigismember (set : access sigset_t; sig : Signal) return int;
 157    pragma Import (C, sigismember, "sigismember");
 158 
 159    function sigemptyset (set : access sigset_t) return int;
 160    pragma Import (C, sigemptyset, "sigemptyset");
 161 
 162    type struct_sigaction is record
 163       sa_handler   : System.Address;
 164       sa_mask      : sigset_t;
 165       sa_flags     : int;
 166    end record;
 167    pragma Convention (C, struct_sigaction);
 168    type struct_sigaction_ptr is access all struct_sigaction;
 169 
 170    SA_SIGINFO : constant := 16#80#;
 171 
 172    SA_ONSTACK : constant := 16#00#;
 173    --  SA_ONSTACK is not defined on LynxOS, but it is referred to in the POSIX
 174    --  implementation of System.Interrupt_Management. Therefore we define a
 175    --  dummy value of zero here so that setting this flag is a nop.
 176 
 177    SIG_BLOCK   : constant := 0;
 178    SIG_UNBLOCK : constant := 1;
 179    SIG_SETMASK : constant := 2;
 180 
 181    SIG_DFL : constant := 0;
 182    SIG_IGN : constant := 1;
 183 
 184    function sigaction
 185      (sig  : Signal;
 186       act  : struct_sigaction_ptr;
 187       oact : struct_sigaction_ptr) return int;
 188    pragma Import (C, sigaction, "sigaction");
 189 
 190    ----------
 191    -- Time --
 192    ----------
 193 
 194    Time_Slice_Supported : constant Boolean := True;
 195    --  Indicates whether time slicing is supported
 196 
 197    type timespec is private;
 198 
 199    type clockid_t is new int;
 200 
 201    function clock_gettime
 202      (clock_id : clockid_t;
 203       tp       : access timespec) return int;
 204    pragma Import (C, clock_gettime, "clock_gettime");
 205 
 206    function clock_getres
 207      (clock_id : clockid_t;
 208       res      : access timespec) return int;
 209    pragma Import (C, clock_getres, "clock_getres");
 210 
 211    function To_Duration (TS : timespec) return Duration;
 212    pragma Inline (To_Duration);
 213 
 214    function To_Timespec (D : Duration) return timespec;
 215    pragma Inline (To_Timespec);
 216 
 217    type struct_timezone is record
 218       tz_minuteswest : int;
 219       tz_dsttime     : int;
 220    end record;
 221    pragma Convention (C, struct_timezone);
 222    type struct_timezone_ptr is access all struct_timezone;
 223 
 224    type struct_timeval is private;
 225 
 226    -------------------------
 227    -- Priority Scheduling --
 228    -------------------------
 229 
 230    SCHED_RR    : constant := 16#100_000#;
 231    SCHED_FIFO  : constant := 16#200_000#;
 232    SCHED_OTHER : constant := 16#400_000#;
 233 
 234    function To_Target_Priority
 235      (Prio : System.Any_Priority) return Interfaces.C.int;
 236    --  Maps System.Any_Priority to a POSIX priority
 237 
 238    -------------
 239    -- Process --
 240    -------------
 241 
 242    type pid_t is private;
 243 
 244    function kill (pid : pid_t; sig : Signal) return int;
 245    pragma Import (C, kill, "kill");
 246 
 247    function getpid return pid_t;
 248    pragma Import (C, getpid, "getpid");
 249 
 250    ---------
 251    -- LWP --
 252    ---------
 253 
 254    type pthread_t is private;
 255 
 256    function lwp_self return pthread_t;
 257    pragma Import (C, lwp_self, "pthread_self");
 258 
 259    -------------
 260    -- Threads --
 261    -------------
 262 
 263    type Thread_Body is access
 264      function (arg : System.Address) return System.Address;
 265    pragma Convention (C, Thread_Body);
 266 
 267    function Thread_Body_Access is new
 268      Ada.Unchecked_Conversion (System.Address, Thread_Body);
 269 
 270    subtype Thread_Id        is pthread_t;
 271 
 272    type pthread_mutex_t     is limited private;
 273    type pthread_cond_t      is limited private;
 274    type pthread_attr_t      is limited private;
 275    type pthread_mutexattr_t is limited private;
 276    type pthread_condattr_t  is limited private;
 277    type pthread_key_t       is private;
 278 
 279    PTHREAD_CREATE_DETACHED : constant := 1;
 280    PTHREAD_CREATE_JOINABLE : constant := 0;
 281 
 282    PTHREAD_SCOPE_PROCESS : constant := 0; --  not supported by LynxOS178
 283    PTHREAD_SCOPE_SYSTEM  : constant := 1;
 284 
 285    --  Read/Write lock not supported on LynxOS. To add support both types
 286    --  pthread_rwlock_t and pthread_rwlockattr_t must properly be defined
 287    --  with the associated routines pthread_rwlock_[init/destroy] and
 288    --  pthread_rwlock_[rdlock/wrlock/unlock].
 289 
 290    subtype pthread_rwlock_t     is pthread_mutex_t;
 291    subtype pthread_rwlockattr_t is pthread_mutexattr_t;
 292 
 293    -----------
 294    -- Stack --
 295    -----------
 296 
 297    type stack_t is record
 298       ss_sp    : System.Address;
 299       ss_flags : int;
 300       ss_size  : size_t;
 301    end record;
 302    pragma Convention (C, stack_t);
 303 
 304    function sigaltstack
 305      (ss  : not null access stack_t;
 306       oss : access stack_t) return int;
 307    pragma Import (C, sigaltstack, "sigaltstack");
 308    --  Neither stack_t nor sigaltstack are available on LynxOS-178
 309 
 310    Alternate_Stack : aliased System.Address;
 311    --  This is a dummy definition, never used (Alternate_Stack_Size is 0)
 312 
 313    Alternate_Stack_Size : constant := 0;
 314    --  No alternate signal stack is used on this platform
 315 
 316    Stack_Base_Available : constant Boolean := False;
 317    --  Indicates whether the stack base is available on this target
 318 
 319    function Get_Stack_Base (thread : pthread_t) return Address;
 320    pragma Inline (Get_Stack_Base);
 321    --  Returns the stack base of the specified thread. Only call this function
 322    --  when Stack_Base_Available is True.
 323 
 324    function Get_Page_Size return int;
 325    --  Returns the size of a page in bytes
 326 
 327    PROT_NONE  : constant := 1;
 328    PROT_READ  : constant := 2;
 329    PROT_WRITE : constant := 4;
 330    PROT_EXEC  : constant := 8;
 331    PROT_ALL   : constant := PROT_READ + PROT_WRITE + PROT_EXEC;
 332 
 333    PROT_ON    : constant := PROT_READ;
 334    PROT_OFF   : constant := PROT_ALL;
 335 
 336    function mprotect (addr : Address; len : size_t; prot : int) return int;
 337    pragma Import (C, mprotect);
 338 
 339    ---------------------------------------
 340    -- Nonstandard Thread Initialization --
 341    ---------------------------------------
 342 
 343    procedure pthread_init;
 344    --  This is a dummy procedure to share some GNULLI files
 345 
 346    -------------------------
 347    -- POSIX.1c  Section 3 --
 348    -------------------------
 349    function sigwait
 350      (set : access sigset_t;
 351       sig : access Signal) return int;
 352    pragma Inline (sigwait);
 353    --  LynxOS has non standard sigwait
 354 
 355    function pthread_kill
 356      (thread : pthread_t;
 357       sig    : Signal) return int;
 358    pragma Import (C, pthread_kill, "pthread_kill");
 359 
 360    function pthread_sigmask
 361      (how  : int;
 362       set  : access sigset_t;
 363       oset : access sigset_t) return int;
 364    pragma Import (C, pthread_sigmask, "pthread_sigmask");
 365 
 366    ----------------------------
 367    --  POSIX.1c  Section 11  --
 368    ----------------------------
 369 
 370    function pthread_mutexattr_init
 371      (attr : access pthread_mutexattr_t) return int;
 372    pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init");
 373 
 374    function pthread_mutexattr_destroy
 375      (attr : access pthread_mutexattr_t) return int;
 376    pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy");
 377 
 378    function pthread_mutex_init
 379      (mutex : access pthread_mutex_t;
 380       attr  : access pthread_mutexattr_t) return int;
 381    pragma Import (C, pthread_mutex_init, "pthread_mutex_init");
 382 
 383    function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int;
 384    pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy");
 385 
 386    function pthread_mutex_lock (mutex : access pthread_mutex_t) return int;
 387    pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock");
 388 
 389    function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int;
 390    pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock");
 391 
 392    function pthread_condattr_init
 393      (attr : access pthread_condattr_t) return int;
 394    pragma Import (C, pthread_condattr_init, "pthread_condattr_init");
 395 
 396    function pthread_condattr_destroy
 397      (attr : access pthread_condattr_t) return int;
 398    pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy");
 399 
 400    function pthread_cond_init
 401      (cond : access pthread_cond_t;
 402       attr : access pthread_condattr_t) return int;
 403    pragma Import (C, pthread_cond_init, "pthread_cond_init");
 404 
 405    function pthread_cond_destroy (cond : access pthread_cond_t) return int;
 406    pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy");
 407 
 408    function pthread_cond_signal (cond : access pthread_cond_t) return int;
 409    pragma Import (C, pthread_cond_signal, "pthread_cond_signal");
 410 
 411    function pthread_cond_wait
 412      (cond  : access pthread_cond_t;
 413       mutex : access pthread_mutex_t) return int;
 414    pragma Import (C, pthread_cond_wait, "pthread_cond_wait");
 415 
 416    function pthread_cond_timedwait
 417      (cond    : access pthread_cond_t;
 418       mutex   : access pthread_mutex_t;
 419       abstime : access timespec) return int;
 420    pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait");
 421 
 422    Relative_Timed_Wait : constant Boolean := False;
 423    --  pthread_cond_timedwait requires an absolute delay time
 424 
 425    --------------------------
 426    -- POSIX.1c  Section 13 --
 427    --------------------------
 428 
 429    PTHREAD_PRIO_NONE    : constant := 0;
 430    PTHREAD_PRIO_INHERIT : constant := 1;
 431    PTHREAD_PRIO_PROTECT : constant := 2;
 432 
 433    function pthread_mutexattr_setprotocol
 434      (attr     : access pthread_mutexattr_t;
 435       protocol : int) return int;
 436    pragma Import (C, pthread_mutexattr_setprotocol);
 437 
 438    function pthread_mutexattr_setprioceiling
 439      (attr        : access pthread_mutexattr_t;
 440       prioceiling : int) return int;
 441    pragma Import (C, pthread_mutexattr_setprioceiling);
 442 
 443    type struct_sched_param is record
 444       sched_priority        : int;
 445    end record;
 446    pragma Convention (C, struct_sched_param);
 447 
 448    function pthread_setschedparam
 449      (thread : pthread_t;
 450       policy : int;
 451       param  : access struct_sched_param) return int;
 452    pragma Import (C, pthread_setschedparam, "pthread_setschedparam");
 453 
 454    function pthread_attr_setscope
 455      (attr            : access pthread_attr_t;
 456       contentionscope : int) return int is (0);
 457    --  pthread_attr_setscope is not implemented in production mode
 458 
 459    function pthread_attr_setinheritsched
 460      (attr         : access pthread_attr_t;
 461       inheritsched : int) return int;
 462    pragma Import (C, pthread_attr_setinheritsched);
 463 
 464    function pthread_attr_setschedpolicy
 465      (attr   : access pthread_attr_t;
 466       policy : int) return int;
 467    pragma Import (C, pthread_attr_setschedpolicy);
 468 
 469    function sched_yield return int;
 470    pragma Import (C, sched_yield, "sched_yield");
 471 
 472    --------------------------
 473    -- P1003.1c  Section 16 --
 474    --------------------------
 475 
 476    function pthread_attr_init (attributes : access pthread_attr_t) return int;
 477    pragma Import (C, pthread_attr_init, "pthread_attr_init");
 478 
 479    function pthread_attr_destroy
 480      (attributes : access pthread_attr_t) return int;
 481    pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy");
 482 
 483    function pthread_attr_setdetachstate
 484      (attr        : access pthread_attr_t;
 485       detachstate : int) return int;
 486    pragma Import (C, pthread_attr_setdetachstate);
 487 
 488    function pthread_attr_setstacksize
 489      (attr      : access pthread_attr_t;
 490       stacksize : size_t) return int;
 491    pragma Import (C, pthread_attr_setstacksize);
 492 
 493    function pthread_create
 494      (thread        : access pthread_t;
 495       attributes    : access pthread_attr_t;
 496       start_routine : Thread_Body;
 497       arg           : System.Address) return int;
 498    pragma Import (C, pthread_create, "pthread_create");
 499 
 500    procedure pthread_exit (status : System.Address);
 501    pragma Import (C, pthread_exit, "pthread_exit");
 502 
 503    function pthread_self return pthread_t;
 504    pragma Import (C, pthread_self, "pthread_self");
 505 
 506    --------------------------
 507    -- POSIX.1c  Section 17 --
 508    --------------------------
 509 
 510    function pthread_setspecific
 511      (key   : pthread_key_t;
 512       value : System.Address) return int;
 513    pragma Import (C, pthread_setspecific, "pthread_setspecific");
 514 
 515    function pthread_getspecific
 516      (key    : pthread_key_t) return System.Address;
 517    pragma Import (C, pthread_getspecific, "pthread_getspecific");
 518 
 519    type destructor_pointer is access procedure (arg : System.Address);
 520    pragma Convention (C, destructor_pointer);
 521 
 522    function pthread_key_create
 523      (key        : access pthread_key_t;
 524       destructor : destructor_pointer
 525      ) return int;
 526    pragma Import (C, pthread_key_create, "pthread_key_create");
 527 
 528    ---------------------
 529    -- Multiprocessors --
 530    ---------------------
 531 
 532    function Current_CPU return Multiprocessors.CPU;
 533    --  Return the id of the current CPU
 534 
 535    function Get_Affinity (Id : Thread_Id) return Multiprocessors.CPU_Range;
 536    --  Return CPU affinity of the given thread (maybe Not_A_Specific_CPU)
 537 
 538    function Get_CPU (Id : Thread_Id) return Multiprocessors.CPU;
 539    --  Return the CPU in charge of the given thread (always a valid CPU)
 540 
 541 private
 542 
 543    type sigset_t is array (1 .. 2) of long;
 544    pragma Convention (C, sigset_t);
 545 
 546    type pid_t is new long;
 547 
 548    type time_t is new long;
 549 
 550    type timespec is record
 551       tv_sec  : time_t;
 552       tv_nsec : long;
 553    end record;
 554    pragma Convention (C, timespec);
 555 
 556    type struct_timeval is record
 557       tv_sec  : time_t;
 558       tv_usec : time_t;
 559    end record;
 560    pragma Convention (C, struct_timeval);
 561 
 562    type st_attr is record
 563       stksize      : int;
 564       prio         : int;
 565       inheritsched : int;
 566       state        : int;
 567       sched        : int;
 568       detachstate  : int;
 569       guardsize    : int;
 570    end record;
 571    pragma Convention (C, st_attr);
 572    subtype st_attr_t is st_attr;
 573 
 574    type pthread_attr_t is record
 575       pthread_attr_magic : unsigned;
 576       st                 : st_attr_t;
 577       pthread_attr_scope : int;
 578    end record;
 579    pragma Convention (C, pthread_attr_t);
 580 
 581    type pthread_condattr_t is record
 582       cv_magic   : unsigned;
 583       cv_pshared : unsigned;
 584    end record;
 585    pragma Convention (C, pthread_condattr_t);
 586 
 587    type pthread_mutexattr_t is record
 588       m_flags   : unsigned;
 589       m_prio_c  : int;
 590       m_pshared : int;
 591    end record;
 592    pragma Convention (C, pthread_mutexattr_t);
 593 
 594    type tid_t is new short;
 595    type pthread_t is new tid_t;
 596 
 597    type block_obj_t is record
 598       b_head : int;
 599    end record;
 600    pragma Convention (C, block_obj_t);
 601 
 602    type pthread_mutex_t is record
 603       m_flags      : unsigned;
 604       m_owner      : tid_t;
 605       m_wait       : block_obj_t;
 606       m_prio_c     : int;
 607       m_oldprio    : int;
 608       m_count      : int;
 609       m_referenced : int;
 610    end record;
 611    pragma Convention (C, pthread_mutex_t);
 612    type pthread_mutex_t_ptr is access all pthread_mutex_t;
 613 
 614    type pthread_cond_t is record
 615       cv_magic   : unsigned;
 616       cv_wait    : block_obj_t;
 617       cv_mutex   : pthread_mutex_t_ptr;
 618       cv_refcnt  : int;
 619    end record;
 620    pragma Convention (C, pthread_cond_t);
 621 
 622    type pthread_key_t is new int;
 623 
 624 end System.OS_Interface;