Skip several gcc.dg/builtin-dynamic-object-size tests on hppa*-*-hpux*
[official-gcc.git] / gcc / ada / libgnarl / s-osinte__linux.ads
blobadf040e9fc947ed4ecc0a4567bef3f42e48fb26c
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-2017, Florida State University --
10 -- Copyright (C) 1995-2023, Free Software Foundation, Inc. --
11 -- --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 3, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. --
18 -- --
19 -- As a special exception under Section 7 of GPL version 3, you are granted --
20 -- additional permissions described in the GCC Runtime Library Exception, --
21 -- version 3.1, as published by the Free Software Foundation. --
22 -- --
23 -- You should have received a copy of the GNU General Public License and --
24 -- a copy of the GCC Runtime Library Exception along with this program; --
25 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
26 -- <http://www.gnu.org/licenses/>. --
27 -- --
28 -- GNARL was developed by the GNARL team at Florida State University. --
29 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
30 -- --
31 ------------------------------------------------------------------------------
33 -- This is a GNU/Linux 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;
42 with Interfaces.C;
43 with System.Linux;
44 with System.OS_Constants;
46 package System.OS_Interface is
47 pragma Preelaborate;
49 pragma Linker_Options ("-lrt");
50 -- Needed for clock_getres with glibc versions prior to 2.17
52 pragma Linker_Options ("-lpthread");
54 use type System.Linux.time_t;
56 subtype int is Interfaces.C.int;
57 subtype char is Interfaces.C.char;
58 subtype short is Interfaces.C.short;
59 subtype long is Interfaces.C.long;
60 subtype unsigned is Interfaces.C.unsigned;
61 subtype unsigned_short is Interfaces.C.unsigned_short;
62 subtype unsigned_long is Interfaces.C.unsigned_long;
63 subtype unsigned_char is Interfaces.C.unsigned_char;
64 subtype plain_char is Interfaces.C.plain_char;
65 subtype size_t is Interfaces.C.size_t;
67 -----------
68 -- Errno --
69 -----------
71 function errno return int;
72 pragma Import (C, errno, "__get_errno");
74 EAGAIN : constant := System.Linux.EAGAIN;
75 EINTR : constant := System.Linux.EINTR;
76 EINVAL : constant := System.Linux.EINVAL;
77 ENOMEM : constant := System.Linux.ENOMEM;
78 EPERM : constant := System.Linux.EPERM;
79 ETIMEDOUT : constant := System.Linux.ETIMEDOUT;
81 -------------
82 -- Signals --
83 -------------
85 Max_Interrupt : constant := 63;
86 type Signal is new int range 0 .. Max_Interrupt;
87 for Signal'Size use int'Size;
89 SIGHUP : constant := System.Linux.SIGHUP;
90 SIGINT : constant := System.Linux.SIGINT;
91 SIGQUIT : constant := System.Linux.SIGQUIT;
92 SIGILL : constant := System.Linux.SIGILL;
93 SIGTRAP : constant := System.Linux.SIGTRAP;
94 SIGIOT : constant := System.Linux.SIGIOT;
95 SIGABRT : constant := System.Linux.SIGABRT;
96 SIGBUS : constant := System.Linux.SIGBUS;
97 SIGFPE : constant := System.Linux.SIGFPE;
98 SIGKILL : constant := System.Linux.SIGKILL;
99 SIGUSR1 : constant := System.Linux.SIGUSR1;
100 SIGSEGV : constant := System.Linux.SIGSEGV;
101 SIGUSR2 : constant := System.Linux.SIGUSR2;
102 SIGPIPE : constant := System.Linux.SIGPIPE;
103 SIGALRM : constant := System.Linux.SIGALRM;
104 SIGTERM : constant := System.Linux.SIGTERM;
105 SIGSTKFLT : constant := System.Linux.SIGSTKFLT;
106 SIGCLD : constant := System.Linux.SIGCLD;
107 SIGCHLD : constant := System.Linux.SIGCHLD;
108 SIGCONT : constant := System.Linux.SIGCONT;
109 SIGSTOP : constant := System.Linux.SIGSTOP;
110 SIGTSTP : constant := System.Linux.SIGTSTP;
111 SIGTTIN : constant := System.Linux.SIGTTIN;
112 SIGTTOU : constant := System.Linux.SIGTTOU;
113 SIGURG : constant := System.Linux.SIGURG;
114 SIGXCPU : constant := System.Linux.SIGXCPU;
115 SIGXFSZ : constant := System.Linux.SIGXFSZ;
116 SIGVTALRM : constant := System.Linux.SIGVTALRM;
117 SIGPROF : constant := System.Linux.SIGPROF;
118 SIGWINCH : constant := System.Linux.SIGWINCH;
119 SIGPOLL : constant := System.Linux.SIGPOLL;
120 SIGIO : constant := System.Linux.SIGIO;
121 SIGLOST : constant := System.Linux.SIGLOST;
122 SIGPWR : constant := System.Linux.SIGPWR;
123 SIGSYS : constant := System.Linux.SIGSYS;
124 SIGUNUSED : constant := System.Linux.SIGUNUSED;
125 SIG32 : constant := System.Linux.SIG32;
126 SIG33 : constant := System.Linux.SIG33;
127 SIG34 : constant := System.Linux.SIG34;
129 SIGADAABORT : constant := SIGABRT;
130 -- Change this to use another signal for task abort. SIGTERM might be a
131 -- good one.
133 type Signal_Set is array (Natural range <>) of Signal;
135 Unmasked : constant Signal_Set := [
136 SIGTRAP,
137 -- To enable debugging on multithreaded applications, mark SIGTRAP to
138 -- be kept unmasked.
140 SIGBUS,
142 SIGTTIN, SIGTTOU, SIGTSTP,
143 -- Keep these three signals unmasked so that background processes and IO
144 -- behaves as normal "C" applications
146 SIGPROF,
147 -- To avoid confusing the profiler
149 SIGKILL, SIGSTOP
150 -- These two signals actually can't be masked (POSIX won't allow it)
153 Reserved : constant Signal_Set := [
154 SIG32, SIG33, SIG34
155 -- glibc POSIX threads implementation uses two (NPTL) or three
156 -- (LinuxThreads) real-time signals for its own use (see SIGNAL(7)).
157 -- These signals are considered reserved and not unmasked as glibc does
158 -- not permit these signals to be used by the public signal.h API.
159 -- While LinuxThreads is mostly likely unused now, SIG34 is still
160 -- reserved as this behavior is consistent with past GNAT releases.
163 type sigset_t is private;
165 function sigaddset (set : access sigset_t; sig : Signal) return int;
166 pragma Import (C, sigaddset, "sigaddset");
168 function sigdelset (set : access sigset_t; sig : Signal) return int;
169 pragma Import (C, sigdelset, "sigdelset");
171 function sigfillset (set : access sigset_t) return int;
172 pragma Import (C, sigfillset, "sigfillset");
174 function sigismember (set : access sigset_t; sig : Signal) return int;
175 pragma Import (C, sigismember, "sigismember");
177 function sigemptyset (set : access sigset_t) return int;
178 pragma Import (C, sigemptyset, "sigemptyset");
180 type union_type_3 is new String (1 .. 116);
181 type siginfo_t is record
182 si_signo : int;
183 si_code : int;
184 si_errno : int;
185 X_data : union_type_3;
186 end record;
187 pragma Convention (C, siginfo_t);
189 type struct_sigaction is record
190 sa_handler : System.Address;
191 sa_mask : sigset_t;
192 sa_flags : int;
193 sa_restorer : System.Address;
194 end record;
195 pragma Convention (C, struct_sigaction);
197 type struct_sigaction_ptr is access all struct_sigaction;
199 type Machine_State is record
200 eip : unsigned_long;
201 ebx : unsigned_long;
202 esp : unsigned_long;
203 ebp : unsigned_long;
204 esi : unsigned_long;
205 edi : unsigned_long;
206 end record;
207 type Machine_State_Ptr is access all Machine_State;
209 SA_SIGINFO : constant := System.Linux.SA_SIGINFO;
210 SA_ONSTACK : constant := System.Linux.SA_ONSTACK;
212 SIG_BLOCK : constant := 0;
213 SIG_UNBLOCK : constant := 1;
214 SIG_SETMASK : constant := 2;
216 SIG_DFL : constant := 0;
217 SIG_IGN : constant := 1;
219 function sigaction
220 (sig : Signal;
221 act : struct_sigaction_ptr;
222 oact : struct_sigaction_ptr) return int;
223 pragma Import (C, sigaction, "sigaction");
225 ----------
226 -- Time --
227 ----------
229 subtype time_t is System.Linux.time_t;
230 subtype timespec is System.Linux.timespec;
231 subtype timeval is System.Linux.timeval;
232 subtype clockid_t is System.Linux.clockid_t;
234 function clock_gettime
235 (clock_id : clockid_t; tp : access timespec) return int;
236 pragma Import (C, clock_gettime, "clock_gettime");
238 function clock_getres
239 (clock_id : clockid_t;
240 res : access timespec) return int;
241 pragma Import (C, clock_getres, "clock_getres");
243 function To_Duration (TS : timespec) return Duration;
244 pragma Inline (To_Duration);
246 function To_Timespec (D : Duration) return timespec;
247 pragma Inline (To_Timespec);
249 function sysconf (name : int) return long;
250 pragma Import (C, sysconf);
252 SC_CLK_TCK : constant := 2;
253 SC_NPROCESSORS_ONLN : constant := 84;
255 -------------------------
256 -- Priority Scheduling --
257 -------------------------
259 SCHED_OTHER : constant := 0;
260 SCHED_FIFO : constant := 1;
261 SCHED_RR : constant := 2;
263 function To_Target_Priority
264 (Prio : System.Any_Priority) return Interfaces.C.int;
265 -- Maps System.Any_Priority to a POSIX priority
267 -------------
268 -- Process --
269 -------------
271 type pid_t is private;
273 function kill (pid : pid_t; sig : Signal) return int;
274 pragma Import (C, kill, "kill");
276 function getpid return pid_t;
277 pragma Import (C, getpid, "getpid");
279 PR_SET_NAME : constant := 15;
280 PR_GET_NAME : constant := 16;
282 function prctl
283 (option : int;
284 arg : unsigned_long) return int;
285 pragma Import (C_Variadic_1, prctl, "prctl");
287 -------------
288 -- Threads --
289 -------------
291 type Thread_Body is access
292 function (arg : System.Address) return System.Address;
293 pragma Convention (C, Thread_Body);
295 function Thread_Body_Access is new
296 Ada.Unchecked_Conversion (System.Address, Thread_Body);
298 type pthread_t is new unsigned_long;
299 subtype Thread_Id is pthread_t;
301 function To_pthread_t is
302 new Ada.Unchecked_Conversion (unsigned_long, pthread_t);
304 type pthread_mutex_t is limited private;
305 type pthread_rwlock_t is limited private;
306 type pthread_cond_t is limited private;
307 type pthread_attr_t is limited private;
308 type pthread_mutexattr_t is limited private;
309 type pthread_rwlockattr_t is limited private;
310 type pthread_condattr_t is limited private;
311 type pthread_key_t is private;
313 PTHREAD_CREATE_DETACHED : constant := 1;
315 -----------
316 -- Stack --
317 -----------
319 subtype char_array is Interfaces.C.char_array;
321 type stack_t is record
322 ss_sp : System.Address;
323 ss_flags : int;
324 ss_size : size_t;
325 end record;
326 pragma Convention (C, stack_t);
328 function sigaltstack
329 (ss : not null access stack_t;
330 oss : access stack_t) return int;
331 pragma Import (C, sigaltstack, "sigaltstack");
333 Alternate_Stack_Size : constant := 32 * 1024;
334 -- This must be in keeping with init.c:__gnat_alternate_stack
336 Alternate_Stack : aliased char_array (1 .. Alternate_Stack_Size);
337 pragma Import (C, Alternate_Stack, "__gnat_alternate_stack");
338 -- The alternate signal stack for stack overflows
340 function Get_Stack_Base (thread : pthread_t) return Address;
341 pragma Inline (Get_Stack_Base);
342 -- This is a dummy procedure to share some GNULLI files
344 ---------------------------------------
345 -- Nonstandard Thread Initialization --
346 ---------------------------------------
348 procedure pthread_init;
349 pragma Inline (pthread_init);
350 -- This is a dummy procedure to share some GNULLI files
352 -------------------------
353 -- POSIX.1c Section 3 --
354 -------------------------
356 function sigwait (set : access sigset_t; sig : access Signal) return int;
357 pragma Import (C, sigwait, "sigwait");
359 function pthread_kill (thread : pthread_t; sig : Signal) return int;
360 pragma Import (C, pthread_kill, "pthread_kill");
362 function pthread_sigmask
363 (how : int;
364 set : access sigset_t;
365 oset : access sigset_t) return int;
366 pragma Import (C, pthread_sigmask, "pthread_sigmask");
368 --------------------------
369 -- POSIX.1c Section 11 --
370 --------------------------
372 function pthread_mutexattr_init
373 (attr : access pthread_mutexattr_t) return int;
374 pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init");
376 function pthread_mutexattr_destroy
377 (attr : access pthread_mutexattr_t) return int;
378 pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy");
380 function pthread_mutex_init
381 (mutex : access pthread_mutex_t;
382 attr : access pthread_mutexattr_t) return int;
383 pragma Import (C, pthread_mutex_init, "pthread_mutex_init");
385 function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int;
386 pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy");
388 function pthread_mutex_lock (mutex : access pthread_mutex_t) return int;
389 pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock");
391 function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int;
392 pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock");
394 function pthread_rwlockattr_init
395 (attr : access pthread_rwlockattr_t) return int;
396 pragma Import (C, pthread_rwlockattr_init, "pthread_rwlockattr_init");
398 function pthread_rwlockattr_destroy
399 (attr : access pthread_rwlockattr_t) return int;
400 pragma Import (C, pthread_rwlockattr_destroy, "pthread_rwlockattr_destroy");
402 PTHREAD_RWLOCK_PREFER_READER_NP : constant := 0;
403 PTHREAD_RWLOCK_PREFER_WRITER_NP : constant := 1;
404 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP : constant := 2;
406 function pthread_rwlockattr_setkind_np
407 (attr : access pthread_rwlockattr_t;
408 pref : int) return int;
409 pragma Import
410 (C, pthread_rwlockattr_setkind_np, "pthread_rwlockattr_setkind_np");
412 function pthread_rwlock_init
413 (mutex : access pthread_rwlock_t;
414 attr : access pthread_rwlockattr_t) return int;
415 pragma Import (C, pthread_rwlock_init, "pthread_rwlock_init");
417 function pthread_rwlock_destroy
418 (mutex : access pthread_rwlock_t) return int;
419 pragma Import (C, pthread_rwlock_destroy, "pthread_rwlock_destroy");
421 function pthread_rwlock_rdlock (mutex : access pthread_rwlock_t) return int;
422 pragma Import (C, pthread_rwlock_rdlock, "pthread_rwlock_rdlock");
424 function pthread_rwlock_wrlock (mutex : access pthread_rwlock_t) return int;
425 pragma Import (C, pthread_rwlock_wrlock, "pthread_rwlock_wrlock");
427 function pthread_rwlock_unlock (mutex : access pthread_rwlock_t) return int;
428 pragma Import (C, pthread_rwlock_unlock, "pthread_rwlock_unlock");
430 function pthread_condattr_init
431 (attr : access pthread_condattr_t) return int;
432 pragma Import (C, pthread_condattr_init, "pthread_condattr_init");
434 function pthread_condattr_destroy
435 (attr : access pthread_condattr_t) return int;
436 pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy");
438 function pthread_cond_init
439 (cond : access pthread_cond_t;
440 attr : access pthread_condattr_t) return int;
441 pragma Import (C, pthread_cond_init, "pthread_cond_init");
443 function pthread_cond_destroy (cond : access pthread_cond_t) return int;
444 pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy");
446 function pthread_cond_signal (cond : access pthread_cond_t) return int;
447 pragma Import (C, pthread_cond_signal, "pthread_cond_signal");
449 function pthread_cond_wait
450 (cond : access pthread_cond_t;
451 mutex : access pthread_mutex_t) return int;
452 pragma Import (C, pthread_cond_wait, "pthread_cond_wait");
454 function pthread_cond_timedwait
455 (cond : access pthread_cond_t;
456 mutex : access pthread_mutex_t;
457 abstime : access timespec) return int;
458 pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait");
460 --------------------------
461 -- POSIX.1c Section 13 --
462 --------------------------
464 PTHREAD_PRIO_NONE : constant := 0;
465 PTHREAD_PRIO_INHERIT : constant := 1;
466 PTHREAD_PRIO_PROTECT : constant := 2;
468 function pthread_mutexattr_setprotocol
469 (attr : access pthread_mutexattr_t;
470 protocol : int) return int;
471 pragma Import (C, pthread_mutexattr_setprotocol);
473 function pthread_mutexattr_setprioceiling
474 (attr : access pthread_mutexattr_t;
475 prioceiling : int) return int;
476 pragma Import (C, pthread_mutexattr_setprioceiling);
478 type struct_sched_param is record
479 sched_priority : int; -- scheduling priority
480 end record;
481 pragma Convention (C, struct_sched_param);
483 function pthread_setschedparam
484 (thread : pthread_t;
485 policy : int;
486 param : access struct_sched_param) return int;
487 pragma Import (C, pthread_setschedparam, "pthread_setschedparam");
489 function pthread_attr_setschedpolicy
490 (attr : access pthread_attr_t;
491 policy : int) return int;
492 pragma Import
493 (C, pthread_attr_setschedpolicy, "pthread_attr_setschedpolicy");
495 function sched_yield return int;
496 pragma Import (C, sched_yield, "sched_yield");
498 ---------------------------
499 -- P1003.1c - Section 16 --
500 ---------------------------
502 function pthread_attr_init
503 (attributes : access pthread_attr_t) return int;
504 pragma Import (C, pthread_attr_init, "pthread_attr_init");
506 function pthread_attr_destroy
507 (attributes : access pthread_attr_t) return int;
508 pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy");
510 function pthread_attr_setdetachstate
511 (attr : access pthread_attr_t;
512 detachstate : int) return int;
513 pragma Import
514 (C, pthread_attr_setdetachstate, "pthread_attr_setdetachstate");
516 function pthread_attr_setstacksize
517 (attr : access pthread_attr_t;
518 stacksize : size_t) return int;
519 pragma Import (C, pthread_attr_setstacksize, "pthread_attr_setstacksize");
521 function pthread_create
522 (thread : access pthread_t;
523 attributes : access pthread_attr_t;
524 start_routine : Thread_Body;
525 arg : System.Address) return int;
526 pragma Import (C, pthread_create, "pthread_create");
528 procedure pthread_exit (status : System.Address);
529 pragma Import (C, pthread_exit, "pthread_exit");
531 function pthread_self return pthread_t;
532 pragma Import (C, pthread_self, "pthread_self");
534 function lwp_self return System.Address;
535 pragma Import (C, lwp_self, "__gnat_lwp_self");
537 --------------------------
538 -- POSIX.1c Section 17 --
539 --------------------------
541 function pthread_setspecific
542 (key : pthread_key_t;
543 value : System.Address) return int;
544 pragma Import (C, pthread_setspecific, "pthread_setspecific");
546 function pthread_getspecific (key : pthread_key_t) return System.Address;
547 pragma Import (C, pthread_getspecific, "pthread_getspecific");
549 type destructor_pointer is access procedure (arg : System.Address);
550 pragma Convention (C, destructor_pointer);
552 function pthread_key_create
553 (key : access pthread_key_t;
554 destructor : destructor_pointer) return int;
555 pragma Import (C, pthread_key_create, "pthread_key_create");
557 ----------------
558 -- Extensions --
559 ----------------
561 CPU_SETSIZE : constant := 1_024;
562 -- Size of the cpu_set_t mask on most linux systems (SUSE 11 uses 4_096).
563 -- This is kept for backward compatibility (System.Task_Info uses it), but
564 -- the run-time library does no longer rely on static masks, using
565 -- dynamically allocated masks instead.
567 type bit_field is array (1 .. CPU_SETSIZE) of Boolean;
568 for bit_field'Size use CPU_SETSIZE;
569 pragma Pack (bit_field);
570 pragma Convention (C, bit_field);
572 type cpu_set_t is record
573 bits : bit_field;
574 end record;
575 pragma Convention (C, cpu_set_t);
577 type cpu_set_t_ptr is access all cpu_set_t;
578 -- In the run-time library we use this pointer because the size of type
579 -- cpu_set_t varies depending on the glibc version. Hence, objects of type
580 -- cpu_set_t are allocated dynamically using the number of processors
581 -- available in the target machine (value obtained at execution time).
583 function CPU_ALLOC (count : size_t) return cpu_set_t_ptr;
584 pragma Import (C, CPU_ALLOC, "__gnat_cpu_alloc");
585 -- Wrapper around the CPU_ALLOC C macro
587 function CPU_ALLOC_SIZE (count : size_t) return size_t;
588 pragma Import (C, CPU_ALLOC_SIZE, "__gnat_cpu_alloc_size");
589 -- Wrapper around the CPU_ALLOC_SIZE C macro
591 procedure CPU_FREE (cpuset : cpu_set_t_ptr);
592 pragma Import (C, CPU_FREE, "__gnat_cpu_free");
593 -- Wrapper around the CPU_FREE C macro
595 procedure CPU_ZERO (count : size_t; cpuset : cpu_set_t_ptr);
596 pragma Import (C, CPU_ZERO, "__gnat_cpu_zero");
597 -- Wrapper around the CPU_ZERO_S C macro
599 procedure CPU_SET (cpu : int; count : size_t; cpuset : cpu_set_t_ptr);
600 pragma Import (C, CPU_SET, "__gnat_cpu_set");
601 -- Wrapper around the CPU_SET_S C macro
603 function pthread_setaffinity_np
604 (thread : pthread_t;
605 cpusetsize : size_t;
606 cpuset : cpu_set_t_ptr) return int;
607 pragma Import (C, pthread_setaffinity_np, "pthread_setaffinity_np");
608 pragma Weak_External (pthread_setaffinity_np);
609 -- Use a weak symbol because this function may be available or not,
610 -- depending on the version of the system.
612 function pthread_attr_setaffinity_np
613 (attr : access pthread_attr_t;
614 cpusetsize : size_t;
615 cpuset : cpu_set_t_ptr) return int;
616 pragma Import (C, pthread_attr_setaffinity_np,
617 "pthread_attr_setaffinity_np");
618 pragma Weak_External (pthread_attr_setaffinity_np);
619 -- Use a weak symbol because this function may be available or not,
620 -- depending on the version of the system.
622 private
624 type sigset_t is
625 array (0 .. OS_Constants.SIZEOF_sigset - 1) of unsigned_char;
626 pragma Convention (C, sigset_t);
627 for sigset_t'Alignment use Interfaces.C.unsigned_long'Alignment;
629 pragma Warnings (Off);
630 for struct_sigaction use record
631 sa_handler at Linux.sa_handler_pos range 0 .. Standard'Address_Size - 1;
632 sa_mask at Linux.sa_mask_pos range 0 .. 1023;
633 sa_flags at Linux.sa_flags_pos range 0 .. int'Size - 1;
634 end record;
635 -- We intentionally leave sa_restorer unspecified and let the compiler
636 -- append it after the last field, so disable corresponding warning.
637 pragma Warnings (On);
639 type pid_t is new int;
641 type pthread_attr_t is record
642 Data : char_array (1 .. OS_Constants.PTHREAD_ATTR_SIZE);
643 end record;
644 pragma Convention (C, pthread_attr_t);
645 for pthread_attr_t'Alignment use Interfaces.C.unsigned_long'Alignment;
647 type pthread_condattr_t is record
648 Data : char_array (1 .. OS_Constants.PTHREAD_CONDATTR_SIZE);
649 end record;
650 pragma Convention (C, pthread_condattr_t);
651 for pthread_condattr_t'Alignment use Interfaces.C.int'Alignment;
653 type pthread_mutexattr_t is record
654 Data : char_array (1 .. OS_Constants.PTHREAD_MUTEXATTR_SIZE);
655 end record;
656 pragma Convention (C, pthread_mutexattr_t);
657 for pthread_mutexattr_t'Alignment use Interfaces.C.int'Alignment;
659 type pthread_mutex_t is record
660 Data : char_array (1 .. OS_Constants.PTHREAD_MUTEX_SIZE);
661 end record;
662 pragma Convention (C, pthread_mutex_t);
663 for pthread_mutex_t'Alignment use Interfaces.C.unsigned_long'Alignment;
665 type pthread_rwlockattr_t is record
666 Data : char_array (1 .. OS_Constants.PTHREAD_RWLOCKATTR_SIZE);
667 end record;
668 pragma Convention (C, pthread_rwlockattr_t);
669 for pthread_rwlockattr_t'Alignment use Interfaces.C.unsigned_long'Alignment;
671 type pthread_rwlock_t is record
672 Data : char_array (1 .. OS_Constants.PTHREAD_RWLOCK_SIZE);
673 end record;
674 pragma Convention (C, pthread_rwlock_t);
675 for pthread_rwlock_t'Alignment use Interfaces.C.unsigned_long'Alignment;
677 type pthread_cond_t is record
678 Data : char_array (1 .. OS_Constants.PTHREAD_COND_SIZE);
679 end record;
680 pragma Convention (C, pthread_cond_t);
681 for pthread_cond_t'Alignment use Interfaces.Unsigned_64'Alignment;
683 type pthread_key_t is new unsigned;
685 end System.OS_Interface;