* tree-loop-linear.c: Don't include varray.h.
[official-gcc.git] / gcc / ada / s-osinte-tru64.ads
blobbac521fd54a65c5019e3b9c310c2cb16e103ddbc
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-1994, Florida State University --
10 -- Copyright (C) 1995-2006, Free Software Foundation, Inc. --
11 -- --
12 -- GNARL 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 2, or (at your option) any later ver- --
15 -- sion. GNARL 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. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNARL; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
21 -- Boston, MA 02110-1301, USA. --
22 -- --
23 -- As a special exception, if other files instantiate generics from this --
24 -- unit, or you link this unit with other files to produce an executable, --
25 -- this unit does not by itself cause the resulting executable to be --
26 -- covered by the GNU General Public License. This exception does not --
27 -- however invalidate any other reasons why the executable file might be --
28 -- covered by the GNU Public License. --
29 -- --
30 -- GNARL was developed by the GNARL team at Florida State University. --
31 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
32 -- --
33 ------------------------------------------------------------------------------
35 -- This is the DEC Unix 4.0/5.1 version of this package
37 -- This package encapsulates all direct interfaces to OS services
38 -- that are needed by children of System.
40 -- PLEASE DO NOT add any with-clauses to this package or remove the pragma
41 -- Preelaborate. This package is designed to be a bottom-level (leaf) package.
43 with Interfaces.C;
44 with Unchecked_Conversion;
46 package System.OS_Interface is
47 pragma Preelaborate;
49 pragma Linker_Options ("-lpthread");
50 pragma Linker_Options ("-lmach");
51 pragma Linker_Options ("-lexc");
52 pragma Linker_Options ("-lrt");
54 subtype int is Interfaces.C.int;
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;
63 subtype char_array is Interfaces.C.char_array;
65 -----------
66 -- Errno --
67 -----------
69 function errno return int;
70 pragma Import (C, errno, "_Geterrno");
72 EAGAIN : constant := 35;
73 EINTR : constant := 4;
74 EINVAL : constant := 22;
75 ENOMEM : constant := 12;
76 ETIMEDOUT : constant := 60;
78 -------------
79 -- Signals --
80 -------------
82 Max_Interrupt : constant := 48;
83 type Signal is new int range 0 .. Max_Interrupt;
84 for Signal'Size use int'Size;
86 SIGHUP : constant := 1; -- hangup
87 SIGINT : constant := 2; -- interrupt (rubout)
88 SIGQUIT : constant := 3; -- quit (ASCD FS)
89 SIGILL : constant := 4; -- illegal instruction (not reset)
90 SIGTRAP : constant := 5; -- trace trap (not reset)
91 SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future
92 SIGIOT : constant := 6; -- abort (terminate) process
93 SIGLOST : constant := 6; -- old BSD signal ??
94 SIGEMT : constant := 7; -- EMT instruction
95 SIGFPE : constant := 8; -- floating point exception
96 SIGKILL : constant := 9; -- kill (cannot be caught or ignored)
97 SIGBUS : constant := 10; -- bus error
98 SIGSEGV : constant := 11; -- segmentation violation
99 SIGSYS : constant := 12; -- bad argument to system call
100 SIGPIPE : constant := 13; -- write on a pipe with no one to read it
101 SIGALRM : constant := 14; -- alarm clock
102 SIGTERM : constant := 15; -- software termination signal from kill
103 SIGURG : constant := 16; -- urgent condition on IO channel
104 SIGIOINT : constant := 16; -- printer to backend error signal
105 SIGSTOP : constant := 17; -- stop (cannot be caught or ignored)
106 SIGTSTP : constant := 18; -- user stop requested from tty
107 SIGCONT : constant := 19; -- stopped process has been continued
108 SIGCHLD : constant := 20; -- child status change
109 SIGTTIN : constant := 21; -- background tty read attempted
110 SIGTTOU : constant := 22; -- background tty write attempted
111 SIGPOLL : constant := 23; -- I/O possible, or completed
112 SIGIO : constant := 23; -- STREAMS version of SIGPOLL
113 SIGAIO : constant := 23; -- base lan i/o
114 SIGPTY : constant := 23; -- pty i/o
115 SIGXCPU : constant := 24; -- CPU time limit exceeded
116 SIGXFSZ : constant := 25; -- filesize limit exceeded
117 SIGVTALRM : constant := 26; -- virtual timer expired
118 SIGPROF : constant := 27; -- profiling timer expired
119 SIGWINCH : constant := 28; -- window size change
120 SIGINFO : constant := 29; -- information request
121 SIGPWR : constant := 29; -- Power Fail/Restart -- SVID3/SVR4
122 SIGUSR1 : constant := 30; -- user defined signal 1
123 SIGUSR2 : constant := 31; -- user defined signal 2
124 SIGRESV : constant := 32; -- reserved by Digital for future use
126 SIGADAABORT : constant := SIGABRT;
128 type Signal_Set is array (Natural range <>) of Signal;
130 Unmasked : constant Signal_Set := (0 .. 0 => SIGTRAP);
131 Reserved : constant Signal_Set := (SIGALRM, SIGABRT, SIGKILL, SIGSTOP);
133 type sigset_t is private;
135 function sigaddset (set : access sigset_t; sig : Signal) return int;
136 pragma Import (C, sigaddset);
138 function sigdelset (set : access sigset_t; sig : Signal) return int;
139 pragma Import (C, sigdelset);
141 function sigfillset (set : access sigset_t) return int;
142 pragma Import (C, sigfillset);
144 function sigismember (set : access sigset_t; sig : Signal) return int;
145 pragma Import (C, sigismember);
147 function sigemptyset (set : access sigset_t) return int;
148 pragma Import (C, sigemptyset);
150 type union_type_3 is new String (1 .. 116);
151 type siginfo_t is record
152 si_signo : int;
153 si_errno : int;
154 si_code : int;
155 X_data : union_type_3;
156 end record;
157 for siginfo_t'Size use 8 * 128;
158 pragma Convention (C, siginfo_t);
160 type struct_sigaction is record
161 sa_handler : System.Address;
162 sa_mask : sigset_t;
163 sa_flags : int;
164 sa_signo : int;
165 end record;
166 pragma Convention (C, struct_sigaction);
167 type struct_sigaction_ptr is access all struct_sigaction;
169 SIG_BLOCK : constant := 1;
170 SIG_UNBLOCK : constant := 2;
171 SIG_SETMASK : constant := 3;
173 SIG_DFL : constant := 0;
174 SIG_IGN : constant := 1;
176 SA_NODEFER : constant := 8;
177 SA_SIGINFO : constant := 16#40#;
179 function sigaction
180 (sig : Signal;
181 act : struct_sigaction_ptr;
182 oact : struct_sigaction_ptr) return int;
183 pragma Import (C, sigaction);
185 ----------
186 -- Time --
187 ----------
189 type timespec is private;
191 function nanosleep (rqtp, rmtp : access timespec) return int;
192 pragma Import (C, nanosleep);
194 type clockid_t is private;
196 CLOCK_REALTIME : constant clockid_t;
198 function clock_gettime
199 (clock_id : clockid_t;
200 tp : access timespec) return int;
201 pragma Import (C, clock_gettime);
203 function To_Duration (TS : timespec) return Duration;
204 pragma Inline (To_Duration);
206 function To_Timespec (D : Duration) return timespec;
207 pragma Inline (To_Timespec);
209 type struct_timezone is record
210 tz_minuteswest : int;
211 tz_dsttime : int;
212 end record;
213 pragma Convention (C, struct_timezone);
214 type struct_timeval is private;
215 -- This is needed on systems that do not have clock_gettime()
216 -- but do have gettimeofday().
218 function To_Duration (TV : struct_timeval) return Duration;
219 pragma Inline (To_Duration);
221 function To_Timeval (D : Duration) return struct_timeval;
222 pragma Inline (To_Timeval);
224 -------------------------
225 -- Priority Scheduling --
226 -------------------------
228 SCHED_FIFO : constant := 1;
229 SCHED_RR : constant := 2;
230 SCHED_OTHER : constant := 3;
231 SCHED_LFI : constant := 5;
233 -------------
234 -- Process --
235 -------------
237 type pid_t is private;
239 function kill (pid : pid_t; sig : Signal) return int;
240 pragma Import (C, kill);
242 function getpid return pid_t;
243 pragma Import (C, getpid);
245 BIND_NO_INHERIT : constant := 1;
247 function bind_to_cpu
248 (pid : pid_t;
249 cpu_mask : unsigned_long;
250 flag : unsigned_long := BIND_NO_INHERIT) return int;
251 pragma Import (C, bind_to_cpu);
253 -------------
254 -- Threads --
255 -------------
257 type Thread_Body is access
258 function (arg : System.Address) return System.Address;
260 function Thread_Body_Access is new
261 Unchecked_Conversion (System.Address, Thread_Body);
263 type pthread_t is private;
264 subtype Thread_Id is pthread_t;
266 type pthread_mutex_t is limited private;
267 type pthread_cond_t is limited private;
268 type pthread_attr_t is limited private;
269 type pthread_mutexattr_t is limited private;
270 type pthread_condattr_t is limited private;
271 type pthread_key_t is private;
273 PTHREAD_CREATE_DETACHED : constant := 1;
275 PTHREAD_SCOPE_PROCESS : constant := 0;
276 PTHREAD_SCOPE_SYSTEM : constant := 1;
278 PTHREAD_EXPLICIT_SCHED : constant := 1;
280 -----------
281 -- Stack --
282 -----------
284 Stack_Base_Available : constant Boolean := False;
285 -- Indicates wether the stack base is available on this target.
287 function Get_Stack_Base (thread : pthread_t) return Address;
288 pragma Inline (Get_Stack_Base);
289 -- returns the stack base of the specified thread.
290 -- Only call this function when Stack_Base_Available is True.
292 function Get_Page_Size return size_t;
293 function Get_Page_Size return Address;
294 pragma Import (C, Get_Page_Size, "getpagesize");
295 -- returns the size of a page, or 0 if this is not relevant on this
296 -- target
298 PROT_NONE : constant := 0;
299 PROT_READ : constant := 1;
300 PROT_WRITE : constant := 2;
301 PROT_EXEC : constant := 4;
302 PROT_ALL : constant := PROT_READ + PROT_WRITE + PROT_EXEC;
304 PROT_ON : constant := PROT_READ;
305 PROT_OFF : constant := PROT_ALL;
307 function mprotect (addr : Address; len : size_t; prot : int) return int;
308 pragma Import (C, mprotect);
310 procedure Hide_Yellow_Zone;
311 -- Every thread except the initial one features an overflow warning area
312 -- just above the overflow guard area on the stack. They are called
313 -- the Yellow Zone and the Red Zone respectively. This procedure hides
314 -- the former so that the latter could be exposed to stack probing.
316 ---------------------------------------
317 -- Nonstandard Thread Initialization --
318 ---------------------------------------
320 procedure pthread_init;
321 pragma Inline (pthread_init);
322 -- This is a dummy procedure to share some GNULLI files
324 -------------------------
325 -- POSIX.1c Section 3 --
326 -------------------------
328 function sigwait
329 (set : access sigset_t;
330 sig : access Signal) return int;
331 pragma Import (C, sigwait, "__sigwaitd10");
333 function pthread_kill
334 (thread : pthread_t;
335 sig : Signal) return int;
336 pragma Import (C, pthread_kill);
338 function pthread_sigmask
339 (how : int;
340 set : access sigset_t;
341 oset : access sigset_t) return int;
342 pragma Import (C, pthread_sigmask);
344 --------------------------
345 -- POSIX.1c Section 11 --
346 --------------------------
348 function pthread_mutexattr_init (attr : access pthread_mutexattr_t)
349 return int;
350 pragma Import (C, pthread_mutexattr_init);
352 function pthread_mutexattr_destroy
353 (attr : access pthread_mutexattr_t) return int;
354 pragma Import (C, pthread_mutexattr_destroy);
356 function pthread_mutex_init
357 (mutex : access pthread_mutex_t;
358 attr : access pthread_mutexattr_t) return int;
359 pragma Import (C, pthread_mutex_init, "__pthread_mutex_init");
361 function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int;
362 pragma Import (C, pthread_mutex_destroy, "__pthread_mutex_destroy");
364 function pthread_mutex_lock (mutex : access pthread_mutex_t) return int;
365 pragma Import (C, pthread_mutex_lock, "__pthread_mutex_lock");
367 function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int;
368 pragma Import (C, pthread_mutex_unlock, "__pthread_mutex_unlock");
370 function pthread_condattr_init
371 (attr : access pthread_condattr_t) return int;
372 pragma Import (C, pthread_condattr_init);
374 function pthread_condattr_destroy
375 (attr : access pthread_condattr_t) return int;
376 pragma Import (C, pthread_condattr_destroy);
378 function pthread_cond_init
379 (cond : access pthread_cond_t;
380 attr : access pthread_condattr_t) return int;
381 pragma Import (C, pthread_cond_init, "__pthread_cond_init");
383 function pthread_cond_destroy (cond : access pthread_cond_t) return int;
384 pragma Import (C, pthread_cond_destroy, "__pthread_cond_destroy");
386 function pthread_cond_signal (cond : access pthread_cond_t) return int;
387 pragma Import (C, pthread_cond_signal, "__pthread_cond_signal");
389 function pthread_cond_wait
390 (cond : access pthread_cond_t;
391 mutex : access pthread_mutex_t) return int;
392 pragma Import (C, pthread_cond_wait, "__pthread_cond_wait");
394 function pthread_cond_timedwait
395 (cond : access pthread_cond_t;
396 mutex : access pthread_mutex_t;
397 abstime : access timespec) return int;
398 pragma Import (C, pthread_cond_timedwait, "__pthread_cond_timedwait");
400 --------------------------
401 -- POSIX.1c Section 13 --
402 --------------------------
404 function pthread_mutexattr_setprotocol
405 (attr : access pthread_mutexattr_t;
406 protocol : int) return int;
407 pragma Import (C, pthread_mutexattr_setprotocol);
409 function pthread_mutexattr_setprioceiling
410 (attr : access pthread_mutexattr_t;
411 prioceiling : int) return int;
412 pragma Import (C, pthread_mutexattr_setprioceiling);
414 type struct_sched_param is record
415 sched_priority : int; -- scheduling priority
416 end record;
418 function pthread_setschedparam
419 (thread : pthread_t;
420 policy : int;
421 param : access struct_sched_param) return int;
422 pragma Import (C, pthread_setschedparam);
424 function pthread_attr_setscope
425 (attr : access pthread_attr_t;
426 contentionscope : int) return int;
427 pragma Import (C, pthread_attr_setscope);
429 function pthread_attr_setinheritsched
430 (attr : access pthread_attr_t;
431 inheritsched : int) return int;
432 pragma Import (C, pthread_attr_setinheritsched,
433 "__pthread_attr_setinheritsched");
435 function pthread_attr_setschedpolicy
436 (attr : access pthread_attr_t; policy : int) return int;
437 pragma Import (C, pthread_attr_setschedpolicy);
439 function pthread_attr_setschedparam
440 (attr : access pthread_attr_t;
441 sched_param : access struct_sched_param) return int;
442 pragma Import (C, pthread_attr_setschedparam);
444 function sched_yield return int;
445 pragma Import (C, sched_yield);
447 --------------------------
448 -- P1003.1c Section 16 --
449 --------------------------
451 function pthread_attr_init (attributes : access pthread_attr_t)
452 return int;
453 pragma Import (C, pthread_attr_init);
455 function pthread_attr_destroy (attributes : access pthread_attr_t)
456 return int;
457 pragma Import (C, pthread_attr_destroy);
459 function pthread_attr_setdetachstate
460 (attr : access pthread_attr_t;
461 detachstate : int) return int;
462 pragma Import (C, pthread_attr_setdetachstate);
464 function pthread_attr_setstacksize
465 (attr : access pthread_attr_t;
466 stacksize : size_t) return int;
467 pragma Import (C, pthread_attr_setstacksize, "__pthread_attr_setstacksize");
469 function pthread_create
470 (thread : access pthread_t;
471 attributes : access pthread_attr_t;
472 start_routine : Thread_Body;
473 arg : System.Address) return int;
474 pragma Import (C, pthread_create, "__pthread_create");
476 procedure pthread_exit (status : System.Address);
477 pragma Import (C, pthread_exit, "__pthread_exit");
479 function pthread_self return pthread_t;
480 pragma Inline (pthread_self);
482 --------------------------
483 -- POSIX.1c Section 17 --
484 --------------------------
486 function pthread_setspecific
487 (key : pthread_key_t; value : System.Address) return int;
488 pragma Import (C, pthread_setspecific, "__pthread_setspecific");
490 function pthread_getspecific (key : pthread_key_t) return System.Address;
491 pragma Import (C, pthread_getspecific, "__pthread_getspecific");
493 type destructor_pointer is access procedure (arg : System.Address);
495 function pthread_key_create
496 (key : access pthread_key_t;
497 destructor : destructor_pointer) return int;
498 pragma Import (C, pthread_key_create);
500 private
502 type sigset_t is new unsigned_long;
504 type pid_t is new int;
506 type time_t is new int;
508 type timespec is record
509 tv_sec : time_t;
510 tv_nsec : long;
511 end record;
512 pragma Convention (C, timespec);
514 type clockid_t is new int;
515 CLOCK_REALTIME : constant clockid_t := 1;
517 type struct_timeval is record
518 tv_sec : time_t;
519 tv_usec : time_t;
520 end record;
521 pragma Convention (C, struct_timeval);
523 type unsigned_long_array is array (Natural range <>) of unsigned_long;
525 type pthread_t is new System.Address;
527 type pthread_teb_t is record
528 reserved1 : System.Address;
529 reserved2 : System.Address;
530 size : unsigned_short;
531 version : unsigned_char;
532 reserved3 : unsigned_char;
533 external : unsigned_char;
534 reserved4 : char_array (0 .. 1);
535 creator : unsigned_char;
536 sequence : unsigned_long;
537 reserved5 : unsigned_long_array (0 .. 1);
538 per_kt_area : System.Address;
539 stack_base : System.Address;
540 stack_reserve : System.Address;
541 stack_yellow : System.Address;
542 stack_guard : System.Address;
543 stack_size : unsigned_long;
544 tsd_values : System.Address;
545 tsd_count : unsigned_long;
546 reserved6 : unsigned;
547 reserved7 : unsigned;
548 thread_flags : unsigned;
549 thd_errno : int;
550 stack_hiwater : System.Address;
551 home_rad : unsigned_long;
552 end record;
553 pragma Convention (C, pthread_teb_t);
555 type pthread_cond_t is record
556 state : unsigned;
557 valid : unsigned;
558 name : System.Address;
559 arg : unsigned;
560 reserved1 : unsigned;
561 sequence : unsigned_long;
562 block : System.Address;
563 end record;
564 pragma Convention (C, pthread_cond_t);
566 type pthread_attr_t is record
567 valid : long;
568 name : System.Address;
569 arg : unsigned_long;
570 reserved : unsigned_long_array (0 .. 18);
571 end record;
572 pragma Convention (C, pthread_attr_t);
574 type pthread_mutex_t is record
575 lock : unsigned;
576 valid : unsigned;
577 name : System.Address;
578 arg : unsigned;
579 depth : unsigned;
580 sequence : unsigned_long;
581 owner : unsigned_long;
582 block : System.Address;
583 end record;
584 for pthread_mutex_t'Size use 8 * 48;
585 pragma Convention (C, pthread_mutex_t);
587 type pthread_mutexattr_t is record
588 valid : long;
589 reserved : unsigned_long_array (0 .. 14);
590 end record;
591 pragma Convention (C, pthread_mutexattr_t);
593 type pthread_condattr_t is record
594 valid : long;
595 reserved : unsigned_long_array (0 .. 12);
596 end record;
597 pragma Convention (C, pthread_condattr_t);
599 type pthread_key_t is new unsigned;
601 end System.OS_Interface;