1 ------------------------------------------------------------------------------
3 -- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
5 -- S Y S T E M . O S _ I N T E R F A C E --
9 -- Copyright (C) 1997-2001 Free Software Foundation, Inc. --
11 -- GNARL is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNARL; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
29 -- GNARL was developed by the GNARL team at Florida State University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
32 ------------------------------------------------------------------------------
34 -- This is an Irix (old pthread library) version of this package.
36 -- This package encapsulates all direct interfaces to OS services
37 -- that are needed by children of System.
39 -- PLEASE DO NOT add any with-clauses to this package
40 -- or remove the pragma Elaborate_Body.
41 -- It is designed to be a bottom-level (leaf) package.
45 with Interfaces
.C
.Strings
;
47 package System
.OS_Interface
is
51 pragma Linker_Options
("-lathread");
53 subtype int
is Interfaces
.C
.int
;
54 subtype short
is Interfaces
.C
.short
;
55 subtype long
is Interfaces
.C
.long
;
56 subtype unsigned
is Interfaces
.C
.unsigned
;
57 subtype unsigned_short
is Interfaces
.C
.unsigned_short
;
58 subtype unsigned_long
is Interfaces
.C
.unsigned_long
;
59 subtype unsigned_char
is Interfaces
.C
.unsigned_char
;
60 subtype plain_char
is Interfaces
.C
.plain_char
;
61 subtype size_t
is Interfaces
.C
.size_t
;
62 subtype chars_ptr
is Interfaces
.C
.Strings
.chars_ptr
;
68 function errno
return int
;
69 pragma Import
(C
, errno
, "__get_errno");
71 EINTR
: constant := 4; -- interrupted system call
72 EAGAIN
: constant := 11; -- No more processes
73 ENOMEM
: constant := 12; -- Not enough core
74 EINVAL
: constant := 22; -- Invalid argument
75 ETIMEDOUT
: constant := 145; -- Connection timed out
81 Max_Interrupt
: constant := 64;
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
93 SIGEMT
: constant := 7; -- EMT instruction
94 SIGFPE
: constant := 8; -- floating point exception
95 SIGKILL
: constant := 9; -- kill (cannot be caught or ignored)
96 SIGBUS
: constant := 10; -- bus error
97 SIGSEGV
: constant := 11; -- segmentation violation
98 SIGSYS
: constant := 12; -- bad argument to system call
99 SIGPIPE
: constant := 13; -- write on a pipe with no one to read it
100 SIGALRM
: constant := 14; -- alarm clock
101 SIGTERM
: constant := 15; -- software termination signal from kill
102 SIGUSR1
: constant := 16; -- user defined signal 1
103 SIGUSR2
: constant := 17; -- user defined signal 2
104 SIGCLD
: constant := 18; -- alias for SIGCHLD
105 SIGCHLD
: constant := 18; -- child status change
106 SIGPWR
: constant := 19; -- power-fail restart
107 SIGWINCH
: constant := 20; -- window size change
108 SIGURG
: constant := 21; -- urgent condition on IO channel
109 SIGPOLL
: constant := 22; -- pollable event occurred
110 SIGIO
: constant := 22; -- I/O possible (Solaris SIGPOLL alias)
111 SIGSTOP
: constant := 23; -- stop (cannot be caught or ignored)
112 SIGTSTP
: constant := 24; -- user stop requested from tty
113 SIGCONT
: constant := 25; -- stopped process has been continued
114 SIGTTIN
: constant := 26; -- background tty read attempted
115 SIGTTOU
: constant := 27; -- background tty write attempted
116 SIGVTALRM
: constant := 28; -- virtual timer expired
117 SIGPROF
: constant := 29; -- profiling timer expired
118 SIGXCPU
: constant := 30; -- CPU time limit exceeded
119 SIGXFSZ
: constant := 31; -- filesize limit exceeded
120 SIGK32
: constant := 32; -- reserved for kernel (IRIX)
121 SIGCKPT
: constant := 33; -- Checkpoint warning
122 SIGRESTART
: constant := 34; -- Restart warning
123 SIGUME
: constant := 35; -- Uncorrectable memory error
124 -- Signals defined for Posix 1003.1c.
125 SIGPTINTR
: constant := 47;
126 SIGPTRESCHED
: constant := 48;
127 -- Posix 1003.1b signals
128 SIGRTMIN
: constant := 49; -- Posix 1003.1b signals
129 SIGRTMAX
: constant := 64; -- Posix 1003.1b signals
131 type sigset_t
is private;
132 type sigset_t_ptr
is access all sigset_t
;
134 function sigaddset
(set
: access sigset_t
; sig
: Signal
) return int
;
135 pragma Import
(C
, sigaddset
, "sigaddset");
137 function sigdelset
(set
: access sigset_t
; sig
: Signal
) return int
;
138 pragma Import
(C
, sigdelset
, "sigdelset");
140 function sigfillset
(set
: access sigset_t
) return int
;
141 pragma Import
(C
, sigfillset
, "sigfillset");
143 function sigismember
(set
: access sigset_t
; sig
: Signal
) return int
;
144 pragma Import
(C
, sigismember
, "sigismember");
146 function sigemptyset
(set
: access sigset_t
) return int
;
147 pragma Import
(C
, sigemptyset
, "sigemptyset");
149 type siginfo_t
is record
153 bit_field_substitute_1
: String (1 .. 116);
155 pragma Convention
(C
, siginfo_t
);
157 type array_type_2
is array (Integer range 0 .. 1) of int
;
158 type struct_sigaction
is record
160 sa_handler
: System
.Address
;
162 sa_resv
: array_type_2
;
164 pragma Convention
(C
, struct_sigaction
);
165 type struct_sigaction_ptr
is access all struct_sigaction
;
167 SIG_BLOCK
: constant := 1;
168 SIG_UNBLOCK
: constant := 2;
169 SIG_SETMASK
: constant := 3;
171 SIG_DFL
: constant := 0;
172 SIG_IGN
: constant := 1;
176 act
: struct_sigaction_ptr
;
177 oact
: struct_sigaction_ptr
:= null) return int
;
178 pragma Import
(C
, sigaction
, "sigaction");
184 type time_t
is new int
;
186 type timespec
is record
190 pragma Convention
(C
, timespec
);
191 type timespec_ptr
is access all timespec
;
193 function To_Duration
(TS
: timespec
) return Duration;
194 pragma Inline
(To_Duration
);
196 function To_Timespec
(D
: Duration) return timespec
;
197 pragma Inline
(To_Timespec
);
199 type timer_t
is new Integer;
200 type clockid_t
is private;
202 CLOCK_REALTIME
: constant clockid_t
;
203 CLOCK_SGI_FAST
: constant clockid_t
;
204 CLOCK_SGI_CYCLE
: constant clockid_t
;
206 SGI_CYCLECNTR_SIZE
: constant := 165;
207 function syssgi
(request
: Interfaces
.C
.int
) return Interfaces
.C
.ptrdiff_t
;
209 pragma Import
(C
, syssgi
, "syssgi");
211 function clock_gettime
212 (clock_id
: clockid_t
;
213 tp
: access timespec
) return int
;
214 pragma Import
(C
, clock_gettime
, "clock_gettime");
216 function clock_getres
217 (clock_id
: clockid_t
; tp
: access timespec
) return int
;
218 pragma Import
(C
, clock_getres
, "clock_getres");
220 type struct_timeval
is record
224 pragma Convention
(C
, struct_timeval
);
226 function To_Duration
(TV
: struct_timeval
) return Duration;
227 pragma Inline
(To_Duration
);
229 function To_Timeval
(D
: Duration) return struct_timeval
;
230 pragma Inline
(To_Timeval
);
232 function gettimeofday
233 (tv
: access struct_timeval
;
234 tz
: System
.Address
:= System
.Null_Address
) return int
;
235 pragma Import
(C
, gettimeofday
, "gettimeofday");
237 -------------------------
238 -- Priority Scheduling --
239 -------------------------
241 SCHED_FIFO
: constant := 0;
242 SCHED_RR
: constant := 0;
243 SCHED_OTHER
: constant := 0;
249 type pid_t
is private;
251 function kill
(pid
: pid_t
; sig
: Signal
) return int
;
252 pragma Import
(C
, kill
, "kill");
254 function getpid
return pid_t
;
255 pragma Import
(C
, getpid
, "getpid");
257 ---------------------------------------
258 -- Nonstandard Thread Initialization --
259 ---------------------------------------
261 procedure pthread_init
;
262 pragma Inline
(pthread_init
);
263 -- This is a dummy procedure to share some GNULLI files
269 type Thread_Body
is access
270 function (arg
: System
.Address
) return System
.Address
;
272 type pthread_t
is private; -- thread identifier
273 subtype Thread_Id
is pthread_t
;
275 type pthread_mutex_t
is private; -- mutex identifier
276 type pthread_cond_t
is private; -- cond identifier
277 type pthread_attr_t
is private; -- pthread attributes
278 type pthread_mutexattr_t
is private; -- mutex attributes
279 type pthread_condattr_t
is private; -- mutex attributes
280 type sem_t
is private; -- semaphore identifier
281 type pthread_key_t
is private; -- per thread key
283 subtype pthread_once_t
is int
; -- dynamic package initialization
284 subtype resource_t
is long
; -- sproc. resource info.
285 type start_addr
is access function (arg
: Address
) return Address
;
286 type sproc_start_addr
is access function (arg
: Address
) return int
;
288 access function (arg
: Address
; arg1
: Address
) return Address
;
290 -- SGI specific types
292 subtype sproc_t
is Address
; -- sproc identifier
293 subtype sproc_attr_t
is Address
; -- sproc attributes
295 subtype spcb_p
is Address
;
296 subtype ptcb_p
is Address
;
298 -- Pthread Error Types
300 FUNC_OK
: constant := 0;
301 FUNC_ERR
: constant := -1;
303 -- pthread run-time initialization data structure
305 type pthread_init_struct
is record
306 conf_initsize
: int
; -- shared area size
307 max_sproc_count
: int
; -- maximum number of sprocs
308 sproc_stack_size
: size_t
; -- sproc stack size
309 os_default_priority
: int
; -- default IRIX pri for main process
310 os_sched_signal
: int
; -- default OS scheduling signal
311 guard_pages
: int
; -- number of guard pages per stack
312 init_sproc_count
: int
; -- initial number of sprocs
316 -- Pthread Attribute Initialize / Destroy
319 function pthread_attr_init
(attr
: access pthread_attr_t
) return int
;
320 pragma Import
(C
, pthread_attr_init
, "pthread_attr_init");
322 function pthread_attr_destroy
(attr
: access pthread_attr_t
) return int
;
323 pragma Import
(C
, pthread_attr_destroy
, "pthread_attr_destroy");
329 function pthread_attr_setstacksize
330 (attr
: access pthread_attr_t
; stacksize
: size_t
) return int
;
331 pragma Import
(C
, pthread_attr_setstacksize
, "pthread_attr_setstacksize");
333 function pthread_attr_setdetachstate
334 (attr
: access pthread_attr_t
; detachstate
: int
) return int
;
335 pragma Import
(C
, pthread_attr_setdetachstate
);
337 function pthread_attr_setname
338 (attr
: access pthread_attr_t
; name
: chars_ptr
) return int
;
339 pragma Import
(C
, pthread_attr_setname
, "pthread_attr_setname");
342 -- Thread Scheduling Attributes
345 function pthread_attr_setscope
346 (attr
: access pthread_attr_t
; contentionscope
: int
) return int
;
347 pragma Import
(C
, pthread_attr_setscope
, "pthread_attr_setscope");
349 function pthread_attr_setinheritsched
350 (attr
: access pthread_attr_t
; inherit
: int
) return int
;
352 (C
, pthread_attr_setinheritsched
, "pthread_attr_setinheritsched");
354 function pthread_attr_setsched
355 (attr
: access pthread_attr_t
; scheduler
: int
) return int
;
356 pragma Import
(C
, pthread_attr_setsched
, "pthread_attr_setsched");
358 function pthread_attr_setprio
359 (attr
: access pthread_attr_t
; priority
: int
) return int
;
360 pragma Import
(C
, pthread_attr_setprio
, "pthread_attr_setprio");
363 -- SGI Extensions to Thread Attributes
366 -- Bound to sproc attribute values
368 PTHREAD_BOUND
: constant := 1;
369 PTHREAD_NOT_BOUND
: constant := 0;
371 function pthread_attr_setresources
372 (attr
: access pthread_attr_t
; resources
: resource_t
) return int
;
373 pragma Import
(C
, pthread_attr_setresources
, "pthread_attr_setresources");
375 function pthread_attr_set_boundtosproc
376 (attr
: access pthread_attr_t
; bound_to_sproc
: int
) return int
;
378 (C
, pthread_attr_set_boundtosproc
, "pthread_attr_set_boundtosproc");
380 function pthread_attr_set_bsproc
381 (attr
: access pthread_attr_t
; bsproc
: spcb_p
) return int
;
382 pragma Import
(C
, pthread_attr_set_bsproc
, "pthread_attr_set_bsproc");
384 function pthread_attr_set_tslice
385 (attr
: access pthread_attr_t
;
386 ts_interval
: access struct_timeval
) return int
;
387 pragma Import
(C
, pthread_attr_set_tslice
, "pthread_attr_set_tslice");
390 -- Thread Creation & Management
393 function pthread_create
394 (thread
: access pthread_t
;
395 attr
: access pthread_attr_t
;
396 start_routine
: start_addr
;
397 arg
: Address
) return int
;
398 pragma Import
(C
, pthread_create
, "pthread_create");
400 procedure pthread_exit
(status
: Address
);
401 pragma Import
(C
, pthread_exit
, "pthread_exit");
403 procedure pthread_yield
(arg
: Address
:= System
.Null_Address
);
404 pragma Import
(C
, pthread_yield
, "pthread_yield");
406 function pthread_self
return pthread_t
;
407 pragma Import
(C
, pthread_self
, "pthread_self");
409 function pthread_kill
(thread
: pthread_t
; sig
: int
) return int
;
410 pragma Import
(C
, pthread_kill
, "pthread_kill");
413 -- SGI Extensions to POSIX thread operations
416 function pthread_setprio
(thread
: pthread_t
; priority
: int
) return int
;
417 pragma Import
(C
, pthread_setprio
, "pthread_setprio");
419 function pthread_suspend
(thread
: pthread_t
) return int
;
420 pragma Import
(C
, pthread_suspend
, "pthread_suspend");
422 function pthread_resume
(thread
: pthread_t
) return int
;
423 pragma Import
(C
, pthread_resume
, "pthread_resume");
425 function pthread_get_current_ada_tcb
return Address
;
426 pragma Import
(C
, pthread_get_current_ada_tcb
);
428 function pthread_set_ada_tcb
429 (thread
: pthread_t
; data
: Address
) return int
;
430 pragma Import
(C
, pthread_set_ada_tcb
, "pthread_set_ada_tcb");
432 -- Mutex Initialization / Destruction
434 function pthread_mutexattr_init
435 (attr
: access pthread_mutexattr_t
) return int
;
436 pragma Import
(C
, pthread_mutexattr_init
, "pthread_mutexattr_init");
438 function pthread_mutexattr_destroy
439 (attr
: access pthread_mutexattr_t
) return int
;
440 pragma Import
(C
, pthread_mutexattr_destroy
, "pthread_mutexattr_destroy");
442 function pthread_mutexattr_setqueueorder
443 (attr
: access pthread_mutexattr_t
; order
: int
) return int
;
444 pragma Import
(C
, pthread_mutexattr_setqueueorder
);
446 function pthread_mutexattr_setceilingprio
447 (attr
: access pthread_mutexattr_t
; priority
: int
) return int
;
448 pragma Import
(C
, pthread_mutexattr_setceilingprio
);
452 -- Threads queueing order
454 MUTEX_PRIORITY
: constant := 0; -- wait in priority order
455 MUTEX_FIFO
: constant := 1; -- first-in-first-out
456 MUTEX_PRIORITY_INHERIT
: constant := 2; -- priority inhertance mutex
457 MUTEX_PRIORITY_CEILING
: constant := 3; -- priority ceiling mutex
459 -- Mutex debugging options
461 MUTEX_NO_DEBUG
: constant := 0; -- no debugging on mutex
462 MUTEX_DEBUG
: constant := 1; -- debugging is on
464 -- Mutex spin on lock operations
466 MUTEX_NO_SPIN
: constant := 0; -- no spin, try once only
467 MUTEX_SPIN_ONLY
: constant := -1; -- spin forever
468 -- cnt > 0, limited spin
469 -- Mutex sharing attributes
471 MUTEX_SHARED
: constant := 0; -- shared between processes
472 MUTEX_NOTSHARED
: constant := 1; -- not shared between processes
476 function pthread_mutex_init
477 (mutex
: access pthread_mutex_t
;
478 attr
: access pthread_mutexattr_t
) return int
;
479 pragma Import
(C
, pthread_mutex_init
, "pthread_mutex_init");
481 function pthread_mutex_destroy
482 (mutex
: access pthread_mutex_t
) return int
;
483 pragma Import
(C
, pthread_mutex_destroy
, "pthread_mutex_destroy");
485 function pthread_mutex_lock
486 (mutex
: access pthread_mutex_t
) return int
;
487 pragma Import
(C
, pthread_mutex_lock
, "pthread_mutex_lock");
489 function pthread_mutex_unlock
490 (mutex
: access pthread_mutex_t
) return int
;
491 pragma Import
(C
, pthread_mutex_unlock
, "pthread_mutex_unlock");
493 -- Condition Initialization / Destruction
495 function pthread_condattr_init
496 (attr
: access pthread_condattr_t
) return int
;
497 pragma Import
(C
, pthread_condattr_init
, "pthread_condattr_init");
499 function pthread_condattr_destroy
500 (attr
: access pthread_condattr_t
) return int
;
501 pragma Import
(C
, pthread_condattr_destroy
, "pthread_condattr_destroy");
503 -- Condition Attributes
505 COND_PRIORITY
: constant := 0; -- wait in priority order
506 COND_FIFO
: constant := 1; -- first-in-first-out
508 -- Condition debugging options
510 COND_NO_DEBUG
: constant := 0; -- no debugging on mutex
511 COND_DEBUG
: constant := 1; -- debugging is on
513 -- Condition sharing attributes
515 COND_SHARED
: constant := 0; -- shared between processes
516 COND_NOTSHARED
: constant := 1; -- not shared between processes
518 -- Condition Operations
520 function pthread_cond_init
521 (cond
: access pthread_cond_t
;
522 attr
: access pthread_condattr_t
) return int
;
523 pragma Import
(C
, pthread_cond_init
, "pthread_cond_init");
525 function pthread_cond_destroy
526 (cond
: access pthread_cond_t
) return int
;
527 pragma Import
(C
, pthread_cond_destroy
, "pthread_cond_destroy");
529 function pthread_cond_signal
(cond
: access pthread_cond_t
) return int
;
530 pragma Import
(C
, pthread_cond_signal
, "pthread_cond_signal");
532 function pthread_cond_wait
533 (cond
: access pthread_cond_t
;
534 mutex
: access pthread_mutex_t
) return int
;
535 pragma Import
(C
, pthread_cond_wait
, "pthread_cond_wait");
537 function pthread_cond_timedwait
538 (cond
: access pthread_cond_t
;
539 mutex
: access pthread_mutex_t
;
540 abstime
: access struct_timeval
) return int
;
541 pragma Import
(C
, pthread_cond_timedwait
, "pthread_cond_timedwait");
543 -- Thread-Specific Data
545 type foo_h_proc_1
is access procedure (value
: Address
);
547 function pthread_key_create
548 (key
: access pthread_key_t
; destructor
: foo_h_proc_1
) return int
;
549 pragma Import
(C
, pthread_key_create
, "pthread_key_create");
551 function pthread_setspecific
552 (key
: pthread_key_t
; value
: Address
) return int
;
553 pragma Import
(C
, pthread_setspecific
, "pthread_setspecific");
555 function pthread_getspecific
556 (key
: pthread_key_t
; value
: access Address
) return int
;
557 pragma Import
(C
, pthread_getspecific
, "pthread_getspecific");
559 type foo_h_proc_2
is access procedure;
561 function pthread_exec_begin
(init
: access pthread_init_struct
) return int
;
562 pragma Import
(C
, pthread_exec_begin
, "pthread_exec_begin");
564 function sproc_create
565 (sproc_id
: access sproc_t
;
566 attr
: access sproc_attr_t
;
567 start_routine
: sproc_start_addr
;
568 arg
: Address
) return int
;
569 pragma Import
(C
, sproc_create
, "sproc_create");
571 function sproc_self
return sproc_t
;
572 pragma Import
(C
, sproc_self
, "sproc_self");
574 -- if equal fast TRUE is returned - common case
575 -- if not equal thread resource must NOT be null in order to compare bits
578 -- Sproc attribute initialize / destroy
581 function sproc_attr_init
(attr
: access sproc_attr_t
) return int
;
582 pragma Import
(C
, sproc_attr_init
, "sproc_attr_init");
584 function sproc_attr_destroy
(attr
: access sproc_attr_t
) return int
;
585 pragma Import
(C
, sproc_attr_destroy
, "sproc_attr_destroy");
587 function sproc_attr_setresources
588 (attr
: access sproc_attr_t
; resources
: resource_t
) return int
;
589 pragma Import
(C
, sproc_attr_setresources
, "sproc_attr_setresources");
591 function sproc_attr_getresources
592 (attr
: access sproc_attr_t
;
593 resources
: access resource_t
) return int
;
594 pragma Import
(C
, sproc_attr_getresources
, "sproc_attr_getresources");
596 function sproc_attr_setcpu
597 (attr
: access sproc_attr_t
; cpu_num
: int
) return int
;
598 pragma Import
(C
, sproc_attr_setcpu
, "sproc_attr_setcpu");
600 function sproc_attr_getcpu
601 (attr
: access sproc_attr_t
; cpu_num
: access int
) return int
;
602 pragma Import
(C
, sproc_attr_getcpu
, "sproc_attr_getcpu");
604 function sproc_attr_setresident
605 (attr
: access sproc_attr_t
; resident
: int
) return int
;
606 pragma Import
(C
, sproc_attr_setresident
, "sproc_attr_setresident");
608 function sproc_attr_getresident
609 (attr
: access sproc_attr_t
; resident
: access int
) return int
;
610 pragma Import
(C
, sproc_attr_getresident
, "sproc_attr_getresident");
612 function sproc_attr_setname
613 (attr
: access sproc_attr_t
; name
: chars_ptr
) return int
;
614 pragma Import
(C
, sproc_attr_setname
, "sproc_attr_setname");
616 function sproc_attr_getname
617 (attr
: access sproc_attr_t
; name
: chars_ptr
) return int
;
618 pragma Import
(C
, sproc_attr_getname
, "sproc_attr_getname");
620 function sproc_attr_setstacksize
621 (attr
: access sproc_attr_t
; stacksize
: size_t
) return int
;
622 pragma Import
(C
, sproc_attr_setstacksize
, "sproc_attr_setstacksize");
624 function sproc_attr_getstacksize
625 (attr
: access sproc_attr_t
; stacksize
: access size_t
) return int
;
626 pragma Import
(C
, sproc_attr_getstacksize
, "sproc_attr_getstacksize");
628 function sproc_attr_setprio
629 (attr
: access sproc_attr_t
; priority
: int
) return int
;
630 pragma Import
(C
, sproc_attr_setprio
, "sproc_attr_setprio");
632 function sproc_attr_getprio
633 (attr
: access sproc_attr_t
; priority
: access int
) return int
;
634 pragma Import
(C
, sproc_attr_getprio
, "sproc_attr_getprio");
636 function sproc_attr_setbthread
637 (attr
: access sproc_attr_t
; bthread
: ptcb_p
) return int
;
638 pragma Import
(C
, sproc_attr_setbthread
, "sproc_attr_setbthread");
640 function sproc_attr_getbthread
641 (attr
: access sproc_attr_t
; bthread
: access ptcb_p
) return int
;
642 pragma Import
(C
, sproc_attr_getbthread
, "sproc_attr_getbthread");
644 SPROC_NO_RESOURCES
: constant := 0;
645 SPROC_ANY_CPU
: constant := -1;
646 SPROC_MY_PRIORITY
: constant := -1;
647 SPROC_SWAPPED
: constant := 0;
648 SPROC_RESIDENT
: constant := 1;
650 type isr_address
is access procedure;
652 function intr_attach
(sig
: int
; isr
: isr_address
) return int
;
653 pragma Import
(C
, intr_attach
, "intr_attach");
655 Intr_Attach_Reset
: constant Boolean := False;
656 -- True if intr_attach is reset after an interrupt handler is called
658 function intr_exchange
661 oisr
: access isr_address
) return int
;
662 pragma Import
(C
, intr_exchange
, "intr_exchange");
664 function intr_current_isr
666 oisr
: access isr_address
)
668 pragma Import
(C
, intr_current_isr
, "intr_current_isr");
672 type clockid_t
is new int
;
674 CLOCK_REALTIME
: constant clockid_t
:= 1;
675 CLOCK_SGI_CYCLE
: constant clockid_t
:= 2;
676 CLOCK_SGI_FAST
: constant clockid_t
:= 3;
678 type pthread_t
is new Address
; -- thread identifier
679 type pthread_mutex_t
is new Address
; -- mutex identifier
680 type pthread_cond_t
is new Address
; -- cond identifier
681 type pthread_attr_t
is new Address
; -- pthread attributes
682 type pthread_mutexattr_t
is new Address
; -- mutex attributes
683 type pthread_condattr_t
is new Address
; -- mutex attributes
684 type sem_t
is new Address
; -- semaphore identifier
685 type pthread_key_t
is new Address
; -- per thread key
687 type sigbits_t
is array (Integer range 0 .. 3) of unsigned
;
688 type sigset_t
is record
691 pragma Convention
(C
, sigset_t
);
693 type pid_t
is new long
;
695 end System
.OS_Interface
;