ira.c tidies: validate_equiv_mem_from_store
[official-gcc.git] / gcc / ada / s-osinte-gnu.ads
blob6cac9b9b88005ac29a173eb1960ec6d959337b06
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNU ADA 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-2016, 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 the GNU/Hurd (POSIX Threads) version of this package
35 -- This package encapsulates all direct interfaces to OS services
36 -- that are needed by children of System.
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 Interfaces.C;
42 with Unchecked_Conversion;
44 package System.OS_Interface is
45 pragma Preelaborate;
47 pragma Linker_Options ("-lpthread");
48 pragma Linker_Options ("-lrt");
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;
61 -----------
62 -- Errno --
63 -----------
64 -- From /usr/include/i386-gnu/bits/errno.h
66 function errno return int;
67 pragma Import (C, errno, "__get_errno");
69 EAGAIN : constant := 1073741859;
70 EINTR : constant := 1073741828;
71 EINVAL : constant := 1073741846;
72 ENOMEM : constant := 1073741836;
73 EPERM : constant := 1073741825;
74 ETIMEDOUT : constant := 1073741884;
76 -------------
77 -- Signals --
78 -------------
79 -- From /usr/include/i386-gnu/bits/signum.h
81 Max_Interrupt : constant := 32;
82 type Signal is new int range 0 .. Max_Interrupt;
83 for Signal'Size use int'Size;
85 SIGHUP : constant := 1; -- hangup
86 SIGINT : constant := 2; -- interrupt (rubout)
87 SIGQUIT : constant := 3; -- quit (ASCD FS)
88 SIGILL : constant := 4; -- illegal instruction (not reset)
89 SIGTRAP : constant := 5; -- trace trap (not reset)
90 SIGIOT : constant := 6; -- IOT instruction
91 SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future
92 SIGEMT : constant := 7; -- EMT instruction
93 SIGFPE : constant := 8; -- floating point exception
94 SIGKILL : constant := 9; -- kill (cannot be caught or ignored)
95 SIGBUS : constant := 10; -- bus error
96 SIGSEGV : constant := 11; -- segmentation violation
97 SIGSYS : constant := 12; -- bad argument to system call
98 SIGPIPE : constant := 13; -- write on a pipe with no one to read it
99 SIGALRM : constant := 14; -- alarm clock
100 SIGTERM : constant := 15; -- software termination signal from kill
101 SIGURG : constant := 16; -- urgent condition on IO channel
102 SIGSTOP : constant := 17; -- stop (cannot be caught or ignored)
103 SIGTSTP : constant := 18; -- user stop requested from tty
104 SIGCONT : constant := 19; -- stopped process has been continued
105 SIGCLD : constant := 20; -- alias for SIGCHLD
106 SIGCHLD : constant := 20; -- child status change
107 SIGTTIN : constant := 21; -- background tty read attempted
108 SIGTTOU : constant := 22; -- background tty write attempted
109 SIGIO : constant := 23; -- I/O possible (Solaris SIGPOLL alias)
110 SIGPOLL : constant := 23; -- I/O possible (same as SIGIO?)
111 SIGXCPU : constant := 24; -- CPU time limit exceeded
112 SIGXFSZ : constant := 25; -- filesize limit exceeded
113 SIGVTALRM : constant := 26; -- virtual timer expired
114 SIGPROF : constant := 27; -- profiling timer expired
115 SIGWINCH : constant := 28; -- window size change
116 SIGINFO : constant := 29; -- information request (NetBSD/FreeBSD)
117 SIGUSR1 : constant := 30; -- user defined signal 1
118 SIGUSR2 : constant := 31; -- user defined signal 2
119 SIGLOST : constant := 32; -- Resource lost (Sun); server died (GNU)
121 SIGADAABORT : constant := SIGABRT;
122 -- Change this if you want to use another signal for task abort.
123 -- SIGTERM might be a good one.
125 type Signal_Set is array (Natural range <>) of Signal;
127 Unmasked : constant Signal_Set := (
128 SIGTRAP,
129 -- To enable debugging on multithreaded applications, mark SIGTRAP to
130 -- be kept unmasked.
132 SIGBUS,
134 SIGTTIN, SIGTTOU, SIGTSTP,
135 -- Keep these three signals unmasked so that background processes
136 -- and IO behaves as normal "C" applications
138 SIGPROF,
139 -- To avoid confusing the profiler
141 SIGKILL, SIGSTOP);
142 -- These two signals actually cannot be masked;
143 -- POSIX simply won't allow it.
145 Reserved : constant Signal_Set :=
146 -- I am not sure why the following signal is reserved.
147 -- I guess they are not supported by this version of GNU/Hurd.
148 (0 .. 0 => SIGVTALRM);
150 type sigset_t is private;
152 -- From /usr/include/signal.h /usr/include/i386-gnu/bits/sigset.h
153 function sigaddset (set : access sigset_t; sig : Signal) return int;
154 pragma Import (C, sigaddset, "sigaddset");
156 function sigdelset (set : access sigset_t; sig : Signal) return int;
157 pragma Import (C, sigdelset, "sigdelset");
159 function sigfillset (set : access sigset_t) return int;
160 pragma Import (C, sigfillset, "sigfillset");
162 function sigismember (set : access sigset_t; sig : Signal) return int;
163 pragma Import (C, sigismember, "sigismember");
165 function sigemptyset (set : access sigset_t) return int;
166 pragma Import (C, sigemptyset, "sigemptyset");
168 -- sigcontext is architecture dependent, so define it private
169 type struct_sigcontext is private;
171 -- From /usr/include/i386-gnu/bits/sigaction.h: Note: arg. order differs
172 type struct_sigaction is record
173 sa_handler : System.Address;
174 sa_mask : sigset_t;
175 sa_flags : int;
176 end record;
177 pragma Convention (C, struct_sigaction);
179 type struct_sigaction_ptr is access all struct_sigaction;
181 -- From /usr/include/i386-gnu/bits/sigaction.h
182 SIG_BLOCK : constant := 1;
183 SIG_UNBLOCK : constant := 2;
184 SIG_SETMASK : constant := 3;
186 -- From /usr/include/i386-gnu/bits/signum.h
187 SIG_ERR : constant := 1;
188 SIG_DFL : constant := 0;
189 SIG_IGN : constant := 1;
190 SIG_HOLD : constant := 2;
192 -- From /usr/include/i386-gnu/bits/sigaction.h
193 SA_SIGINFO : constant := 16#0040#;
194 SA_ONSTACK : constant := 16#0001#;
196 function sigaction
197 (sig : Signal;
198 act : struct_sigaction_ptr;
199 oact : struct_sigaction_ptr) return int;
200 pragma Import (C, sigaction, "sigaction");
202 ----------
203 -- Time --
204 ----------
206 Time_Slice_Supported : constant Boolean := True;
207 -- Indicates whether time slicing is supported (i.e SCHED_RR is supported)
209 type timespec is private;
211 function nanosleep (rqtp, rmtp : access timespec) return int;
212 pragma Import (C, nanosleep, "nanosleep");
214 type clockid_t is new int;
215 CLOCK_REALTIME : constant clockid_t := 0;
217 -- From: /usr/include/time.h
218 function clock_gettime
219 (clock_id : clockid_t;
220 tp : access timespec)
221 return int;
222 pragma Import (C, clock_gettime, "clock_gettime");
224 function clock_getres
225 (clock_id : clockid_t;
226 res : access timespec) return int;
227 pragma Import (C, clock_getres, "clock_getres");
229 function To_Duration (TS : timespec) return Duration;
230 pragma Inline (To_Duration);
232 function To_Timespec (D : Duration) return timespec;
233 pragma Inline (To_Timespec);
235 -- From: /usr/include/unistd.h
236 function sysconf (name : int) return long;
237 pragma Import (C, sysconf);
239 -- From /usr/include/i386-gnu/bits/confname.h
240 SC_CLK_TCK : constant := 2;
241 SC_NPROCESSORS_ONLN : constant := 84;
243 -------------------------
244 -- Priority Scheduling --
245 -------------------------
246 -- From /usr/include/i386-gnu/bits/sched.h
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.
256 -------------
257 -- Process --
258 -------------
260 type pid_t is private;
262 -- From: /usr/include/signal.h
263 function kill (pid : pid_t; sig : Signal) return int;
264 pragma Import (C, kill, "kill");
266 -- From: /usr/include/unistd.h
267 function getpid return pid_t;
268 pragma Import (C, getpid, "getpid");
270 ---------
271 -- LWP --
272 ---------
274 -- From: /usr/include/pthread/pthread.h
275 function lwp_self return System.Address;
276 -- lwp_self does not exist on this thread library, revert to pthread_self
277 -- which is the closest approximation (with getpid). This function is
278 -- needed to share 7staprop.adb across POSIX-like targets.
279 pragma Import (C, lwp_self, "pthread_self");
281 -------------
282 -- Threads --
283 -------------
285 type Thread_Body is access
286 function (arg : System.Address) return System.Address;
287 pragma Convention (C, Thread_Body);
289 function Thread_Body_Access is new
290 Unchecked_Conversion (System.Address, Thread_Body);
292 -- From: /usr/include/bits/pthread.h:typedef int __pthread_t;
293 -- /usr/include/pthread/pthreadtypes.h:typedef __pthread_t pthread_t;
294 type pthread_t is new unsigned_long;
295 subtype Thread_Id is pthread_t;
297 function To_pthread_t is new Unchecked_Conversion
298 (unsigned_long, pthread_t);
300 type pthread_mutex_t is limited private;
301 type pthread_rwlock_t is limited private;
302 type pthread_cond_t is limited private;
303 type pthread_attr_t is limited private;
304 type pthread_mutexattr_t is limited private;
305 type pthread_rwlockattr_t is limited private;
306 type pthread_condattr_t is limited private;
307 type pthread_key_t is private;
309 -- From /usr/include/pthread/pthreadtypes.h
310 PTHREAD_CREATE_DETACHED : constant := 1;
311 PTHREAD_CREATE_JOINABLE : constant := 0;
313 PTHREAD_SCOPE_PROCESS : constant := 1;
314 PTHREAD_SCOPE_SYSTEM : constant := 0;
316 -----------
317 -- Stack --
318 -----------
320 -- From: /usr/include/i386-gnu/bits/sigstack.h
321 type stack_t is record
322 ss_sp : System.Address;
323 ss_size : size_t;
324 ss_flags : int;
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 : aliased System.Address;
334 -- This is a dummy definition, never used (Alternate_Stack_Size is null)
336 Alternate_Stack_Size : constant := 0;
337 -- No alternate signal stack is used on this platform
339 Stack_Base_Available : constant Boolean := False;
340 -- Indicates whether the stack base is available on this target
342 function Get_Stack_Base (thread : pthread_t) return Address;
343 pragma Inline (Get_Stack_Base);
344 -- returns the stack base of the specified thread. Only call this function
345 -- when Stack_Base_Available is True.
347 -- From: /usr/include/i386-gnu/bits/shm.h __getpagesize or getpagesize??
348 function Get_Page_Size return size_t;
349 function Get_Page_Size return Address;
350 pragma Import (C, Get_Page_Size, "__getpagesize");
351 -- Returns the size of a page
353 -- From /usr/include/i386-gnu/bits/mman.h
354 PROT_NONE : constant := 0;
355 PROT_READ : constant := 4;
356 PROT_WRITE : constant := 2;
357 PROT_EXEC : constant := 1;
358 PROT_ALL : constant := PROT_READ + PROT_WRITE + PROT_EXEC;
359 PROT_ON : constant := PROT_NONE;
360 PROT_OFF : constant := PROT_ALL;
362 -- From /usr/include/i386-gnu/bits/mman.h
363 function mprotect (addr : Address; len : size_t; prot : int) return int;
364 pragma Import (C, mprotect);
366 ---------------------------------------
367 -- Nonstandard Thread Initialization --
368 ---------------------------------------
370 procedure pthread_init;
371 pragma Inline (pthread_init);
372 -- This is a dummy procedure to share some GNULLI files
374 -------------------------
375 -- POSIX.1c Section 3 --
376 -------------------------
378 -- From: /usr/include/signal.h:
379 -- sigwait (__const sigset_t *__restrict __set, int *__restrict __sig)
380 function sigwait (set : access sigset_t; sig : access Signal) return int;
381 pragma Import (C, sigwait, "sigwait");
383 -- From: /usr/include/pthread/pthread.h:
384 -- extern int pthread_kill (pthread_t thread, int signo);
385 function pthread_kill (thread : pthread_t; sig : Signal) return int;
386 pragma Import (C, pthread_kill, "pthread_kill");
388 -- From: /usr/include/i386-gnu/bits/sigthread.h
389 -- extern int pthread_sigmask (int __how, __const __sigset_t *__newmask,
390 -- __sigset_t *__oldmask) __THROW;
391 function pthread_sigmask
392 (how : int;
393 set : access sigset_t;
394 oset : access sigset_t) return int;
395 pragma Import (C, pthread_sigmask, "pthread_sigmask");
397 --------------------------
398 -- POSIX.1c Section 11 --
399 --------------------------
401 -- From: /usr/include/pthread/pthread.h and
402 -- /usr/include/pthread/pthreadtypes.h
403 function pthread_mutexattr_init
404 (attr : access pthread_mutexattr_t) return int;
405 pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init");
407 function pthread_mutexattr_destroy
408 (attr : access pthread_mutexattr_t) return int;
409 pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy");
411 function pthread_mutex_init
412 (mutex : access pthread_mutex_t;
413 attr : access pthread_mutexattr_t) return int;
414 pragma Import (C, pthread_mutex_init, "pthread_mutex_init");
416 function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int;
417 pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy");
419 function pthread_mutex_lock (mutex : access pthread_mutex_t) return int;
420 pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock");
422 function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int;
423 pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock");
425 function pthread_rwlockattr_init
426 (attr : access pthread_rwlockattr_t) return int;
427 pragma Import (C, pthread_rwlockattr_init, "pthread_rwlockattr_init");
429 function pthread_rwlockattr_destroy
430 (attr : access pthread_rwlockattr_t) return int;
431 pragma Import (C, pthread_rwlockattr_destroy, "pthread_rwlockattr_destroy");
432 PTHREAD_RWLOCK_PREFER_READER_NP : constant := 0;
433 PTHREAD_RWLOCK_PREFER_WRITER_NP : constant := 1;
434 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP : constant := 2;
436 function pthread_rwlockattr_setkind_np
437 (attr : access pthread_rwlockattr_t;
438 pref : int) return int;
439 pragma Import
440 (C, pthread_rwlockattr_setkind_np, "pthread_rwlockattr_setkind_np");
442 function pthread_rwlock_init
443 (mutex : access pthread_rwlock_t;
444 attr : access pthread_rwlockattr_t) return int;
445 pragma Import (C, pthread_rwlock_init, "pthread_rwlock_init");
447 function pthread_rwlock_destroy
448 (mutex : access pthread_rwlock_t) return int;
449 pragma Import (C, pthread_rwlock_destroy, "pthread_rwlock_destroy");
451 function pthread_rwlock_rdlock (mutex : access pthread_rwlock_t) return int;
452 pragma Import (C, pthread_rwlock_rdlock, "pthread_rwlock_rdlock");
454 function pthread_rwlock_wrlock (mutex : access pthread_rwlock_t) return int;
455 pragma Import (C, pthread_rwlock_wrlock, "pthread_rwlock_wrlock");
457 function pthread_rwlock_unlock (mutex : access pthread_rwlock_t) return int;
458 pragma Import (C, pthread_rwlock_unlock, "pthread_rwlock_unlock");
460 function pthread_condattr_init
461 (attr : access pthread_condattr_t) return int;
462 pragma Import (C, pthread_condattr_init, "pthread_condattr_init");
464 function pthread_condattr_destroy
465 (attr : access pthread_condattr_t) return int;
466 pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy");
468 function pthread_cond_init
469 (cond : access pthread_cond_t;
470 attr : access pthread_condattr_t) return int;
471 pragma Import (C, pthread_cond_init, "pthread_cond_init");
473 function pthread_cond_destroy (cond : access pthread_cond_t) return int;
474 pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy");
476 function pthread_cond_signal (cond : access pthread_cond_t) return int;
477 pragma Import (C, pthread_cond_signal, "pthread_cond_signal");
479 function pthread_cond_wait
480 (cond : access pthread_cond_t;
481 mutex : access pthread_mutex_t) return int;
482 pragma Import (C, pthread_cond_wait, "pthread_cond_wait");
484 function pthread_cond_timedwait
485 (cond : access pthread_cond_t;
486 mutex : access pthread_mutex_t;
487 abstime : access timespec) return int;
488 pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait");
490 Relative_Timed_Wait : constant Boolean := False;
491 -- pthread_cond_timedwait requires an absolute delay time
493 --------------------------
494 -- POSIX.1c Section 13 --
495 --------------------------
496 -- From /usr/include/pthread/pthreadtypes.h
498 PTHREAD_PRIO_NONE : constant := 0;
499 PTHREAD_PRIO_PROTECT : constant := 2;
500 PTHREAD_PRIO_INHERIT : constant := 1;
502 -- GNU/Hurd does not support Thread Priority Protection or Thread
503 -- Priority Inheritance and lacks some pthread_mutexattr_* functions.
504 -- Replace them with dummy versions.
505 -- From: /usr/include/pthread/pthread.h
507 function pthread_mutexattr_setprotocol
508 (attr : access pthread_mutexattr_t;
509 protocol : int) return int;
510 pragma Import (C, pthread_mutexattr_setprotocol,
511 "pthread_mutexattr_setprotocol");
513 function pthread_mutexattr_getprotocol
514 (attr : access pthread_mutexattr_t;
515 protocol : access int) return int;
516 pragma Import (C, pthread_mutexattr_getprotocol,
517 "pthread_mutexattr_getprotocol");
519 function pthread_mutexattr_setprioceiling
520 (attr : access pthread_mutexattr_t;
521 prioceiling : int) return int;
523 function pthread_mutexattr_getprioceiling
524 (attr : access pthread_mutexattr_t;
525 prioceiling : access int) return int;
527 type struct_sched_param is record
528 sched_priority : int; -- scheduling priority
529 end record;
530 pragma Convention (C, struct_sched_param);
532 function pthread_setschedparam
533 (thread : pthread_t;
534 policy : int;
535 param : access struct_sched_param) return int;
537 function pthread_attr_setscope
538 (attr : access pthread_attr_t;
539 contentionscope : int) return int;
540 pragma Import (C, pthread_attr_setscope, "pthread_attr_setscope");
542 function pthread_attr_getscope
543 (attr : access pthread_attr_t;
544 contentionscope : access int) return int;
545 pragma Import (C, pthread_attr_getscope, "pthread_attr_getscope");
547 function pthread_attr_setinheritsched
548 (attr : access pthread_attr_t;
549 inheritsched : int) return int;
550 pragma Import (C, pthread_attr_setinheritsched,
551 "pthread_attr_setinheritsched");
553 function pthread_attr_getinheritsched
554 (attr : access pthread_attr_t;
555 inheritsched : access int) return int;
556 pragma Import (C, pthread_attr_getinheritsched,
557 "pthread_attr_getinheritsched");
559 function pthread_attr_setschedpolicy
560 (attr : access pthread_attr_t;
561 policy : int) return int;
562 pragma Import (C, pthread_attr_setschedpolicy, "pthread_setschedpolicy");
564 function sched_yield return int;
565 pragma Import (C, sched_yield, "sched_yield");
567 ---------------------------
568 -- P1003.1c - Section 16 --
569 ---------------------------
571 function pthread_attr_init
572 (attributes : access pthread_attr_t) return int;
573 pragma Import (C, pthread_attr_init, "pthread_attr_init");
575 function pthread_attr_destroy
576 (attributes : access pthread_attr_t) return int;
577 pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy");
579 function pthread_attr_setdetachstate
580 (attr : access pthread_attr_t;
581 detachstate : int) return int;
582 pragma Import
583 (C, pthread_attr_setdetachstate, "pthread_attr_setdetachstate");
585 function pthread_attr_setstacksize
586 (attr : access pthread_attr_t;
587 stacksize : size_t) return int;
588 pragma Import (C, pthread_attr_setstacksize, "pthread_attr_setstacksize");
590 -- From: /usr/include/pthread/pthread.h
591 function pthread_create
592 (thread : access pthread_t;
593 attributes : access pthread_attr_t;
594 start_routine : Thread_Body;
595 arg : System.Address) return int;
596 pragma Import (C, pthread_create, "pthread_create");
598 procedure pthread_exit (status : System.Address);
599 pragma Import (C, pthread_exit, "pthread_exit");
601 function pthread_self return pthread_t;
602 pragma Import (C, pthread_self, "pthread_self");
604 --------------------------
605 -- POSIX.1c Section 17 --
606 --------------------------
608 function pthread_setspecific
609 (key : pthread_key_t;
610 value : System.Address) return int;
611 pragma Import (C, pthread_setspecific, "pthread_setspecific");
613 function pthread_getspecific (key : pthread_key_t) return System.Address;
614 pragma Import (C, pthread_getspecific, "pthread_getspecific");
616 type destructor_pointer is access procedure (arg : System.Address);
617 pragma Convention (C, destructor_pointer);
619 function pthread_key_create
620 (key : access pthread_key_t;
621 destructor : destructor_pointer) return int;
622 pragma Import (C, pthread_key_create, "pthread_key_create");
624 -- From /usr/include/i386-gnu/bits/sched.h
625 CPU_SETSIZE : constant := 1_024;
627 type bit_field is array (1 .. CPU_SETSIZE) of Boolean;
628 for bit_field'Size use CPU_SETSIZE;
629 pragma Pack (bit_field);
630 pragma Convention (C, bit_field);
632 type cpu_set_t is record
633 bits : bit_field;
634 end record;
635 pragma Convention (C, cpu_set_t);
637 private
639 type sigset_t is array (1 .. 4) of unsigned;
641 -- In GNU/Hurd the component sa_handler turns out to
642 -- be one a union type, and the selector is a macro:
643 -- #define sa_handler __sigaction_handler.sa_handler
644 -- #define sa_sigaction __sigaction_handler.sa_sigaction
646 -- Should we add a signal_context type here ?
647 -- How could it be done independent of the CPU architecture ?
648 -- sigcontext type is opaque, so it is architecturally neutral.
649 -- It is always passed as an access type, so define it as an empty record
650 -- since the contents are not used anywhere.
651 type struct_sigcontext is null record;
652 pragma Convention (C, struct_sigcontext);
654 type pid_t is new int;
656 type time_t is new long;
658 type timespec is record
659 tv_sec : time_t;
660 tv_nsec : long;
661 end record;
662 pragma Convention (C, timespec);
664 -- From: /usr/include/pthread/pthreadtypes.h:
665 -- typedef struct __pthread_attr pthread_attr_t;
666 -- /usr/include/i386-gnu/bits/thread-attr.h: struct __pthread_attr...
667 -- /usr/include/pthread/pthreadtypes.h: enum __pthread_contentionscope
668 -- enum __pthread_detachstate detachstate;
669 -- enum __pthread_inheritsched inheritsched;
670 -- enum __pthread_contentionscope contentionscope;
671 -- Not used: schedpolicy : int;
672 type pthread_attr_t is record
673 schedparam : struct_sched_param;
674 stackaddr : System.Address;
675 stacksize : size_t;
676 guardsize : size_t;
677 detachstate : int;
678 inheritsched : int;
679 contentionscope : int;
680 schedpolicy : int;
681 end record;
682 pragma Convention (C, pthread_attr_t);
684 -- From: /usr/include/pthread/pthreadtypes.h:
685 -- typedef struct __pthread_condattr pthread_condattr_t;
686 -- From: /usr/include/i386-gnu/bits/condition-attr.h:
687 -- struct __pthread_condattr {
688 -- enum __pthread_process_shared pshared;
689 -- __Clockid_T Clock;}
690 -- From: /usr/include/pthread/pthreadtypes.h:
691 -- enum __pthread_process_shared
692 type pthread_condattr_t is record
693 pshared : int;
694 clock : clockid_t;
695 end record;
696 pragma Convention (C, pthread_condattr_t);
698 -- From: /usr/include/pthread/pthreadtypes.h:
699 -- typedef struct __pthread_mutexattr pthread_mutexattr_t; and
700 -- /usr/include/i386-gnu/bits/mutex-attr.h
701 -- struct __pthread_mutexattr {
702 -- int prioceiling;
703 -- enum __pthread_mutex_protocol protocol;
704 -- enum __pthread_process_shared pshared;
705 -- enum __pthread_mutex_type mutex_type;};
706 type pthread_mutexattr_t is record
707 prioceiling : int;
708 protocol : int;
709 pshared : int;
710 mutex_type : int;
711 end record;
712 pragma Convention (C, pthread_mutexattr_t);
714 -- From: /usr/include/pthread/pthreadtypes.h
715 -- typedef struct __pthread_mutex pthread_mutex_t; and
716 -- /usr/include/i386-gnu/bits/mutex.h:
717 -- struct __pthread_mutex {
718 -- __pthread_spinlock_t __held;
719 -- __pthread_spinlock_t __lock;
720 -- /* in cthreads, mutex_init does not initialized the third
721 -- pointer, as such, we cannot rely on its value for anything. */
722 -- char *cthreadscompat1;
723 -- struct __pthread *__queue;
724 -- struct __pthread_mutexattr *attr;
725 -- void *data;
726 -- /* up to this point, we are completely compatible with cthreads
727 -- and what libc expects. */
728 -- void *owner;
729 -- unsigned locks;
730 -- /* if null then the default attributes apply. */
731 -- };
733 type pthread_mutex_t is record
734 held : int;
735 lock : int;
736 cthreadcompat : System.Address;
737 queue : System.Address;
738 attr : System.Address;
739 data : System.Address;
740 owner : System.Address;
741 locks : unsigned;
742 end record;
743 pragma Convention (C, pthread_mutex_t);
744 -- pointer needed?
745 -- type pthread_mutex_t_ptr is access pthread_mutex_t;
747 -- From: /usr/include/pthread/pthreadtypes.h:
748 -- typedef struct __pthread_cond pthread_cond_t;
749 -- typedef struct __pthread_condattr pthread_condattr_t;
750 -- /usr/include/i386-gnu/bits/condition.h:struct __pthread_cond{}
751 -- pthread_condattr_t: see above!
752 -- /usr/include/i386-gnu/bits/condition.h:
753 -- struct __pthread_condimpl *__impl;
755 type pthread_cond_t is record
756 lock : int;
757 queue : System.Address;
758 condattr : System.Address;
759 impl : System.Address;
760 data : System.Address;
761 end record;
762 pragma Convention (C, pthread_cond_t);
764 -- From: /usr/include/pthread/pthreadtypes.h:
765 -- typedef __pthread_key pthread_key_t; and
766 -- /usr/include/i386-gnu/bits/thread-specific.h:
767 -- typedef int __pthread_key;
769 type pthread_key_t is new int;
771 -- From: /usr/include/i386-gnu/bits/rwlock-attr.h:
772 -- struct __pthread_rwlockattr {
773 -- enum __pthread_process_shared pshared; };
775 type pthread_rwlockattr_t is record
776 pshared : int;
777 end record;
778 pragma Convention (C, pthread_rwlockattr_t);
780 -- From: /usr/include/i386-gnu/bits/rwlock.h:
781 -- struct __pthread_rwlock {
782 -- __pthread_spinlock_t __held;
783 -- __pthread_spinlock_t __lock;
784 -- int readers;
785 -- struct __pthread *readerqueue;
786 -- struct __pthread *writerqueue;
787 -- struct __pthread_rwlockattr *__attr;
788 -- void *__data; };
790 type pthread_rwlock_t is record
791 held : int;
792 lock : int;
793 readers : int;
794 readerqueue : System.Address;
795 writerqueue : System.Address;
796 attr : pthread_rwlockattr_t;
797 data : int;
798 end record;
799 pragma Convention (C, pthread_rwlock_t);
801 end System.OS_Interface;