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-2014, 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");
50 pragma Linker_Options
("-lrt");
51 -- Needed for clock_getres with glibc versions prior to 2.17
53 subtype int
is Interfaces
.C
.int
;
54 subtype char
is Interfaces
.C
.char
;
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
;
68 function errno
return int
;
69 pragma Import
(C
, errno
, "__get_errno");
71 EAGAIN
: constant := System
.Linux
.EAGAIN
;
72 EINTR
: constant := System
.Linux
.EINTR
;
73 EINVAL
: constant := System
.Linux
.EINVAL
;
74 ENOMEM
: constant := System
.Linux
.ENOMEM
;
75 EPERM
: constant := System
.Linux
.EPERM
;
76 ETIMEDOUT
: constant := System
.Linux
.ETIMEDOUT
;
82 Max_Interrupt
: constant := 63;
83 type Signal
is new int
range 0 .. Max_Interrupt
;
84 for Signal
'Size use int
'Size;
86 SIGHUP
: constant := System
.Linux
.SIGHUP
;
87 SIGINT
: constant := System
.Linux
.SIGINT
;
88 SIGQUIT
: constant := System
.Linux
.SIGQUIT
;
89 SIGILL
: constant := System
.Linux
.SIGILL
;
90 SIGTRAP
: constant := System
.Linux
.SIGTRAP
;
91 SIGIOT
: constant := System
.Linux
.SIGIOT
;
92 SIGABRT
: constant := System
.Linux
.SIGABRT
;
93 SIGFPE
: constant := System
.Linux
.SIGFPE
;
94 SIGKILL
: constant := System
.Linux
.SIGKILL
;
95 SIGBUS
: constant := System
.Linux
.SIGBUS
;
96 SIGSEGV
: constant := System
.Linux
.SIGSEGV
;
97 SIGPIPE
: constant := System
.Linux
.SIGPIPE
;
98 SIGALRM
: constant := System
.Linux
.SIGALRM
;
99 SIGTERM
: constant := System
.Linux
.SIGTERM
;
100 SIGUSR1
: constant := System
.Linux
.SIGUSR1
;
101 SIGUSR2
: constant := System
.Linux
.SIGUSR2
;
102 SIGCLD
: constant := System
.Linux
.SIGCLD
;
103 SIGCHLD
: constant := System
.Linux
.SIGCHLD
;
104 SIGPWR
: constant := System
.Linux
.SIGPWR
;
105 SIGWINCH
: constant := System
.Linux
.SIGWINCH
;
106 SIGURG
: constant := System
.Linux
.SIGURG
;
107 SIGPOLL
: constant := System
.Linux
.SIGPOLL
;
108 SIGIO
: constant := System
.Linux
.SIGIO
;
109 SIGLOST
: constant := System
.Linux
.SIGLOST
;
110 SIGSTOP
: constant := System
.Linux
.SIGSTOP
;
111 SIGTSTP
: constant := System
.Linux
.SIGTSTP
;
112 SIGCONT
: constant := System
.Linux
.SIGCONT
;
113 SIGTTIN
: constant := System
.Linux
.SIGTTIN
;
114 SIGTTOU
: constant := System
.Linux
.SIGTTOU
;
115 SIGVTALRM
: constant := System
.Linux
.SIGVTALRM
;
116 SIGPROF
: constant := System
.Linux
.SIGPROF
;
117 SIGXCPU
: constant := System
.Linux
.SIGXCPU
;
118 SIGXFSZ
: constant := System
.Linux
.SIGXFSZ
;
119 SIGUNUSED
: constant := System
.Linux
.SIGUNUSED
;
120 SIGSTKFLT
: constant := System
.Linux
.SIGSTKFLT
;
121 SIGLTHRRES
: constant := System
.Linux
.SIGLTHRRES
;
122 SIGLTHRCAN
: constant := System
.Linux
.SIGLTHRCAN
;
123 SIGLTHRDBG
: constant := System
.Linux
.SIGLTHRDBG
;
125 SIGADAABORT
: constant := SIGABRT
;
126 -- Change this to use another signal for task abort. SIGTERM might be a
129 type Signal_Set
is array (Natural range <>) of Signal
;
131 Unmasked
: constant Signal_Set
:= (
133 -- To enable debugging on multithreaded applications, mark SIGTRAP to
138 SIGTTIN
, SIGTTOU
, SIGTSTP
,
139 -- Keep these three signals unmasked so that background processes and IO
140 -- behaves as normal "C" applications
143 -- To avoid confusing the profiler
146 -- These two signals actually can't be masked (POSIX won't allow it)
148 SIGLTHRRES
, SIGLTHRCAN
, SIGLTHRDBG
);
149 -- These three signals are used by GNU/LinuxThreads starting from glibc
152 Reserved
: constant Signal_Set
:= (SIGVTALRM
, SIGUNUSED
);
153 -- Not clear why these two signals are reserved. Perhaps they are not
154 -- supported by this version of GNU/Linux ???
156 type sigset_t
is private;
158 function sigaddset
(set
: access sigset_t
; sig
: Signal
) return int
;
159 pragma Import
(C
, sigaddset
, "sigaddset");
161 function sigdelset
(set
: access sigset_t
; sig
: Signal
) return int
;
162 pragma Import
(C
, sigdelset
, "sigdelset");
164 function sigfillset
(set
: access sigset_t
) return int
;
165 pragma Import
(C
, sigfillset
, "sigfillset");
167 function sigismember
(set
: access sigset_t
; sig
: Signal
) return int
;
168 pragma Import
(C
, sigismember
, "sigismember");
170 function sigemptyset
(set
: access sigset_t
) return int
;
171 pragma Import
(C
, sigemptyset
, "sigemptyset");
173 type union_type_3
is new String (1 .. 116);
174 type siginfo_t
is record
178 X_data
: union_type_3
;
180 pragma Convention
(C
, siginfo_t
);
182 type struct_sigaction
is record
183 sa_handler
: System
.Address
;
185 sa_flags
: Interfaces
.C
.unsigned_long
;
186 sa_restorer
: System
.Address
;
188 pragma Convention
(C
, struct_sigaction
);
190 type struct_sigaction_ptr
is access all struct_sigaction
;
192 type Machine_State
is record
200 type Machine_State_Ptr
is access all Machine_State
;
202 SA_SIGINFO
: constant := System
.Linux
.SA_SIGINFO
;
203 SA_ONSTACK
: constant := System
.Linux
.SA_ONSTACK
;
205 SIG_BLOCK
: constant := 0;
206 SIG_UNBLOCK
: constant := 1;
207 SIG_SETMASK
: constant := 2;
209 SIG_DFL
: constant := 0;
210 SIG_IGN
: constant := 1;
214 act
: struct_sigaction_ptr
;
215 oact
: struct_sigaction_ptr
) return int
;
216 pragma Import
(C
, sigaction
, "sigaction");
222 subtype time_t
is System
.Linux
.time_t
;
223 subtype timespec
is System
.Linux
.timespec
;
224 subtype timeval
is System
.Linux
.timeval
;
225 subtype clockid_t
is System
.Linux
.clockid_t
;
227 function clock_getres
228 (clock_id
: clockid_t
;
229 res
: access timespec
) return int
;
230 pragma Import
(C
, clock_getres
, "clock_getres");
232 function To_Duration
(TS
: timespec
) return Duration;
233 pragma Inline
(To_Duration
);
235 function To_Timespec
(D
: Duration) return timespec
;
236 pragma Inline
(To_Timespec
);
238 function sysconf
(name
: int
) return long
;
239 pragma Import
(C
, sysconf
);
241 SC_CLK_TCK
: constant := 2;
242 SC_NPROCESSORS_ONLN
: constant := 84;
244 -------------------------
245 -- Priority Scheduling --
246 -------------------------
248 SCHED_OTHER
: constant := 0;
249 SCHED_FIFO
: constant := 1;
250 SCHED_RR
: constant := 2;
252 function To_Target_Priority
253 (Prio
: System
.Any_Priority
) return Interfaces
.C
.int
;
254 -- Maps System.Any_Priority to a POSIX priority
260 type pid_t
is private;
262 function kill
(pid
: pid_t
; sig
: Signal
) return int
;
263 pragma Import
(C
, kill
, "kill");
265 function getpid
return pid_t
;
266 pragma Import
(C
, getpid
, "getpid");
268 PR_SET_NAME
: constant := 15;
272 arg2
, arg3
, arg4
, arg5
: unsigned_long
:= 0) return int
;
273 pragma Import
(C
, prctl
);
279 type Thread_Body
is access
280 function (arg
: System
.Address
) return System
.Address
;
281 pragma Convention
(C
, Thread_Body
);
283 function Thread_Body_Access
is new
284 Ada
.Unchecked_Conversion
(System
.Address
, Thread_Body
);
286 type pthread_t
is new unsigned_long
;
287 subtype Thread_Id
is pthread_t
;
289 function To_pthread_t
is
290 new Ada
.Unchecked_Conversion
(unsigned_long
, pthread_t
);
292 type pthread_mutex_t
is limited private;
293 type pthread_rwlock_t
is limited private;
294 type pthread_cond_t
is limited private;
295 type pthread_attr_t
is limited private;
296 type pthread_mutexattr_t
is limited private;
297 type pthread_rwlockattr_t
is limited private;
298 type pthread_condattr_t
is limited private;
299 type pthread_key_t
is private;
301 PTHREAD_CREATE_DETACHED
: constant := 1;
307 type stack_t
is record
308 ss_sp
: System
.Address
;
312 pragma Convention
(C
, stack_t
);
315 (ss
: not null access stack_t
;
316 oss
: access stack_t
) return int
;
317 pragma Import
(C
, sigaltstack
, "sigaltstack");
319 Alternate_Stack
: aliased System
.Address
;
320 pragma Import
(C
, Alternate_Stack
, "__gnat_alternate_stack");
321 -- The alternate signal stack for stack overflows
323 Alternate_Stack_Size
: constant := 16 * 1024;
324 -- This must be in keeping with init.c:__gnat_alternate_stack
326 function Get_Stack_Base
(thread
: pthread_t
) return Address
;
327 pragma Inline
(Get_Stack_Base
);
328 -- This is a dummy procedure to share some GNULLI files
330 ---------------------------------------
331 -- Nonstandard Thread Initialization --
332 ---------------------------------------
334 procedure pthread_init
;
335 pragma Inline
(pthread_init
);
336 -- This is a dummy procedure to share some GNULLI files
338 -------------------------
339 -- POSIX.1c Section 3 --
340 -------------------------
342 function sigwait
(set
: access sigset_t
; sig
: access Signal
) return int
;
343 pragma Import
(C
, sigwait
, "sigwait");
345 function pthread_kill
(thread
: pthread_t
; sig
: Signal
) return int
;
346 pragma Import
(C
, pthread_kill
, "pthread_kill");
348 function pthread_sigmask
350 set
: access sigset_t
;
351 oset
: access sigset_t
) return int
;
352 pragma Import
(C
, pthread_sigmask
, "pthread_sigmask");
354 --------------------------
355 -- POSIX.1c Section 11 --
356 --------------------------
358 function pthread_mutexattr_init
359 (attr
: access pthread_mutexattr_t
) return int
;
360 pragma Import
(C
, pthread_mutexattr_init
, "pthread_mutexattr_init");
362 function pthread_mutexattr_destroy
363 (attr
: access pthread_mutexattr_t
) return int
;
364 pragma Import
(C
, pthread_mutexattr_destroy
, "pthread_mutexattr_destroy");
366 function pthread_mutex_init
367 (mutex
: access pthread_mutex_t
;
368 attr
: access pthread_mutexattr_t
) return int
;
369 pragma Import
(C
, pthread_mutex_init
, "pthread_mutex_init");
371 function pthread_mutex_destroy
(mutex
: access pthread_mutex_t
) return int
;
372 pragma Import
(C
, pthread_mutex_destroy
, "pthread_mutex_destroy");
374 function pthread_mutex_lock
(mutex
: access pthread_mutex_t
) return int
;
375 pragma Import
(C
, pthread_mutex_lock
, "pthread_mutex_lock");
377 function pthread_mutex_unlock
(mutex
: access pthread_mutex_t
) return int
;
378 pragma Import
(C
, pthread_mutex_unlock
, "pthread_mutex_unlock");
380 function pthread_rwlockattr_init
381 (attr
: access pthread_rwlockattr_t
) return int
;
382 pragma Import
(C
, pthread_rwlockattr_init
, "pthread_rwlockattr_init");
384 function pthread_rwlockattr_destroy
385 (attr
: access pthread_rwlockattr_t
) return int
;
386 pragma Import
(C
, pthread_rwlockattr_destroy
, "pthread_rwlockattr_destroy");
388 PTHREAD_RWLOCK_PREFER_READER_NP
: constant := 0;
389 PTHREAD_RWLOCK_PREFER_WRITER_NP
: constant := 1;
390 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
: constant := 2;
392 function pthread_rwlockattr_setkind_np
393 (attr
: access pthread_rwlockattr_t
;
394 pref
: int
) return int
;
396 (C
, pthread_rwlockattr_setkind_np
, "pthread_rwlockattr_setkind_np");
398 function pthread_rwlock_init
399 (mutex
: access pthread_rwlock_t
;
400 attr
: access pthread_rwlockattr_t
) return int
;
401 pragma Import
(C
, pthread_rwlock_init
, "pthread_rwlock_init");
403 function pthread_rwlock_destroy
404 (mutex
: access pthread_rwlock_t
) return int
;
405 pragma Import
(C
, pthread_rwlock_destroy
, "pthread_rwlock_destroy");
407 function pthread_rwlock_rdlock
(mutex
: access pthread_rwlock_t
) return int
;
408 pragma Import
(C
, pthread_rwlock_rdlock
, "pthread_rwlock_rdlock");
410 function pthread_rwlock_wrlock
(mutex
: access pthread_rwlock_t
) return int
;
411 pragma Import
(C
, pthread_rwlock_wrlock
, "pthread_rwlock_wrlock");
413 function pthread_rwlock_unlock
(mutex
: access pthread_rwlock_t
) return int
;
414 pragma Import
(C
, pthread_rwlock_unlock
, "pthread_rwlock_unlock");
416 function pthread_condattr_init
417 (attr
: access pthread_condattr_t
) return int
;
418 pragma Import
(C
, pthread_condattr_init
, "pthread_condattr_init");
420 function pthread_condattr_destroy
421 (attr
: access pthread_condattr_t
) return int
;
422 pragma Import
(C
, pthread_condattr_destroy
, "pthread_condattr_destroy");
424 function pthread_cond_init
425 (cond
: access pthread_cond_t
;
426 attr
: access pthread_condattr_t
) return int
;
427 pragma Import
(C
, pthread_cond_init
, "pthread_cond_init");
429 function pthread_cond_destroy
(cond
: access pthread_cond_t
) return int
;
430 pragma Import
(C
, pthread_cond_destroy
, "pthread_cond_destroy");
432 function pthread_cond_signal
(cond
: access pthread_cond_t
) return int
;
433 pragma Import
(C
, pthread_cond_signal
, "pthread_cond_signal");
435 function pthread_cond_wait
436 (cond
: access pthread_cond_t
;
437 mutex
: access pthread_mutex_t
) return int
;
438 pragma Import
(C
, pthread_cond_wait
, "pthread_cond_wait");
440 function pthread_cond_timedwait
441 (cond
: access pthread_cond_t
;
442 mutex
: access pthread_mutex_t
;
443 abstime
: access timespec
) return int
;
444 pragma Import
(C
, pthread_cond_timedwait
, "pthread_cond_timedwait");
446 --------------------------
447 -- POSIX.1c Section 13 --
448 --------------------------
450 type struct_sched_param
is record
451 sched_priority
: int
; -- scheduling priority
453 pragma Convention
(C
, struct_sched_param
);
455 function pthread_setschedparam
458 param
: access struct_sched_param
) return int
;
459 pragma Import
(C
, pthread_setschedparam
, "pthread_setschedparam");
461 function pthread_attr_setschedpolicy
462 (attr
: access pthread_attr_t
;
463 policy
: int
) return int
;
465 (C
, pthread_attr_setschedpolicy
, "pthread_attr_setschedpolicy");
467 function sched_yield
return int
;
468 pragma Import
(C
, sched_yield
, "sched_yield");
470 ---------------------------
471 -- P1003.1c - Section 16 --
472 ---------------------------
474 function pthread_attr_init
475 (attributes
: access pthread_attr_t
) return int
;
476 pragma Import
(C
, pthread_attr_init
, "pthread_attr_init");
478 function pthread_attr_destroy
479 (attributes
: access pthread_attr_t
) return int
;
480 pragma Import
(C
, pthread_attr_destroy
, "pthread_attr_destroy");
482 function pthread_attr_setdetachstate
483 (attr
: access pthread_attr_t
;
484 detachstate
: int
) return int
;
486 (C
, pthread_attr_setdetachstate
, "pthread_attr_setdetachstate");
488 function pthread_attr_setstacksize
489 (attr
: access pthread_attr_t
;
490 stacksize
: size_t
) return int
;
491 pragma Import
(C
, pthread_attr_setstacksize
, "pthread_attr_setstacksize");
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");
500 procedure pthread_exit
(status
: System
.Address
);
501 pragma Import
(C
, pthread_exit
, "pthread_exit");
503 function pthread_self
return pthread_t
;
504 pragma Import
(C
, pthread_self
, "pthread_self");
506 function lwp_self
return System
.Address
;
507 pragma Import
(C
, lwp_self
, "__gnat_lwp_self");
509 --------------------------
510 -- POSIX.1c Section 17 --
511 --------------------------
513 function pthread_setspecific
514 (key
: pthread_key_t
;
515 value
: System
.Address
) return int
;
516 pragma Import
(C
, pthread_setspecific
, "pthread_setspecific");
518 function pthread_getspecific
(key
: pthread_key_t
) return System
.Address
;
519 pragma Import
(C
, pthread_getspecific
, "pthread_getspecific");
521 type destructor_pointer
is access procedure (arg
: System
.Address
);
522 pragma Convention
(C
, destructor_pointer
);
524 function pthread_key_create
525 (key
: access pthread_key_t
;
526 destructor
: destructor_pointer
) return int
;
527 pragma Import
(C
, pthread_key_create
, "pthread_key_create");
529 CPU_SETSIZE
: constant := 1_024
;
530 -- Size of the cpu_set_t mask on most linux systems (SUSE 11 uses 4_096).
531 -- This is kept for backward compatibility (System.Task_Info uses it), but
532 -- the run-time library does no longer rely on static masks, using
533 -- dynamically allocated masks instead.
535 type bit_field
is array (1 .. CPU_SETSIZE
) of Boolean;
536 for bit_field
'Size use CPU_SETSIZE
;
537 pragma Pack
(bit_field
);
538 pragma Convention
(C
, bit_field
);
540 type cpu_set_t
is record
543 pragma Convention
(C
, cpu_set_t
);
545 type cpu_set_t_ptr
is access all cpu_set_t
;
546 -- In the run-time library we use this pointer because the size of type
547 -- cpu_set_t varies depending on the glibc version. Hence, objects of type
548 -- cpu_set_t are allocated dynamically using the number of processors
549 -- available in the target machine (value obtained at execution time).
551 function CPU_ALLOC
(count
: size_t
) return cpu_set_t_ptr
;
552 pragma Import
(C
, CPU_ALLOC
, "__gnat_cpu_alloc");
553 -- Wrapper around the CPU_ALLOC C macro
555 function CPU_ALLOC_SIZE
(count
: size_t
) return size_t
;
556 pragma Import
(C
, CPU_ALLOC_SIZE
, "__gnat_cpu_alloc_size");
557 -- Wrapper around the CPU_ALLOC_SIZE C macro
559 procedure CPU_FREE
(cpuset
: cpu_set_t_ptr
);
560 pragma Import
(C
, CPU_FREE
, "__gnat_cpu_free");
561 -- Wrapper around the CPU_FREE C macro
563 procedure CPU_ZERO
(count
: size_t
; cpuset
: cpu_set_t_ptr
);
564 pragma Import
(C
, CPU_ZERO
, "__gnat_cpu_zero");
565 -- Wrapper around the CPU_ZERO_S C macro
567 procedure CPU_SET
(cpu
: int
; count
: size_t
; cpuset
: cpu_set_t_ptr
);
568 pragma Import
(C
, CPU_SET
, "__gnat_cpu_set");
569 -- Wrapper around the CPU_SET_S C macro
571 function pthread_setaffinity_np
574 cpuset
: cpu_set_t_ptr
) return int
;
575 pragma Import
(C
, pthread_setaffinity_np
, "pthread_setaffinity_np");
576 pragma Weak_External
(pthread_setaffinity_np
);
577 -- Use a weak symbol because this function may be available or not,
578 -- depending on the version of the system.
580 function pthread_attr_setaffinity_np
581 (attr
: access pthread_attr_t
;
583 cpuset
: cpu_set_t_ptr
) return int
;
584 pragma Import
(C
, pthread_attr_setaffinity_np
,
585 "pthread_attr_setaffinity_np");
586 pragma Weak_External
(pthread_attr_setaffinity_np
);
587 -- Use a weak symbol because this function may be available or not,
588 -- depending on the version of the system.
593 array (0 .. OS_Constants
.SIZEOF_sigset
- 1) of unsigned_char
;
594 pragma Convention
(C
, sigset_t
);
595 for sigset_t
'Alignment use Interfaces
.C
.unsigned_long
'Alignment;
597 pragma Warnings
(Off
);
598 for struct_sigaction
use record
599 sa_handler
at Linux
.sa_handler_pos
range 0 .. Standard
'Address_Size - 1;
600 sa_mask
at Linux
.sa_mask_pos
range 0 .. 1023;
601 sa_flags
at Linux
.sa_flags_pos
602 range 0 .. Interfaces
.C
.unsigned_long
'Size - 1;
604 -- We intentionally leave sa_restorer unspecified and let the compiler
605 -- append it after the last field, so disable corresponding warning.
606 pragma Warnings
(On
);
608 type pid_t
is new int
;
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 Interfaces
.Unsigned_64
'Alignment;
654 type pthread_key_t
is new unsigned
;
656 end System
.OS_Interface
;