Improve max_insns_skipped logic
[official-gcc.git] / gcc / ada / s-osinte-gnu.ads
blob183c5b83f60e6f8f94abf630e1facbfe677bd4cf
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
348 function Get_Page_Size return int;
349 pragma Import (C, Get_Page_Size, "getpagesize");
350 -- Returns the size of a page
352 -- From /usr/include/i386-gnu/bits/mman.h
353 PROT_NONE : constant := 0;
354 PROT_READ : constant := 4;
355 PROT_WRITE : constant := 2;
356 PROT_EXEC : constant := 1;
357 PROT_ALL : constant := PROT_READ + PROT_WRITE + PROT_EXEC;
358 PROT_ON : constant := PROT_NONE;
359 PROT_OFF : constant := PROT_ALL;
361 -- From /usr/include/i386-gnu/bits/mman.h
362 function mprotect (addr : Address; len : size_t; prot : int) return int;
363 pragma Import (C, mprotect);
365 ---------------------------------------
366 -- Nonstandard Thread Initialization --
367 ---------------------------------------
369 procedure pthread_init;
370 pragma Inline (pthread_init);
371 -- This is a dummy procedure to share some GNULLI files
373 -------------------------
374 -- POSIX.1c Section 3 --
375 -------------------------
377 -- From: /usr/include/signal.h:
378 -- sigwait (__const sigset_t *__restrict __set, int *__restrict __sig)
379 function sigwait (set : access sigset_t; sig : access Signal) return int;
380 pragma Import (C, sigwait, "sigwait");
382 -- From: /usr/include/pthread/pthread.h:
383 -- extern int pthread_kill (pthread_t thread, int signo);
384 function pthread_kill (thread : pthread_t; sig : Signal) return int;
385 pragma Import (C, pthread_kill, "pthread_kill");
387 -- From: /usr/include/i386-gnu/bits/sigthread.h
388 -- extern int pthread_sigmask (int __how, __const __sigset_t *__newmask,
389 -- __sigset_t *__oldmask) __THROW;
390 function pthread_sigmask
391 (how : int;
392 set : access sigset_t;
393 oset : access sigset_t) return int;
394 pragma Import (C, pthread_sigmask, "pthread_sigmask");
396 --------------------------
397 -- POSIX.1c Section 11 --
398 --------------------------
400 -- From: /usr/include/pthread/pthread.h and
401 -- /usr/include/pthread/pthreadtypes.h
402 function pthread_mutexattr_init
403 (attr : access pthread_mutexattr_t) return int;
404 pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init");
406 function pthread_mutexattr_destroy
407 (attr : access pthread_mutexattr_t) return int;
408 pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy");
410 function pthread_mutex_init
411 (mutex : access pthread_mutex_t;
412 attr : access pthread_mutexattr_t) return int;
413 pragma Import (C, pthread_mutex_init, "pthread_mutex_init");
415 function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int;
416 pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy");
418 function pthread_mutex_lock (mutex : access pthread_mutex_t) return int;
419 pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock");
421 function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int;
422 pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock");
424 function pthread_rwlockattr_init
425 (attr : access pthread_rwlockattr_t) return int;
426 pragma Import (C, pthread_rwlockattr_init, "pthread_rwlockattr_init");
428 function pthread_rwlockattr_destroy
429 (attr : access pthread_rwlockattr_t) return int;
430 pragma Import (C, pthread_rwlockattr_destroy, "pthread_rwlockattr_destroy");
431 PTHREAD_RWLOCK_PREFER_READER_NP : constant := 0;
432 PTHREAD_RWLOCK_PREFER_WRITER_NP : constant := 1;
433 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP : constant := 2;
435 function pthread_rwlockattr_setkind_np
436 (attr : access pthread_rwlockattr_t;
437 pref : int) return int;
438 pragma Import
439 (C, pthread_rwlockattr_setkind_np, "pthread_rwlockattr_setkind_np");
441 function pthread_rwlock_init
442 (mutex : access pthread_rwlock_t;
443 attr : access pthread_rwlockattr_t) return int;
444 pragma Import (C, pthread_rwlock_init, "pthread_rwlock_init");
446 function pthread_rwlock_destroy
447 (mutex : access pthread_rwlock_t) return int;
448 pragma Import (C, pthread_rwlock_destroy, "pthread_rwlock_destroy");
450 function pthread_rwlock_rdlock (mutex : access pthread_rwlock_t) return int;
451 pragma Import (C, pthread_rwlock_rdlock, "pthread_rwlock_rdlock");
453 function pthread_rwlock_wrlock (mutex : access pthread_rwlock_t) return int;
454 pragma Import (C, pthread_rwlock_wrlock, "pthread_rwlock_wrlock");
456 function pthread_rwlock_unlock (mutex : access pthread_rwlock_t) return int;
457 pragma Import (C, pthread_rwlock_unlock, "pthread_rwlock_unlock");
459 function pthread_condattr_init
460 (attr : access pthread_condattr_t) return int;
461 pragma Import (C, pthread_condattr_init, "pthread_condattr_init");
463 function pthread_condattr_destroy
464 (attr : access pthread_condattr_t) return int;
465 pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy");
467 function pthread_cond_init
468 (cond : access pthread_cond_t;
469 attr : access pthread_condattr_t) return int;
470 pragma Import (C, pthread_cond_init, "pthread_cond_init");
472 function pthread_cond_destroy (cond : access pthread_cond_t) return int;
473 pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy");
475 function pthread_cond_signal (cond : access pthread_cond_t) return int;
476 pragma Import (C, pthread_cond_signal, "pthread_cond_signal");
478 function pthread_cond_wait
479 (cond : access pthread_cond_t;
480 mutex : access pthread_mutex_t) return int;
481 pragma Import (C, pthread_cond_wait, "pthread_cond_wait");
483 function pthread_cond_timedwait
484 (cond : access pthread_cond_t;
485 mutex : access pthread_mutex_t;
486 abstime : access timespec) return int;
487 pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait");
489 Relative_Timed_Wait : constant Boolean := False;
490 -- pthread_cond_timedwait requires an absolute delay time
492 --------------------------
493 -- POSIX.1c Section 13 --
494 --------------------------
495 -- From /usr/include/pthread/pthreadtypes.h
497 PTHREAD_PRIO_NONE : constant := 0;
498 PTHREAD_PRIO_PROTECT : constant := 2;
499 PTHREAD_PRIO_INHERIT : constant := 1;
501 -- GNU/Hurd does not support Thread Priority Protection or Thread
502 -- Priority Inheritance and lacks some pthread_mutexattr_* functions.
503 -- Replace them with dummy versions.
504 -- From: /usr/include/pthread/pthread.h
506 function pthread_mutexattr_setprotocol
507 (attr : access pthread_mutexattr_t;
508 protocol : int) return int;
509 pragma Import (C, pthread_mutexattr_setprotocol,
510 "pthread_mutexattr_setprotocol");
512 function pthread_mutexattr_getprotocol
513 (attr : access pthread_mutexattr_t;
514 protocol : access int) return int;
515 pragma Import (C, pthread_mutexattr_getprotocol,
516 "pthread_mutexattr_getprotocol");
518 function pthread_mutexattr_setprioceiling
519 (attr : access pthread_mutexattr_t;
520 prioceiling : int) return int;
522 function pthread_mutexattr_getprioceiling
523 (attr : access pthread_mutexattr_t;
524 prioceiling : access int) return int;
526 type struct_sched_param is record
527 sched_priority : int; -- scheduling priority
528 end record;
529 pragma Convention (C, struct_sched_param);
531 function pthread_setschedparam
532 (thread : pthread_t;
533 policy : int;
534 param : access struct_sched_param) return int;
536 function pthread_attr_setscope
537 (attr : access pthread_attr_t;
538 contentionscope : int) return int;
539 pragma Import (C, pthread_attr_setscope, "pthread_attr_setscope");
541 function pthread_attr_getscope
542 (attr : access pthread_attr_t;
543 contentionscope : access int) return int;
544 pragma Import (C, pthread_attr_getscope, "pthread_attr_getscope");
546 function pthread_attr_setinheritsched
547 (attr : access pthread_attr_t;
548 inheritsched : int) return int;
549 pragma Import (C, pthread_attr_setinheritsched,
550 "pthread_attr_setinheritsched");
552 function pthread_attr_getinheritsched
553 (attr : access pthread_attr_t;
554 inheritsched : access int) return int;
555 pragma Import (C, pthread_attr_getinheritsched,
556 "pthread_attr_getinheritsched");
558 function pthread_attr_setschedpolicy
559 (attr : access pthread_attr_t;
560 policy : int) return int;
561 pragma Import (C, pthread_attr_setschedpolicy, "pthread_setschedpolicy");
563 function sched_yield return int;
564 pragma Import (C, sched_yield, "sched_yield");
566 ---------------------------
567 -- P1003.1c - Section 16 --
568 ---------------------------
570 function pthread_attr_init
571 (attributes : access pthread_attr_t) return int;
572 pragma Import (C, pthread_attr_init, "pthread_attr_init");
574 function pthread_attr_destroy
575 (attributes : access pthread_attr_t) return int;
576 pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy");
578 function pthread_attr_setdetachstate
579 (attr : access pthread_attr_t;
580 detachstate : int) return int;
581 pragma Import
582 (C, pthread_attr_setdetachstate, "pthread_attr_setdetachstate");
584 function pthread_attr_setstacksize
585 (attr : access pthread_attr_t;
586 stacksize : size_t) return int;
587 pragma Import (C, pthread_attr_setstacksize, "pthread_attr_setstacksize");
589 -- From: /usr/include/pthread/pthread.h
590 function pthread_create
591 (thread : access pthread_t;
592 attributes : access pthread_attr_t;
593 start_routine : Thread_Body;
594 arg : System.Address) return int;
595 pragma Import (C, pthread_create, "pthread_create");
597 procedure pthread_exit (status : System.Address);
598 pragma Import (C, pthread_exit, "pthread_exit");
600 function pthread_self return pthread_t;
601 pragma Import (C, pthread_self, "pthread_self");
603 --------------------------
604 -- POSIX.1c Section 17 --
605 --------------------------
607 function pthread_setspecific
608 (key : pthread_key_t;
609 value : System.Address) return int;
610 pragma Import (C, pthread_setspecific, "pthread_setspecific");
612 function pthread_getspecific (key : pthread_key_t) return System.Address;
613 pragma Import (C, pthread_getspecific, "pthread_getspecific");
615 type destructor_pointer is access procedure (arg : System.Address);
616 pragma Convention (C, destructor_pointer);
618 function pthread_key_create
619 (key : access pthread_key_t;
620 destructor : destructor_pointer) return int;
621 pragma Import (C, pthread_key_create, "pthread_key_create");
623 -- From /usr/include/i386-gnu/bits/sched.h
624 CPU_SETSIZE : constant := 1_024;
626 type bit_field is array (1 .. CPU_SETSIZE) of Boolean;
627 for bit_field'Size use CPU_SETSIZE;
628 pragma Pack (bit_field);
629 pragma Convention (C, bit_field);
631 type cpu_set_t is record
632 bits : bit_field;
633 end record;
634 pragma Convention (C, cpu_set_t);
636 private
638 type sigset_t is array (1 .. 4) of unsigned;
640 -- In GNU/Hurd the component sa_handler turns out to
641 -- be one a union type, and the selector is a macro:
642 -- #define sa_handler __sigaction_handler.sa_handler
643 -- #define sa_sigaction __sigaction_handler.sa_sigaction
645 -- Should we add a signal_context type here ?
646 -- How could it be done independent of the CPU architecture ?
647 -- sigcontext type is opaque, so it is architecturally neutral.
648 -- It is always passed as an access type, so define it as an empty record
649 -- since the contents are not used anywhere.
650 type struct_sigcontext is null record;
651 pragma Convention (C, struct_sigcontext);
653 type pid_t is new int;
655 type time_t is new long;
657 type timespec is record
658 tv_sec : time_t;
659 tv_nsec : long;
660 end record;
661 pragma Convention (C, timespec);
663 -- From: /usr/include/pthread/pthreadtypes.h:
664 -- typedef struct __pthread_attr pthread_attr_t;
665 -- /usr/include/i386-gnu/bits/thread-attr.h: struct __pthread_attr...
666 -- /usr/include/pthread/pthreadtypes.h: enum __pthread_contentionscope
667 -- enum __pthread_detachstate detachstate;
668 -- enum __pthread_inheritsched inheritsched;
669 -- enum __pthread_contentionscope contentionscope;
670 -- Not used: schedpolicy : int;
671 type pthread_attr_t is record
672 schedparam : struct_sched_param;
673 stackaddr : System.Address;
674 stacksize : size_t;
675 guardsize : size_t;
676 detachstate : int;
677 inheritsched : int;
678 contentionscope : int;
679 schedpolicy : int;
680 end record;
681 pragma Convention (C, pthread_attr_t);
683 -- From: /usr/include/pthread/pthreadtypes.h:
684 -- typedef struct __pthread_condattr pthread_condattr_t;
685 -- From: /usr/include/i386-gnu/bits/condition-attr.h:
686 -- struct __pthread_condattr {
687 -- enum __pthread_process_shared pshared;
688 -- __Clockid_T Clock;}
689 -- From: /usr/include/pthread/pthreadtypes.h:
690 -- enum __pthread_process_shared
691 type pthread_condattr_t is record
692 pshared : int;
693 clock : clockid_t;
694 end record;
695 pragma Convention (C, pthread_condattr_t);
697 -- From: /usr/include/pthread/pthreadtypes.h:
698 -- typedef struct __pthread_mutexattr pthread_mutexattr_t; and
699 -- /usr/include/i386-gnu/bits/mutex-attr.h
700 -- struct __pthread_mutexattr {
701 -- int prioceiling;
702 -- enum __pthread_mutex_protocol protocol;
703 -- enum __pthread_process_shared pshared;
704 -- enum __pthread_mutex_type mutex_type;};
705 type pthread_mutexattr_t is record
706 prioceiling : int;
707 protocol : int;
708 pshared : int;
709 mutex_type : int;
710 end record;
711 pragma Convention (C, pthread_mutexattr_t);
713 -- From: /usr/include/pthread/pthreadtypes.h
714 -- typedef struct __pthread_mutex pthread_mutex_t; and
715 -- /usr/include/i386-gnu/bits/mutex.h:
716 -- struct __pthread_mutex {
717 -- __pthread_spinlock_t __held;
718 -- __pthread_spinlock_t __lock;
719 -- /* in cthreads, mutex_init does not initialized the third
720 -- pointer, as such, we cannot rely on its value for anything. */
721 -- char *cthreadscompat1;
722 -- struct __pthread *__queue;
723 -- struct __pthread_mutexattr *attr;
724 -- void *data;
725 -- /* up to this point, we are completely compatible with cthreads
726 -- and what libc expects. */
727 -- void *owner;
728 -- unsigned locks;
729 -- /* if null then the default attributes apply. */
730 -- };
732 type pthread_mutex_t is record
733 held : int;
734 lock : int;
735 cthreadcompat : System.Address;
736 queue : System.Address;
737 attr : System.Address;
738 data : System.Address;
739 owner : System.Address;
740 locks : unsigned;
741 end record;
742 pragma Convention (C, pthread_mutex_t);
743 -- pointer needed?
744 -- type pthread_mutex_t_ptr is access pthread_mutex_t;
746 -- From: /usr/include/pthread/pthreadtypes.h:
747 -- typedef struct __pthread_cond pthread_cond_t;
748 -- typedef struct __pthread_condattr pthread_condattr_t;
749 -- /usr/include/i386-gnu/bits/condition.h:struct __pthread_cond{}
750 -- pthread_condattr_t: see above!
751 -- /usr/include/i386-gnu/bits/condition.h:
752 -- struct __pthread_condimpl *__impl;
754 type pthread_cond_t is record
755 lock : int;
756 queue : System.Address;
757 condattr : System.Address;
758 impl : System.Address;
759 data : System.Address;
760 end record;
761 pragma Convention (C, pthread_cond_t);
763 -- From: /usr/include/pthread/pthreadtypes.h:
764 -- typedef __pthread_key pthread_key_t; and
765 -- /usr/include/i386-gnu/bits/thread-specific.h:
766 -- typedef int __pthread_key;
768 type pthread_key_t is new int;
770 -- From: /usr/include/i386-gnu/bits/rwlock-attr.h:
771 -- struct __pthread_rwlockattr {
772 -- enum __pthread_process_shared pshared; };
774 type pthread_rwlockattr_t is record
775 pshared : int;
776 end record;
777 pragma Convention (C, pthread_rwlockattr_t);
779 -- From: /usr/include/i386-gnu/bits/rwlock.h:
780 -- struct __pthread_rwlock {
781 -- __pthread_spinlock_t __held;
782 -- __pthread_spinlock_t __lock;
783 -- int readers;
784 -- struct __pthread *readerqueue;
785 -- struct __pthread *writerqueue;
786 -- struct __pthread_rwlockattr *__attr;
787 -- void *__data; };
789 type pthread_rwlock_t is record
790 held : int;
791 lock : int;
792 readers : int;
793 readerqueue : System.Address;
794 writerqueue : System.Address;
795 attr : pthread_rwlockattr_t;
796 data : int;
797 end record;
798 pragma Convention (C, pthread_rwlock_t);
800 end System.OS_Interface;