1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
5 -- S Y S T E M . O S _ I N T E R F A C E --
9 -- Copyright (C) 1991-1994, Florida State University --
10 -- Copyright (C) 1995-2012, Free Software Foundation, Inc. --
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. --
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. --
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/>. --
28 -- GNARL was developed by the GNARL team at Florida State University. --
29 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
31 ------------------------------------------------------------------------------
33 -- This is a GNU/Linux (GNU/LinuxThreads) version of this package
35 -- This package encapsulates all direct interfaces to OS services
36 -- that are needed by the tasking run-time (libgnarl).
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.
41 with Ada
.Unchecked_Conversion
;
44 with System
.OS_Constants
;
46 package System
.OS_Interface
is
49 pragma Linker_Options
("-lpthread");
51 subtype int
is Interfaces
.C
.int
;
52 subtype char
is Interfaces
.C
.char
;
53 subtype short
is Interfaces
.C
.short
;
54 subtype long
is Interfaces
.C
.long
;
55 subtype unsigned
is Interfaces
.C
.unsigned
;
56 subtype unsigned_short
is Interfaces
.C
.unsigned_short
;
57 subtype unsigned_long
is Interfaces
.C
.unsigned_long
;
58 subtype unsigned_char
is Interfaces
.C
.unsigned_char
;
59 subtype plain_char
is Interfaces
.C
.plain_char
;
60 subtype size_t
is Interfaces
.C
.size_t
;
66 function errno
return int
;
67 pragma Import
(C
, errno
, "__get_errno");
69 EAGAIN
: constant := System
.Linux
.EAGAIN
;
70 EINTR
: constant := System
.Linux
.EINTR
;
71 EINVAL
: constant := System
.Linux
.EINVAL
;
72 ENOMEM
: constant := System
.Linux
.ENOMEM
;
73 EPERM
: constant := System
.Linux
.EPERM
;
74 ETIMEDOUT
: constant := System
.Linux
.ETIMEDOUT
;
80 Max_Interrupt
: constant := 63;
81 type Signal
is new int
range 0 .. Max_Interrupt
;
82 for Signal
'Size use int
'Size;
84 SIGHUP
: constant := System
.Linux
.SIGHUP
;
85 SIGINT
: constant := System
.Linux
.SIGINT
;
86 SIGQUIT
: constant := System
.Linux
.SIGQUIT
;
87 SIGILL
: constant := System
.Linux
.SIGILL
;
88 SIGTRAP
: constant := System
.Linux
.SIGTRAP
;
89 SIGIOT
: constant := System
.Linux
.SIGIOT
;
90 SIGABRT
: constant := System
.Linux
.SIGABRT
;
91 SIGFPE
: constant := System
.Linux
.SIGFPE
;
92 SIGKILL
: constant := System
.Linux
.SIGKILL
;
93 SIGBUS
: constant := System
.Linux
.SIGBUS
;
94 SIGSEGV
: constant := System
.Linux
.SIGSEGV
;
95 SIGPIPE
: constant := System
.Linux
.SIGPIPE
;
96 SIGALRM
: constant := System
.Linux
.SIGALRM
;
97 SIGTERM
: constant := System
.Linux
.SIGTERM
;
98 SIGUSR1
: constant := System
.Linux
.SIGUSR1
;
99 SIGUSR2
: constant := System
.Linux
.SIGUSR2
;
100 SIGCLD
: constant := System
.Linux
.SIGCLD
;
101 SIGCHLD
: constant := System
.Linux
.SIGCHLD
;
102 SIGPWR
: constant := System
.Linux
.SIGPWR
;
103 SIGWINCH
: constant := System
.Linux
.SIGWINCH
;
104 SIGURG
: constant := System
.Linux
.SIGURG
;
105 SIGPOLL
: constant := System
.Linux
.SIGPOLL
;
106 SIGIO
: constant := System
.Linux
.SIGIO
;
107 SIGLOST
: constant := System
.Linux
.SIGLOST
;
108 SIGSTOP
: constant := System
.Linux
.SIGSTOP
;
109 SIGTSTP
: constant := System
.Linux
.SIGTSTP
;
110 SIGCONT
: constant := System
.Linux
.SIGCONT
;
111 SIGTTIN
: constant := System
.Linux
.SIGTTIN
;
112 SIGTTOU
: constant := System
.Linux
.SIGTTOU
;
113 SIGVTALRM
: constant := System
.Linux
.SIGVTALRM
;
114 SIGPROF
: constant := System
.Linux
.SIGPROF
;
115 SIGXCPU
: constant := System
.Linux
.SIGXCPU
;
116 SIGXFSZ
: constant := System
.Linux
.SIGXFSZ
;
117 SIGUNUSED
: constant := System
.Linux
.SIGUNUSED
;
118 SIGSTKFLT
: constant := System
.Linux
.SIGSTKFLT
;
119 SIGLTHRRES
: constant := System
.Linux
.SIGLTHRRES
;
120 SIGLTHRCAN
: constant := System
.Linux
.SIGLTHRCAN
;
121 SIGLTHRDBG
: constant := System
.Linux
.SIGLTHRDBG
;
123 SIGADAABORT
: constant := SIGABRT
;
124 -- Change this to use another signal for task abort. SIGTERM might be a
127 type Signal_Set
is array (Natural range <>) of Signal
;
129 Unmasked
: constant Signal_Set
:= (
131 -- To enable debugging on multithreaded applications, mark SIGTRAP to
136 SIGTTIN
, SIGTTOU
, SIGTSTP
,
137 -- Keep these three signals unmasked so that background processes and IO
138 -- behaves as normal "C" applications
141 -- To avoid confusing the profiler
144 -- These two signals actually can't be masked (POSIX won't allow it)
146 SIGLTHRRES
, SIGLTHRCAN
, SIGLTHRDBG
);
147 -- These three signals are used by GNU/LinuxThreads starting from glibc
150 Reserved
: constant Signal_Set
:= (SIGVTALRM
, SIGUNUSED
);
151 -- Not clear why these two signals are reserved. Perhaps they are not
152 -- supported by this version of GNU/Linux ???
154 type sigset_t
is private;
156 function sigaddset
(set
: access sigset_t
; sig
: Signal
) return int
;
157 pragma Import
(C
, sigaddset
, "sigaddset");
159 function sigdelset
(set
: access sigset_t
; sig
: Signal
) return int
;
160 pragma Import
(C
, sigdelset
, "sigdelset");
162 function sigfillset
(set
: access sigset_t
) return int
;
163 pragma Import
(C
, sigfillset
, "sigfillset");
165 function sigismember
(set
: access sigset_t
; sig
: Signal
) return int
;
166 pragma Import
(C
, sigismember
, "sigismember");
168 function sigemptyset
(set
: access sigset_t
) return int
;
169 pragma Import
(C
, sigemptyset
, "sigemptyset");
171 type union_type_3
is new String (1 .. 116);
172 type siginfo_t
is record
176 X_data
: union_type_3
;
178 pragma Convention
(C
, siginfo_t
);
180 type struct_sigaction
is record
181 sa_handler
: System
.Address
;
183 sa_flags
: Interfaces
.C
.unsigned_long
;
184 sa_restorer
: System
.Address
;
186 pragma Convention
(C
, struct_sigaction
);
188 type struct_sigaction_ptr
is access all struct_sigaction
;
190 type Machine_State
is record
198 type Machine_State_Ptr
is access all Machine_State
;
200 SA_SIGINFO
: constant := System
.Linux
.SA_SIGINFO
;
201 SA_ONSTACK
: constant := System
.Linux
.SA_ONSTACK
;
203 SIG_BLOCK
: constant := 0;
204 SIG_UNBLOCK
: constant := 1;
205 SIG_SETMASK
: constant := 2;
207 SIG_DFL
: constant := 0;
208 SIG_IGN
: constant := 1;
212 act
: struct_sigaction_ptr
;
213 oact
: struct_sigaction_ptr
) return int
;
214 pragma Import
(C
, sigaction
, "sigaction");
220 type timespec
is private;
222 function To_Duration
(TS
: timespec
) return Duration;
223 pragma Inline
(To_Duration
);
225 function To_Timespec
(D
: Duration) return timespec
;
226 pragma Inline
(To_Timespec
);
228 function sysconf
(name
: int
) return long
;
229 pragma Import
(C
, sysconf
);
231 SC_CLK_TCK
: constant := 2;
232 SC_NPROCESSORS_ONLN
: constant := 84;
234 -------------------------
235 -- Priority Scheduling --
236 -------------------------
238 SCHED_OTHER
: constant := 0;
239 SCHED_FIFO
: constant := 1;
240 SCHED_RR
: constant := 2;
242 function To_Target_Priority
243 (Prio
: System
.Any_Priority
) return Interfaces
.C
.int
;
244 -- Maps System.Any_Priority to a POSIX priority
250 type pid_t
is private;
252 function kill
(pid
: pid_t
; sig
: Signal
) return int
;
253 pragma Import
(C
, kill
, "kill");
255 function getpid
return pid_t
;
256 pragma Import
(C
, getpid
, "getpid");
258 PR_SET_NAME
: constant := 15;
262 arg2
, arg3
, arg4
, arg5
: unsigned_long
:= 0) return int
;
263 pragma Import
(C
, prctl
);
269 type Thread_Body
is access
270 function (arg
: System
.Address
) return System
.Address
;
271 pragma Convention
(C
, Thread_Body
);
273 function Thread_Body_Access
is new
274 Ada
.Unchecked_Conversion
(System
.Address
, Thread_Body
);
276 type pthread_t
is new unsigned_long
;
277 subtype Thread_Id
is pthread_t
;
279 function To_pthread_t
is
280 new Ada
.Unchecked_Conversion
(unsigned_long
, pthread_t
);
282 type pthread_mutex_t
is limited private;
283 type pthread_rwlock_t
is limited private;
284 type pthread_cond_t
is limited private;
285 type pthread_attr_t
is limited private;
286 type pthread_mutexattr_t
is limited private;
287 type pthread_rwlockattr_t
is limited private;
288 type pthread_condattr_t
is limited private;
289 type pthread_key_t
is private;
291 PTHREAD_CREATE_DETACHED
: constant := 1;
297 type stack_t
is record
298 ss_sp
: System
.Address
;
302 pragma Convention
(C
, stack_t
);
305 (ss
: not null access stack_t
;
306 oss
: access stack_t
) return int
;
307 pragma Import
(C
, sigaltstack
, "sigaltstack");
309 Alternate_Stack
: aliased System
.Address
;
310 pragma Import
(C
, Alternate_Stack
, "__gnat_alternate_stack");
311 -- The alternate signal stack for stack overflows
313 Alternate_Stack_Size
: constant := 16 * 1024;
314 -- This must be in keeping with init.c:__gnat_alternate_stack
316 function Get_Stack_Base
(thread
: pthread_t
) return Address
;
317 pragma Inline
(Get_Stack_Base
);
318 -- This is a dummy procedure to share some GNULLI files
320 ---------------------------------------
321 -- Nonstandard Thread Initialization --
322 ---------------------------------------
324 procedure pthread_init
;
325 pragma Inline
(pthread_init
);
326 -- This is a dummy procedure to share some GNULLI files
328 -------------------------
329 -- POSIX.1c Section 3 --
330 -------------------------
332 function sigwait
(set
: access sigset_t
; sig
: access Signal
) return int
;
333 pragma Import
(C
, sigwait
, "sigwait");
335 function pthread_kill
(thread
: pthread_t
; sig
: Signal
) return int
;
336 pragma Import
(C
, pthread_kill
, "pthread_kill");
338 function pthread_sigmask
340 set
: access sigset_t
;
341 oset
: access sigset_t
) return int
;
342 pragma Import
(C
, pthread_sigmask
, "pthread_sigmask");
344 --------------------------
345 -- POSIX.1c Section 11 --
346 --------------------------
348 function pthread_mutexattr_init
349 (attr
: access pthread_mutexattr_t
) return int
;
350 pragma Import
(C
, pthread_mutexattr_init
, "pthread_mutexattr_init");
352 function pthread_mutexattr_destroy
353 (attr
: access pthread_mutexattr_t
) return int
;
354 pragma Import
(C
, pthread_mutexattr_destroy
, "pthread_mutexattr_destroy");
356 function pthread_mutex_init
357 (mutex
: access pthread_mutex_t
;
358 attr
: access pthread_mutexattr_t
) return int
;
359 pragma Import
(C
, pthread_mutex_init
, "pthread_mutex_init");
361 function pthread_mutex_destroy
(mutex
: access pthread_mutex_t
) return int
;
362 pragma Import
(C
, pthread_mutex_destroy
, "pthread_mutex_destroy");
364 function pthread_mutex_lock
(mutex
: access pthread_mutex_t
) return int
;
365 pragma Import
(C
, pthread_mutex_lock
, "pthread_mutex_lock");
367 function pthread_mutex_unlock
(mutex
: access pthread_mutex_t
) return int
;
368 pragma Import
(C
, pthread_mutex_unlock
, "pthread_mutex_unlock");
370 function pthread_rwlockattr_init
371 (attr
: access pthread_rwlockattr_t
) return int
;
372 pragma Import
(C
, pthread_rwlockattr_init
, "pthread_rwlockattr_init");
374 function pthread_rwlockattr_destroy
375 (attr
: access pthread_rwlockattr_t
) return int
;
376 pragma Import
(C
, pthread_rwlockattr_destroy
, "pthread_rwlockattr_destroy");
378 PTHREAD_RWLOCK_PREFER_READER_NP
: constant := 0;
379 PTHREAD_RWLOCK_PREFER_WRITER_NP
: constant := 1;
380 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
: constant := 2;
382 function pthread_rwlockattr_setkind_np
383 (attr
: access pthread_rwlockattr_t
;
384 pref
: int
) return int
;
386 (C
, pthread_rwlockattr_setkind_np
, "pthread_rwlockattr_setkind_np");
388 function pthread_rwlock_init
389 (mutex
: access pthread_rwlock_t
;
390 attr
: access pthread_rwlockattr_t
) return int
;
391 pragma Import
(C
, pthread_rwlock_init
, "pthread_rwlock_init");
393 function pthread_rwlock_destroy
394 (mutex
: access pthread_rwlock_t
) return int
;
395 pragma Import
(C
, pthread_rwlock_destroy
, "pthread_rwlock_destroy");
397 function pthread_rwlock_rdlock
(mutex
: access pthread_rwlock_t
) return int
;
398 pragma Import
(C
, pthread_rwlock_rdlock
, "pthread_rwlock_rdlock");
400 function pthread_rwlock_wrlock
(mutex
: access pthread_rwlock_t
) return int
;
401 pragma Import
(C
, pthread_rwlock_wrlock
, "pthread_rwlock_wrlock");
403 function pthread_rwlock_unlock
(mutex
: access pthread_rwlock_t
) return int
;
404 pragma Import
(C
, pthread_rwlock_unlock
, "pthread_rwlock_unlock");
406 function pthread_condattr_init
407 (attr
: access pthread_condattr_t
) return int
;
408 pragma Import
(C
, pthread_condattr_init
, "pthread_condattr_init");
410 function pthread_condattr_destroy
411 (attr
: access pthread_condattr_t
) return int
;
412 pragma Import
(C
, pthread_condattr_destroy
, "pthread_condattr_destroy");
414 function pthread_cond_init
415 (cond
: access pthread_cond_t
;
416 attr
: access pthread_condattr_t
) return int
;
417 pragma Import
(C
, pthread_cond_init
, "pthread_cond_init");
419 function pthread_cond_destroy
(cond
: access pthread_cond_t
) return int
;
420 pragma Import
(C
, pthread_cond_destroy
, "pthread_cond_destroy");
422 function pthread_cond_signal
(cond
: access pthread_cond_t
) return int
;
423 pragma Import
(C
, pthread_cond_signal
, "pthread_cond_signal");
425 function pthread_cond_wait
426 (cond
: access pthread_cond_t
;
427 mutex
: access pthread_mutex_t
) return int
;
428 pragma Import
(C
, pthread_cond_wait
, "pthread_cond_wait");
430 function pthread_cond_timedwait
431 (cond
: access pthread_cond_t
;
432 mutex
: access pthread_mutex_t
;
433 abstime
: access timespec
) return int
;
434 pragma Import
(C
, pthread_cond_timedwait
, "pthread_cond_timedwait");
436 --------------------------
437 -- POSIX.1c Section 13 --
438 --------------------------
440 type struct_sched_param
is record
441 sched_priority
: int
; -- scheduling priority
443 pragma Convention
(C
, struct_sched_param
);
445 function pthread_setschedparam
448 param
: access struct_sched_param
) return int
;
449 pragma Import
(C
, pthread_setschedparam
, "pthread_setschedparam");
451 function pthread_attr_setschedpolicy
452 (attr
: access pthread_attr_t
;
453 policy
: int
) return int
;
455 (C
, pthread_attr_setschedpolicy
, "pthread_attr_setschedpolicy");
457 function sched_yield
return int
;
458 pragma Import
(C
, sched_yield
, "sched_yield");
460 ---------------------------
461 -- P1003.1c - Section 16 --
462 ---------------------------
464 function pthread_attr_init
465 (attributes
: access pthread_attr_t
) return int
;
466 pragma Import
(C
, pthread_attr_init
, "pthread_attr_init");
468 function pthread_attr_destroy
469 (attributes
: access pthread_attr_t
) return int
;
470 pragma Import
(C
, pthread_attr_destroy
, "pthread_attr_destroy");
472 function pthread_attr_setdetachstate
473 (attr
: access pthread_attr_t
;
474 detachstate
: int
) return int
;
476 (C
, pthread_attr_setdetachstate
, "pthread_attr_setdetachstate");
478 function pthread_attr_setstacksize
479 (attr
: access pthread_attr_t
;
480 stacksize
: size_t
) return int
;
481 pragma Import
(C
, pthread_attr_setstacksize
, "pthread_attr_setstacksize");
483 function pthread_create
484 (thread
: access pthread_t
;
485 attributes
: access pthread_attr_t
;
486 start_routine
: Thread_Body
;
487 arg
: System
.Address
) return int
;
488 pragma Import
(C
, pthread_create
, "pthread_create");
490 procedure pthread_exit
(status
: System
.Address
);
491 pragma Import
(C
, pthread_exit
, "pthread_exit");
493 function pthread_self
return pthread_t
;
494 pragma Import
(C
, pthread_self
, "pthread_self");
496 function lwp_self
return System
.Address
;
497 pragma Import
(C
, lwp_self
, "__gnat_lwp_self");
499 --------------------------
500 -- POSIX.1c Section 17 --
501 --------------------------
503 function pthread_setspecific
504 (key
: pthread_key_t
;
505 value
: System
.Address
) return int
;
506 pragma Import
(C
, pthread_setspecific
, "pthread_setspecific");
508 function pthread_getspecific
(key
: pthread_key_t
) return System
.Address
;
509 pragma Import
(C
, pthread_getspecific
, "pthread_getspecific");
511 type destructor_pointer
is access procedure (arg
: System
.Address
);
512 pragma Convention
(C
, destructor_pointer
);
514 function pthread_key_create
515 (key
: access pthread_key_t
;
516 destructor
: destructor_pointer
) return int
;
517 pragma Import
(C
, pthread_key_create
, "pthread_key_create");
519 CPU_SETSIZE
: constant := 1_024
;
520 -- Size of the cpu_set_t mask on most linux systems (SUSE 11 uses 4_096).
521 -- This is kept for backward compatibility (System.Task_Info uses it), but
522 -- the run-time library does no longer rely on static masks, using
523 -- dynamically allocated masks instead.
525 type bit_field
is array (1 .. CPU_SETSIZE
) of Boolean;
526 for bit_field
'Size use CPU_SETSIZE
;
527 pragma Pack
(bit_field
);
528 pragma Convention
(C
, bit_field
);
530 type cpu_set_t
is record
533 pragma Convention
(C
, cpu_set_t
);
535 type cpu_set_t_ptr
is access all cpu_set_t
;
536 -- In the run-time library we use this pointer because the size of type
537 -- cpu_set_t varies depending on the glibc version. Hence, objects of type
538 -- cpu_set_t are allocated dynamically using the number of processors
539 -- available in the target machine (value obtained at execution time).
541 function CPU_ALLOC
(count
: size_t
) return cpu_set_t_ptr
;
542 pragma Import
(C
, CPU_ALLOC
, "__gnat_cpu_alloc");
543 -- Wrapper around the CPU_ALLOC C macro
545 function CPU_ALLOC_SIZE
(count
: size_t
) return size_t
;
546 pragma Import
(C
, CPU_ALLOC_SIZE
, "__gnat_cpu_alloc_size");
547 -- Wrapper around the CPU_ALLOC_SIZE C macro
549 procedure CPU_FREE
(cpuset
: cpu_set_t_ptr
);
550 pragma Import
(C
, CPU_FREE
, "__gnat_cpu_free");
551 -- Wrapper around the CPU_FREE C macro
553 procedure CPU_ZERO
(count
: size_t
; cpuset
: cpu_set_t_ptr
);
554 pragma Import
(C
, CPU_ZERO
, "__gnat_cpu_zero");
555 -- Wrapper around the CPU_ZERO_S C macro
557 procedure CPU_SET
(cpu
: int
; count
: size_t
; cpuset
: cpu_set_t_ptr
);
558 pragma Import
(C
, CPU_SET
, "__gnat_cpu_set");
559 -- Wrapper around the CPU_SET_S C macro
561 function pthread_setaffinity_np
564 cpuset
: cpu_set_t_ptr
) return int
;
565 pragma Import
(C
, pthread_setaffinity_np
, "pthread_setaffinity_np");
566 pragma Weak_External
(pthread_setaffinity_np
);
567 -- Use a weak symbol because this function may be available or not,
568 -- depending on the version of the system.
570 function pthread_attr_setaffinity_np
571 (attr
: access pthread_attr_t
;
573 cpuset
: cpu_set_t_ptr
) return int
;
574 pragma Import
(C
, pthread_attr_setaffinity_np
,
575 "pthread_attr_setaffinity_np");
576 pragma Weak_External
(pthread_attr_setaffinity_np
);
577 -- Use a weak symbol because this function may be available or not,
578 -- depending on the version of the system.
583 array (0 .. OS_Constants
.SIZEOF_sigset
- 1) of unsigned_char
;
584 pragma Convention
(C
, sigset_t
);
585 for sigset_t
'Alignment use Interfaces
.C
.unsigned_long
'Alignment;
587 pragma Warnings
(Off
);
588 for struct_sigaction
use record
589 sa_handler
at Linux
.sa_handler_pos
range 0 .. Standard
'Address_Size - 1;
590 sa_mask
at Linux
.sa_mask_pos
range 0 .. 1023;
591 sa_flags
at Linux
.sa_flags_pos
range 0 .. Standard
'Address_Size - 1;
593 -- We intentionally leave sa_restorer unspecified and let the compiler
594 -- append it after the last field, so disable corresponding warning.
595 pragma Warnings
(On
);
597 type pid_t
is new int
;
599 type time_t
is new long
;
601 type timespec
is record
605 pragma Convention
(C
, timespec
);
607 type unsigned_long_long_t
is mod 2 ** 64;
608 -- Local type only used to get the alignment of this type below
610 subtype char_array
is Interfaces
.C
.char_array
;
612 type pthread_attr_t
is record
613 Data
: char_array
(1 .. OS_Constants
.PTHREAD_ATTR_SIZE
);
615 pragma Convention
(C
, pthread_attr_t
);
616 for pthread_attr_t
'Alignment use Interfaces
.C
.unsigned_long
'Alignment;
618 type pthread_condattr_t
is record
619 Data
: char_array
(1 .. OS_Constants
.PTHREAD_CONDATTR_SIZE
);
621 pragma Convention
(C
, pthread_condattr_t
);
622 for pthread_condattr_t
'Alignment use Interfaces
.C
.int
'Alignment;
624 type pthread_mutexattr_t
is record
625 Data
: char_array
(1 .. OS_Constants
.PTHREAD_MUTEXATTR_SIZE
);
627 pragma Convention
(C
, pthread_mutexattr_t
);
628 for pthread_mutexattr_t
'Alignment use Interfaces
.C
.int
'Alignment;
630 type pthread_mutex_t
is record
631 Data
: char_array
(1 .. OS_Constants
.PTHREAD_MUTEX_SIZE
);
633 pragma Convention
(C
, pthread_mutex_t
);
634 for pthread_mutex_t
'Alignment use Interfaces
.C
.unsigned_long
'Alignment;
636 type pthread_rwlockattr_t
is record
637 Data
: char_array
(1 .. OS_Constants
.PTHREAD_RWLOCKATTR_SIZE
);
639 pragma Convention
(C
, pthread_rwlockattr_t
);
640 for pthread_rwlockattr_t
'Alignment use Interfaces
.C
.unsigned_long
'Alignment;
642 type pthread_rwlock_t
is record
643 Data
: char_array
(1 .. OS_Constants
.PTHREAD_RWLOCK_SIZE
);
645 pragma Convention
(C
, pthread_rwlock_t
);
646 for pthread_rwlock_t
'Alignment use Interfaces
.C
.unsigned_long
'Alignment;
648 type pthread_cond_t
is record
649 Data
: char_array
(1 .. OS_Constants
.PTHREAD_COND_SIZE
);
651 pragma Convention
(C
, pthread_cond_t
);
652 for pthread_cond_t
'Alignment use unsigned_long_long_t
'Alignment;
654 type pthread_key_t
is new unsigned
;
656 end System
.OS_Interface
;