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) 1995-2021, Free Software Foundation, Inc. -- 10-- -- 11-- GNAT is free software; you can redistribute it and/or modify it under -- 12-- terms of the GNU General Public License as published by the Free Soft- -- 13-- ware Foundation; either version 3, or (at your option) any later ver- -- 14-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- 15-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- 16-- or FITNESS FOR A PARTICULAR PURPOSE. -- 17-- -- 18-- As a special exception under Section 7 of GPL version 3, you are granted -- 19-- additional permissions described in the GCC Runtime Library Exception, -- 20-- version 3.1, as published by the Free Software Foundation. -- 21-- -- 22-- You should have received a copy of the GNU General Public License and -- 23-- a copy of the GCC Runtime Library Exception along with this program; -- 24-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- 25-- <http://www.gnu.org/licenses/>. -- 26-- -- 27-- GNARL was developed by the GNARL team at Florida State University. -- 28-- Extensive contributions were provided by Ada Core Technologies, Inc. -- 29-- -- 30------------------------------------------------------------------------------ 31 32-- This is an Android version of this package which is based on the 33-- GNU/Linux version 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 Ada.Unchecked_Conversion; 42with Interfaces.C; 43with System.Linux; 44with System.OS_Constants; 45with System.Parameters; 46 47package System.OS_Interface is 48 pragma Preelaborate; 49 50 subtype int is Interfaces.C.int; 51 subtype char is Interfaces.C.char; 52 subtype short is Interfaces.C.short; 53 subtype long is Interfaces.C.long; 54 subtype unsigned is Interfaces.C.unsigned; 55 subtype unsigned_short is Interfaces.C.unsigned_short; 56 subtype unsigned_long is Interfaces.C.unsigned_long; 57 subtype unsigned_char is Interfaces.C.unsigned_char; 58 subtype plain_char is Interfaces.C.plain_char; 59 subtype size_t is Interfaces.C.size_t; 60 61 ----------- 62 -- Errno -- 63 ----------- 64 65 function errno return int; 66 pragma Import (C, errno, "__get_errno"); 67 68 EAGAIN : constant := System.Linux.EAGAIN; 69 EINTR : constant := System.Linux.EINTR; 70 EINVAL : constant := System.Linux.EINVAL; 71 ENOMEM : constant := System.Linux.ENOMEM; 72 EPERM : constant := System.Linux.EPERM; 73 ETIMEDOUT : constant := System.Linux.ETIMEDOUT; 74 75 ------------- 76 -- Signals -- 77 ------------- 78 79 Max_Interrupt : constant := 31; 80 type Signal is new int range 0 .. Max_Interrupt; 81 for Signal'Size use int'Size; 82 83 SIGHUP : constant := System.Linux.SIGHUP; 84 SIGINT : constant := System.Linux.SIGINT; 85 SIGQUIT : constant := System.Linux.SIGQUIT; 86 SIGILL : constant := System.Linux.SIGILL; 87 SIGTRAP : constant := System.Linux.SIGTRAP; 88 SIGIOT : constant := System.Linux.SIGIOT; 89 SIGABRT : constant := System.Linux.SIGABRT; 90 SIGFPE : constant := System.Linux.SIGFPE; 91 SIGKILL : constant := System.Linux.SIGKILL; 92 SIGBUS : constant := System.Linux.SIGBUS; 93 SIGSEGV : constant := System.Linux.SIGSEGV; 94 SIGPIPE : constant := System.Linux.SIGPIPE; 95 SIGALRM : constant := System.Linux.SIGALRM; 96 SIGTERM : constant := System.Linux.SIGTERM; 97 SIGUSR1 : constant := System.Linux.SIGUSR1; 98 SIGUSR2 : constant := System.Linux.SIGUSR2; 99 SIGCLD : constant := System.Linux.SIGCLD; 100 SIGCHLD : constant := System.Linux.SIGCHLD; 101 SIGPWR : constant := System.Linux.SIGPWR; 102 SIGWINCH : constant := System.Linux.SIGWINCH; 103 SIGURG : constant := System.Linux.SIGURG; 104 SIGPOLL : constant := System.Linux.SIGPOLL; 105 SIGIO : constant := System.Linux.SIGIO; 106 SIGLOST : constant := System.Linux.SIGLOST; 107 SIGSTOP : constant := System.Linux.SIGSTOP; 108 SIGTSTP : constant := System.Linux.SIGTSTP; 109 SIGCONT : constant := System.Linux.SIGCONT; 110 SIGTTIN : constant := System.Linux.SIGTTIN; 111 SIGTTOU : constant := System.Linux.SIGTTOU; 112 SIGVTALRM : constant := System.Linux.SIGVTALRM; 113 SIGPROF : constant := System.Linux.SIGPROF; 114 SIGXCPU : constant := System.Linux.SIGXCPU; 115 SIGXFSZ : constant := System.Linux.SIGXFSZ; 116 SIGUNUSED : constant := System.Linux.SIGUNUSED; 117 SIGSTKFLT : constant := System.Linux.SIGSTKFLT; 118 119 SIGADAABORT : constant := SIGABRT; 120 -- Change this to use another signal for task abort. SIGTERM might be a 121 -- good one. 122 123 type Signal_Set is array (Natural range <>) of Signal; 124 125 Unmasked : constant Signal_Set := ( 126 SIGTRAP, 127 -- To enable debugging on multithreaded applications, mark SIGTRAP to 128 -- be kept unmasked. 129 130 SIGBUS, 131 132 SIGTTIN, SIGTTOU, SIGTSTP, 133 -- Keep these three signals unmasked so that background processes and IO 134 -- behaves as normal "C" applications 135 136 SIGPROF, 137 -- To avoid confusing the profiler 138 139 SIGKILL, SIGSTOP); 140 -- These two signals actually can't be masked (POSIX won't allow it) 141 142 Reserved : constant Signal_Set := (SIGVTALRM, SIGUNUSED); 143 -- Not clear why these two signals are reserved. Perhaps they are not 144 -- supported by this version of GNU/Linux ??? 145 146 type sigset_t is private; 147 148 function sigaddset (set : access sigset_t; sig : Signal) return int; 149 pragma Import (C, sigaddset, "_sigaddset"); 150 151 function sigdelset (set : access sigset_t; sig : Signal) return int; 152 pragma Import (C, sigdelset, "_sigdelset"); 153 154 function sigfillset (set : access sigset_t) return int; 155 pragma Import (C, sigfillset, "_sigfillset"); 156 157 function sigismember (set : access sigset_t; sig : Signal) return int; 158 pragma Import (C, sigismember, "_sigismember"); 159 160 function sigemptyset (set : access sigset_t) return int; 161 pragma Import (C, sigemptyset, "_sigemptyset"); 162 163 type union_type_3 is new String (1 .. 116); 164 type siginfo_t is record 165 si_signo : int; 166 si_code : int; 167 si_errno : int; 168 X_data : union_type_3; 169 end record; 170 pragma Convention (C, siginfo_t); 171 172 type struct_sigaction is record 173 sa_handler : System.Address; 174 sa_mask : sigset_t; 175 sa_flags : Interfaces.C.unsigned_long; 176 sa_restorer : System.Address; 177 end record; 178 pragma Convention (C, struct_sigaction); 179 180 type struct_sigaction_ptr is access all struct_sigaction; 181 182 SA_SIGINFO : constant := System.Linux.SA_SIGINFO; 183 SA_ONSTACK : constant := System.Linux.SA_ONSTACK; 184 SA_NODEFER : constant := System.Linux.SA_NODEFER; 185 SA_RESTART : constant := System.Linux.SA_RESTART; 186 187 SIG_BLOCK : constant := 0; 188 SIG_UNBLOCK : constant := 1; 189 SIG_SETMASK : constant := 2; 190 191 SIG_DFL : constant := 0; 192 SIG_IGN : constant := 1; 193 194 function sigaction 195 (sig : Signal; 196 act : struct_sigaction_ptr; 197 oact : struct_sigaction_ptr) return int; 198 pragma Import (C, sigaction, "sigaction"); 199 200 ---------- 201 -- Time -- 202 ---------- 203 204 Time_Slice_Supported : constant Boolean := True; 205 -- Indicates whether time slicing is supported 206 207 type timespec is private; 208 209 type clockid_t is new int; 210 211 function clock_gettime 212 (clock_id : clockid_t; tp : access timespec) return int; 213 pragma Import (C, clock_gettime, "clock_gettime"); 214 215 function clock_getres 216 (clock_id : clockid_t; 217 res : access timespec) return int; 218 pragma Import (C, clock_getres, "clock_getres"); 219 220 function To_Duration (TS : timespec) return Duration; 221 pragma Inline (To_Duration); 222 223 function To_Timespec (D : Duration) return timespec; 224 pragma Inline (To_Timespec); 225 226 function sysconf (name : int) return long; 227 pragma Import (C, sysconf); 228 229 SC_CLK_TCK : constant := 2; 230 SC_NPROCESSORS_ONLN : constant := 84; 231 232 ------------------------- 233 -- Priority Scheduling -- 234 ------------------------- 235 236 SCHED_OTHER : constant := 0; 237 SCHED_FIFO : constant := 1; 238 SCHED_RR : constant := 2; 239 240 function To_Target_Priority 241 (Prio : System.Any_Priority) 242 return Interfaces.C.int is (Interfaces.C.int (Prio)); 243 -- Maps System.Any_Priority to a POSIX priority 244 245 ------------- 246 -- Process -- 247 ------------- 248 249 type pid_t is private; 250 251 function kill (pid : pid_t; sig : Signal) return int; 252 pragma Import (C, kill, "kill"); 253 254 function getpid return pid_t; 255 pragma Import (C, getpid, "getpid"); 256 257 ------------- 258 -- Threads -- 259 ------------- 260 261 type Thread_Body is access 262 function (arg : System.Address) return System.Address; 263 pragma Convention (C, Thread_Body); 264 265 function Thread_Body_Access is new 266 Ada.Unchecked_Conversion (System.Address, Thread_Body); 267 268 type pthread_t is new unsigned_long; 269 subtype Thread_Id is pthread_t; 270 271 function To_pthread_t is 272 new Ada.Unchecked_Conversion (unsigned_long, pthread_t); 273 274 type pthread_mutex_t is limited private; 275 type pthread_cond_t is limited private; 276 type pthread_attr_t is limited private; 277 type pthread_mutexattr_t is limited private; 278 type pthread_condattr_t is limited private; 279 type pthread_key_t is private; 280 281 PTHREAD_CREATE_DETACHED : constant := 1; 282 283 PTHREAD_SCOPE_PROCESS : constant := 1; 284 PTHREAD_SCOPE_SYSTEM : constant := 0; 285 286 -- Read/Write lock not supported on Android. 287 288 subtype pthread_rwlock_t is pthread_mutex_t; 289 subtype pthread_rwlockattr_t is pthread_mutexattr_t; 290 291 ----------- 292 -- Stack -- 293 ----------- 294 295 type stack_t is record 296 ss_sp : System.Address; 297 ss_flags : int; 298 ss_size : size_t; 299 end record; 300 pragma Convention (C, stack_t); 301 302 function sigaltstack 303 (ss : not null access stack_t; 304 oss : access stack_t) return int; 305 pragma Import (C, sigaltstack, "sigaltstack"); 306 307 Alternate_Stack : aliased System.Address; 308 pragma Import (C, Alternate_Stack, "__gnat_alternate_stack"); 309 -- The alternate signal stack for stack overflows 310 311 Alternate_Stack_Size : constant := 16 * 1024; 312 -- This must be in keeping with init.c:__gnat_alternate_stack 313 314 Stack_Base_Available : constant Boolean := False; 315 -- Indicates whether the stack base is available on this target 316 317 function Get_Stack_Base (ignored_thread : pthread_t) 318 return Address is (Null_Address); 319 -- This is a dummy procedure to share some GNULLI files 320 321 function Get_Page_Size return int; 322 pragma Import (C, Get_Page_Size, "_getpagesize"); 323 -- Returns the size of a page 324 325 PROT_NONE : constant := 0; 326 PROT_READ : constant := 1; 327 PROT_WRITE : constant := 2; 328 PROT_EXEC : constant := 4; 329 PROT_ALL : constant := PROT_READ + PROT_WRITE + PROT_EXEC; 330 PROT_ON : constant := PROT_READ; 331 PROT_OFF : constant := PROT_ALL; 332 333 function mprotect (addr : Address; len : size_t; prot : int) return int; 334 pragma Import (C, mprotect); 335 336 --------------------------------------- 337 -- Nonstandard Thread Initialization -- 338 --------------------------------------- 339 340 procedure pthread_init is null; 341 -- This is a dummy procedure to share some GNULLI files 342 343 ------------------------- 344 -- POSIX.1c Section 3 -- 345 ------------------------- 346 347 function sigwait (set : access sigset_t; sig : access Signal) return int; 348 pragma Import (C, sigwait, "sigwait"); 349 350 function pthread_kill (thread : pthread_t; sig : Signal) return int; 351 pragma Import (C, pthread_kill, "pthread_kill"); 352 353 function pthread_sigmask 354 (how : int; 355 set : access sigset_t; 356 oset : access sigset_t) return int; 357 pragma Import (C, pthread_sigmask, "sigprocmask"); 358 -- pthread_sigmask maybe be broken due to mismatch between sigset_t and 359 -- kernel_sigset_t, substitute sigprocmask temporarily. ??? 360 -- pragma Import (C, pthread_sigmask, "pthread_sigmask"); 361 362 -------------------------- 363 -- POSIX.1c Section 11 -- 364 -------------------------- 365 366 function pthread_mutexattr_init 367 (attr : access pthread_mutexattr_t) return int; 368 pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init"); 369 370 function pthread_mutexattr_destroy 371 (attr : access pthread_mutexattr_t) return int; 372 pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy"); 373 374 function pthread_mutex_init 375 (mutex : access pthread_mutex_t; 376 attr : access pthread_mutexattr_t) return int; 377 pragma Import (C, pthread_mutex_init, "pthread_mutex_init"); 378 379 function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int; 380 pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy"); 381 382 function pthread_mutex_lock (mutex : access pthread_mutex_t) return int; 383 pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock"); 384 385 function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int; 386 pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock"); 387 388 function pthread_condattr_init 389 (attr : access pthread_condattr_t) return int; 390 pragma Import (C, pthread_condattr_init, "pthread_condattr_init"); 391 392 function pthread_condattr_destroy 393 (attr : access pthread_condattr_t) return int; 394 pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy"); 395 396 function pthread_cond_init 397 (cond : access pthread_cond_t; 398 attr : access pthread_condattr_t) return int; 399 pragma Import (C, pthread_cond_init, "pthread_cond_init"); 400 401 function pthread_cond_destroy (cond : access pthread_cond_t) return int; 402 pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy"); 403 404 function pthread_cond_signal (cond : access pthread_cond_t) return int; 405 pragma Import (C, pthread_cond_signal, "pthread_cond_signal"); 406 407 function pthread_cond_wait 408 (cond : access pthread_cond_t; 409 mutex : access pthread_mutex_t) return int; 410 pragma Import (C, pthread_cond_wait, "pthread_cond_wait"); 411 412 function pthread_cond_timedwait 413 (cond : access pthread_cond_t; 414 mutex : access pthread_mutex_t; 415 abstime : access timespec) return int; 416 pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait"); 417 418 -------------------------- 419 -- POSIX.1c Section 13 -- 420 -------------------------- 421 422 PTHREAD_PRIO_PROTECT : constant := 0; 423 PTHREAD_PRIO_INHERIT : constant := 1; 424 425 function pthread_mutexattr_setprotocol 426 (ignored_attr : access pthread_mutexattr_t; 427 ignored_protocol : int) return int is (0); 428 429 function pthread_mutexattr_setprioceiling 430 (ignored_attr : access pthread_mutexattr_t; 431 ignored_prioceiling : int) return int is (0); 432 433 type struct_sched_param is record 434 sched_priority : int; -- scheduling priority 435 end record; 436 pragma Convention (C, struct_sched_param); 437 438 function pthread_setschedparam 439 (thread : pthread_t; 440 policy : int; 441 param : access struct_sched_param) return int; 442 pragma Import (C, pthread_setschedparam, "pthread_setschedparam"); 443 444 function pthread_attr_setscope 445 (attr : access pthread_attr_t; 446 scope : int) return int; 447 pragma Import (C, pthread_attr_setscope, "pthread_attr_setscope"); 448 449 function pthread_attr_setschedpolicy 450 (attr : access pthread_attr_t; 451 policy : int) return int; 452 pragma Import 453 (C, pthread_attr_setschedpolicy, "pthread_attr_setschedpolicy"); 454 455 function sched_yield return int; 456 pragma Import (C, sched_yield, "sched_yield"); 457 458 --------------------------- 459 -- P1003.1c - Section 16 -- 460 --------------------------- 461 462 function pthread_attr_init 463 (attributes : access pthread_attr_t) return int; 464 pragma Import (C, pthread_attr_init, "pthread_attr_init"); 465 466 function pthread_attr_destroy 467 (attributes : access pthread_attr_t) return int; 468 pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy"); 469 470 function pthread_attr_setdetachstate 471 (attr : access pthread_attr_t; 472 detachstate : int) return int; 473 pragma Import 474 (C, pthread_attr_setdetachstate, "pthread_attr_setdetachstate"); 475 476 function pthread_attr_setstacksize 477 (attr : access pthread_attr_t; 478 stacksize : size_t) return int; 479 pragma Import (C, pthread_attr_setstacksize, "pthread_attr_setstacksize"); 480 481 function pthread_create 482 (thread : access pthread_t; 483 attributes : access pthread_attr_t; 484 start_routine : Thread_Body; 485 arg : System.Address) return int; 486 pragma Import (C, pthread_create, "pthread_create"); 487 488 procedure pthread_exit (status : System.Address); 489 pragma Import (C, pthread_exit, "pthread_exit"); 490 491 function pthread_self return pthread_t; 492 pragma Import (C, pthread_self, "pthread_self"); 493 494 function lwp_self return System.Address; 495 pragma Import (C, lwp_self, "__gnat_lwp_self"); 496 497 -------------------------- 498 -- POSIX.1c Section 17 -- 499 -------------------------- 500 501 function pthread_setspecific 502 (key : pthread_key_t; 503 value : System.Address) return int; 504 pragma Import (C, pthread_setspecific, "pthread_setspecific"); 505 506 function pthread_getspecific (key : pthread_key_t) return System.Address; 507 pragma Import (C, pthread_getspecific, "pthread_getspecific"); 508 509 type destructor_pointer is access procedure (arg : System.Address); 510 pragma Convention (C, destructor_pointer); 511 512 function pthread_key_create 513 (key : access pthread_key_t; 514 destructor : destructor_pointer) return int; 515 pragma Import (C, pthread_key_create, "pthread_key_create"); 516 517 CPU_SETSIZE : constant := 1_024; 518 -- Size of the cpu_set_t mask on most linux systems (SUSE 11 uses 4_096). 519 -- This is kept for backward compatibility (System.Task_Info uses it), but 520 -- the run-time library does no longer rely on static masks, using 521 -- dynamically allocated masks instead. 522 523 type bit_field is array (1 .. CPU_SETSIZE) of Boolean; 524 for bit_field'Size use CPU_SETSIZE; 525 pragma Pack (bit_field); 526 pragma Convention (C, bit_field); 527 528 type cpu_set_t is record 529 bits : bit_field; 530 end record; 531 pragma Convention (C, cpu_set_t); 532 533 type cpu_set_t_ptr is access all cpu_set_t; 534 -- In the run-time library we use this pointer because the size of type 535 -- cpu_set_t varies depending on the glibc version. Hence, objects of type 536 -- cpu_set_t are allocated dynamically using the number of processors 537 -- available in the target machine (value obtained at execution time). 538 539 function CPU_ALLOC (count : size_t) return cpu_set_t_ptr; 540 pragma Import (C, CPU_ALLOC, "__gnat_cpu_alloc"); 541 -- Wrapper around the CPU_ALLOC C macro 542 543 function CPU_ALLOC_SIZE (count : size_t) return size_t; 544 pragma Import (C, CPU_ALLOC_SIZE, "__gnat_cpu_alloc_size"); 545 -- Wrapper around the CPU_ALLOC_SIZE C macro 546 547 procedure CPU_FREE (cpuset : cpu_set_t_ptr); 548 pragma Import (C, CPU_FREE, "__gnat_cpu_free"); 549 -- Wrapper around the CPU_FREE C macro 550 551 procedure CPU_ZERO (count : size_t; cpuset : cpu_set_t_ptr); 552 pragma Import (C, CPU_ZERO, "__gnat_cpu_zero"); 553 -- Wrapper around the CPU_ZERO_S C macro 554 555 procedure CPU_SET (cpu : int; count : size_t; cpuset : cpu_set_t_ptr); 556 pragma Import (C, CPU_SET, "__gnat_cpu_set"); 557 -- Wrapper around the CPU_SET_S C macro 558 559 function pthread_setaffinity_np 560 (thread : pthread_t; 561 cpusetsize : size_t; 562 cpuset : cpu_set_t_ptr) return int; 563 pragma Import (C, pthread_setaffinity_np, "pthread_setaffinity_np"); 564 pragma Weak_External (pthread_setaffinity_np); 565 -- Use a weak symbol because this function may be available or not, 566 -- depending on the version of the system. 567 568 function pthread_attr_setaffinity_np 569 (attr : access pthread_attr_t; 570 cpusetsize : size_t; 571 cpuset : cpu_set_t_ptr) return int; 572 pragma Import (C, pthread_attr_setaffinity_np, 573 "pthread_attr_setaffinity_np"); 574 pragma Weak_External (pthread_attr_setaffinity_np); 575 -- Use a weak symbol because this function may be available or not, 576 -- depending on the version of the system. 577 578private 579 580 type sigset_t is new Interfaces.C.unsigned_long; 581 pragma Convention (C, sigset_t); 582 for sigset_t'Alignment use Interfaces.C.unsigned_long'Alignment; 583 584 pragma Warnings (Off); 585 for struct_sigaction use record 586 sa_handler at Linux.sa_handler_pos range 0 .. Standard'Address_Size - 1; 587 sa_mask at Linux.sa_mask_pos range 0 .. sigset_t'Size - 1; 588 sa_flags at Linux.sa_flags_pos 589 range 0 .. Interfaces.C.unsigned_long'Size - 1; 590 end record; 591 -- We intentionally leave sa_restorer unspecified and let the compiler 592 -- append it after the last field, so disable corresponding warning. 593 pragma Warnings (On); 594 595 type pid_t is new int; 596 597 type time_t is range -2 ** (System.Parameters.time_t_bits - 1) 598 .. 2 ** (System.Parameters.time_t_bits - 1) - 1; 599 600 type timespec is record 601 tv_sec : time_t; 602 tv_nsec : long; 603 end record; 604 pragma Convention (C, timespec); 605 606 type unsigned_long_long_t is mod 2 ** 64; 607 -- Local type only used to get the alignment of this type below 608 609 subtype char_array is Interfaces.C.char_array; 610 611 type pthread_attr_t is record 612 Data : char_array (1 .. OS_Constants.PTHREAD_ATTR_SIZE); 613 end record; 614 pragma Convention (C, pthread_attr_t); 615 for pthread_attr_t'Alignment use Interfaces.C.unsigned_long'Alignment; 616 617 type pthread_condattr_t is record 618 Data : char_array (1 .. OS_Constants.PTHREAD_CONDATTR_SIZE); 619 end record; 620 pragma Convention (C, pthread_condattr_t); 621 for pthread_condattr_t'Alignment use Interfaces.C.int'Alignment; 622 623 type pthread_mutexattr_t is record 624 Data : char_array (1 .. OS_Constants.PTHREAD_MUTEXATTR_SIZE); 625 end record; 626 pragma Convention (C, pthread_mutexattr_t); 627 for pthread_mutexattr_t'Alignment use Interfaces.C.int'Alignment; 628 629 type pthread_mutex_t is record 630 Data : char_array (1 .. OS_Constants.PTHREAD_MUTEX_SIZE); 631 end record; 632 pragma Convention (C, pthread_mutex_t); 633 for pthread_mutex_t'Alignment use Interfaces.C.unsigned_long'Alignment; 634 635 type pthread_cond_t is record 636 Data : char_array (1 .. OS_Constants.PTHREAD_COND_SIZE); 637 end record; 638 pragma Convention (C, pthread_cond_t); 639 for pthread_cond_t'Alignment use unsigned_long_long_t'Alignment; 640 641 type pthread_key_t is new unsigned; 642 643end System.OS_Interface; 644