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 --
10 -- Copyright (C) 1997-2001 Free Software Foundation, Inc. --
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, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
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. --
30 -- GNARL was developed by the GNARL team at Florida State University. --
31 -- Extensive contributions were provided by Ada Core Technologies Inc. --
33 ------------------------------------------------------------------------------
35 -- This is an Irix (old pthread library) 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
41 -- or remove the pragma Elaborate_Body.
42 -- It is designed to be a bottom-level (leaf) package.
46 with Interfaces
.C
.Strings
;
48 package System
.OS_Interface
is
52 pragma Linker_Options
("-lathread");
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 chars_ptr
is Interfaces
.C
.Strings
.chars_ptr
;
69 function errno
return int
;
70 pragma Import
(C
, errno
, "__get_errno");
72 EINTR
: constant := 4; -- interrupted system call
73 EAGAIN
: constant := 11; -- No more processes
74 ENOMEM
: constant := 12; -- Not enough core
75 EINVAL
: constant := 22; -- Invalid argument
76 ETIMEDOUT
: constant := 145; -- Connection timed out
82 Max_Interrupt
: constant := 64;
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 SIGIOT
: constant := 6; -- IOT instruction
92 SIGABRT
: constant := 6; -- used by abort, replace SIGIOT in the
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 SIGUSR1
: constant := 16; -- user defined signal 1
104 SIGUSR2
: constant := 17; -- user defined signal 2
105 SIGCLD
: constant := 18; -- alias for SIGCHLD
106 SIGCHLD
: constant := 18; -- child status change
107 SIGPWR
: constant := 19; -- power-fail restart
108 SIGWINCH
: constant := 20; -- window size change
109 SIGURG
: constant := 21; -- urgent condition on IO channel
110 SIGPOLL
: constant := 22; -- pollable event occurred
111 SIGIO
: constant := 22; -- I/O possible (Solaris SIGPOLL alias)
112 SIGSTOP
: constant := 23; -- stop (cannot be caught or ignored)
113 SIGTSTP
: constant := 24; -- user stop requested from tty
114 SIGCONT
: constant := 25; -- stopped process has been continued
115 SIGTTIN
: constant := 26; -- background tty read attempted
116 SIGTTOU
: constant := 27; -- background tty write attempted
117 SIGVTALRM
: constant := 28; -- virtual timer expired
118 SIGPROF
: constant := 29; -- profiling timer expired
119 SIGXCPU
: constant := 30; -- CPU time limit exceeded
120 SIGXFSZ
: constant := 31; -- filesize limit exceeded
121 SIGK32
: constant := 32; -- reserved for kernel (IRIX)
122 SIGCKPT
: constant := 33; -- Checkpoint warning
123 SIGRESTART
: constant := 34; -- Restart warning
124 SIGUME
: constant := 35; -- Uncorrectable memory error
125 -- Signals defined for Posix 1003.1c.
126 SIGPTINTR
: constant := 47;
127 SIGPTRESCHED
: constant := 48;
128 -- Posix 1003.1b signals
129 SIGRTMIN
: constant := 49; -- Posix 1003.1b signals
130 SIGRTMAX
: constant := 64; -- Posix 1003.1b signals
132 type sigset_t
is private;
133 type sigset_t_ptr
is access all sigset_t
;
135 function sigaddset
(set
: access sigset_t
; sig
: Signal
) return int
;
136 pragma Import
(C
, sigaddset
, "sigaddset");
138 function sigdelset
(set
: access sigset_t
; sig
: Signal
) return int
;
139 pragma Import
(C
, sigdelset
, "sigdelset");
141 function sigfillset
(set
: access sigset_t
) return int
;
142 pragma Import
(C
, sigfillset
, "sigfillset");
144 function sigismember
(set
: access sigset_t
; sig
: Signal
) return int
;
145 pragma Import
(C
, sigismember
, "sigismember");
147 function sigemptyset
(set
: access sigset_t
) return int
;
148 pragma Import
(C
, sigemptyset
, "sigemptyset");
150 type siginfo_t
is record
154 bit_field_substitute_1
: String (1 .. 116);
156 pragma Convention
(C
, siginfo_t
);
158 type array_type_2
is array (Integer range 0 .. 1) of int
;
159 type struct_sigaction
is record
161 sa_handler
: System
.Address
;
163 sa_resv
: array_type_2
;
165 pragma Convention
(C
, struct_sigaction
);
166 type struct_sigaction_ptr
is access all struct_sigaction
;
168 SIG_BLOCK
: constant := 1;
169 SIG_UNBLOCK
: constant := 2;
170 SIG_SETMASK
: constant := 3;
172 SIG_DFL
: constant := 0;
173 SIG_IGN
: constant := 1;
177 act
: struct_sigaction_ptr
;
178 oact
: struct_sigaction_ptr
:= null) return int
;
179 pragma Import
(C
, sigaction
, "sigaction");
185 type time_t
is new int
;
187 type timespec
is record
191 pragma Convention
(C
, timespec
);
192 type timespec_ptr
is access all timespec
;
194 function To_Duration
(TS
: timespec
) return Duration;
195 pragma Inline
(To_Duration
);
197 function To_Timespec
(D
: Duration) return timespec
;
198 pragma Inline
(To_Timespec
);
200 type timer_t
is new Integer;
201 type clockid_t
is private;
203 CLOCK_REALTIME
: constant clockid_t
;
204 CLOCK_SGI_FAST
: constant clockid_t
;
205 CLOCK_SGI_CYCLE
: constant clockid_t
;
207 SGI_CYCLECNTR_SIZE
: constant := 165;
208 function syssgi
(request
: Interfaces
.C
.int
) return Interfaces
.C
.ptrdiff_t
;
210 pragma Import
(C
, syssgi
, "syssgi");
212 function clock_gettime
213 (clock_id
: clockid_t
;
214 tp
: access timespec
) return int
;
215 pragma Import
(C
, clock_gettime
, "clock_gettime");
217 function clock_getres
218 (clock_id
: clockid_t
; tp
: access timespec
) return int
;
219 pragma Import
(C
, clock_getres
, "clock_getres");
221 type struct_timeval
is record
225 pragma Convention
(C
, struct_timeval
);
227 function To_Duration
(TV
: struct_timeval
) return Duration;
228 pragma Inline
(To_Duration
);
230 function To_Timeval
(D
: Duration) return struct_timeval
;
231 pragma Inline
(To_Timeval
);
233 function gettimeofday
234 (tv
: access struct_timeval
;
235 tz
: System
.Address
:= System
.Null_Address
) return int
;
236 pragma Import
(C
, gettimeofday
, "gettimeofday");
238 -------------------------
239 -- Priority Scheduling --
240 -------------------------
242 SCHED_FIFO
: constant := 0;
243 SCHED_RR
: constant := 0;
244 SCHED_OTHER
: constant := 0;
250 type pid_t
is private;
252 function kill
(pid
: pid_t
; sig
: Signal
) return int
;
253 pragma Import
(C
, kill
, "kill");
255 function getpid
return pid_t
;
256 pragma Import
(C
, getpid
, "getpid");
258 ---------------------------------------
259 -- Nonstandard Thread Initialization --
260 ---------------------------------------
262 procedure pthread_init
;
263 pragma Inline
(pthread_init
);
264 -- This is a dummy procedure to share some GNULLI files
270 type Thread_Body
is access
271 function (arg
: System
.Address
) return System
.Address
;
273 type pthread_t
is private; -- thread identifier
274 subtype Thread_Id
is pthread_t
;
276 type pthread_mutex_t
is private; -- mutex identifier
277 type pthread_cond_t
is private; -- cond identifier
278 type pthread_attr_t
is private; -- pthread attributes
279 type pthread_mutexattr_t
is private; -- mutex attributes
280 type pthread_condattr_t
is private; -- mutex attributes
281 type sem_t
is private; -- semaphore identifier
282 type pthread_key_t
is private; -- per thread key
284 subtype pthread_once_t
is int
; -- dynamic package initialization
285 subtype resource_t
is long
; -- sproc. resource info.
286 type start_addr
is access function (arg
: Address
) return Address
;
287 type sproc_start_addr
is access function (arg
: Address
) return int
;
289 access function (arg
: Address
; arg1
: Address
) return Address
;
291 -- SGI specific types
293 subtype sproc_t
is Address
; -- sproc identifier
294 subtype sproc_attr_t
is Address
; -- sproc attributes
296 subtype spcb_p
is Address
;
297 subtype ptcb_p
is Address
;
299 -- Pthread Error Types
301 FUNC_OK
: constant := 0;
302 FUNC_ERR
: constant := -1;
304 -- pthread run-time initialization data structure
306 type pthread_init_struct
is record
307 conf_initsize
: int
; -- shared area size
308 max_sproc_count
: int
; -- maximum number of sprocs
309 sproc_stack_size
: size_t
; -- sproc stack size
310 os_default_priority
: int
; -- default IRIX pri for main process
311 os_sched_signal
: int
; -- default OS scheduling signal
312 guard_pages
: int
; -- number of guard pages per stack
313 init_sproc_count
: int
; -- initial number of sprocs
317 -- Pthread Attribute Initialize / Destroy
320 function pthread_attr_init
(attr
: access pthread_attr_t
) return int
;
321 pragma Import
(C
, pthread_attr_init
, "pthread_attr_init");
323 function pthread_attr_destroy
(attr
: access pthread_attr_t
) return int
;
324 pragma Import
(C
, pthread_attr_destroy
, "pthread_attr_destroy");
330 function pthread_attr_setstacksize
331 (attr
: access pthread_attr_t
; stacksize
: size_t
) return int
;
332 pragma Import
(C
, pthread_attr_setstacksize
, "pthread_attr_setstacksize");
334 function pthread_attr_setdetachstate
335 (attr
: access pthread_attr_t
; detachstate
: int
) return int
;
336 pragma Import
(C
, pthread_attr_setdetachstate
);
338 function pthread_attr_setname
339 (attr
: access pthread_attr_t
; name
: chars_ptr
) return int
;
340 pragma Import
(C
, pthread_attr_setname
, "pthread_attr_setname");
343 -- Thread Scheduling Attributes
346 function pthread_attr_setscope
347 (attr
: access pthread_attr_t
; contentionscope
: int
) return int
;
348 pragma Import
(C
, pthread_attr_setscope
, "pthread_attr_setscope");
350 function pthread_attr_setinheritsched
351 (attr
: access pthread_attr_t
; inherit
: int
) return int
;
353 (C
, pthread_attr_setinheritsched
, "pthread_attr_setinheritsched");
355 function pthread_attr_setsched
356 (attr
: access pthread_attr_t
; scheduler
: int
) return int
;
357 pragma Import
(C
, pthread_attr_setsched
, "pthread_attr_setsched");
359 function pthread_attr_setprio
360 (attr
: access pthread_attr_t
; priority
: int
) return int
;
361 pragma Import
(C
, pthread_attr_setprio
, "pthread_attr_setprio");
364 -- SGI Extensions to Thread Attributes
367 -- Bound to sproc attribute values
369 PTHREAD_BOUND
: constant := 1;
370 PTHREAD_NOT_BOUND
: constant := 0;
372 function pthread_attr_setresources
373 (attr
: access pthread_attr_t
; resources
: resource_t
) return int
;
374 pragma Import
(C
, pthread_attr_setresources
, "pthread_attr_setresources");
376 function pthread_attr_set_boundtosproc
377 (attr
: access pthread_attr_t
; bound_to_sproc
: int
) return int
;
379 (C
, pthread_attr_set_boundtosproc
, "pthread_attr_set_boundtosproc");
381 function pthread_attr_set_bsproc
382 (attr
: access pthread_attr_t
; bsproc
: spcb_p
) return int
;
383 pragma Import
(C
, pthread_attr_set_bsproc
, "pthread_attr_set_bsproc");
385 function pthread_attr_set_tslice
386 (attr
: access pthread_attr_t
;
387 ts_interval
: access struct_timeval
) return int
;
388 pragma Import
(C
, pthread_attr_set_tslice
, "pthread_attr_set_tslice");
391 -- Thread Creation & Management
394 function pthread_create
395 (thread
: access pthread_t
;
396 attr
: access pthread_attr_t
;
397 start_routine
: start_addr
;
398 arg
: Address
) return int
;
399 pragma Import
(C
, pthread_create
, "pthread_create");
401 procedure pthread_exit
(status
: Address
);
402 pragma Import
(C
, pthread_exit
, "pthread_exit");
404 procedure pthread_yield
(arg
: Address
:= System
.Null_Address
);
405 pragma Import
(C
, pthread_yield
, "pthread_yield");
407 function pthread_self
return pthread_t
;
408 pragma Import
(C
, pthread_self
, "pthread_self");
410 function pthread_kill
(thread
: pthread_t
; sig
: int
) return int
;
411 pragma Import
(C
, pthread_kill
, "pthread_kill");
414 -- SGI Extensions to POSIX thread operations
417 function pthread_setprio
(thread
: pthread_t
; priority
: int
) return int
;
418 pragma Import
(C
, pthread_setprio
, "pthread_setprio");
420 function pthread_suspend
(thread
: pthread_t
) return int
;
421 pragma Import
(C
, pthread_suspend
, "pthread_suspend");
423 function pthread_resume
(thread
: pthread_t
) return int
;
424 pragma Import
(C
, pthread_resume
, "pthread_resume");
426 function pthread_get_current_ada_tcb
return Address
;
427 pragma Import
(C
, pthread_get_current_ada_tcb
);
429 function pthread_set_ada_tcb
430 (thread
: pthread_t
; data
: Address
) return int
;
431 pragma Import
(C
, pthread_set_ada_tcb
, "pthread_set_ada_tcb");
433 -- Mutex Initialization / Destruction
435 function pthread_mutexattr_init
436 (attr
: access pthread_mutexattr_t
) return int
;
437 pragma Import
(C
, pthread_mutexattr_init
, "pthread_mutexattr_init");
439 function pthread_mutexattr_destroy
440 (attr
: access pthread_mutexattr_t
) return int
;
441 pragma Import
(C
, pthread_mutexattr_destroy
, "pthread_mutexattr_destroy");
443 function pthread_mutexattr_setqueueorder
444 (attr
: access pthread_mutexattr_t
; order
: int
) return int
;
445 pragma Import
(C
, pthread_mutexattr_setqueueorder
);
447 function pthread_mutexattr_setceilingprio
448 (attr
: access pthread_mutexattr_t
; priority
: int
) return int
;
449 pragma Import
(C
, pthread_mutexattr_setceilingprio
);
453 -- Threads queueing order
455 MUTEX_PRIORITY
: constant := 0; -- wait in priority order
456 MUTEX_FIFO
: constant := 1; -- first-in-first-out
457 MUTEX_PRIORITY_INHERIT
: constant := 2; -- priority inhertance mutex
458 MUTEX_PRIORITY_CEILING
: constant := 3; -- priority ceiling mutex
460 -- Mutex debugging options
462 MUTEX_NO_DEBUG
: constant := 0; -- no debugging on mutex
463 MUTEX_DEBUG
: constant := 1; -- debugging is on
465 -- Mutex spin on lock operations
467 MUTEX_NO_SPIN
: constant := 0; -- no spin, try once only
468 MUTEX_SPIN_ONLY
: constant := -1; -- spin forever
469 -- cnt > 0, limited spin
470 -- Mutex sharing attributes
472 MUTEX_SHARED
: constant := 0; -- shared between processes
473 MUTEX_NOTSHARED
: constant := 1; -- not shared between processes
477 function pthread_mutex_init
478 (mutex
: access pthread_mutex_t
;
479 attr
: access pthread_mutexattr_t
) return int
;
480 pragma Import
(C
, pthread_mutex_init
, "pthread_mutex_init");
482 function pthread_mutex_destroy
483 (mutex
: access pthread_mutex_t
) return int
;
484 pragma Import
(C
, pthread_mutex_destroy
, "pthread_mutex_destroy");
486 function pthread_mutex_lock
487 (mutex
: access pthread_mutex_t
) return int
;
488 pragma Import
(C
, pthread_mutex_lock
, "pthread_mutex_lock");
490 function pthread_mutex_unlock
491 (mutex
: access pthread_mutex_t
) return int
;
492 pragma Import
(C
, pthread_mutex_unlock
, "pthread_mutex_unlock");
494 -- Condition Initialization / Destruction
496 function pthread_condattr_init
497 (attr
: access pthread_condattr_t
) return int
;
498 pragma Import
(C
, pthread_condattr_init
, "pthread_condattr_init");
500 function pthread_condattr_destroy
501 (attr
: access pthread_condattr_t
) return int
;
502 pragma Import
(C
, pthread_condattr_destroy
, "pthread_condattr_destroy");
504 -- Condition Attributes
506 COND_PRIORITY
: constant := 0; -- wait in priority order
507 COND_FIFO
: constant := 1; -- first-in-first-out
509 -- Condition debugging options
511 COND_NO_DEBUG
: constant := 0; -- no debugging on mutex
512 COND_DEBUG
: constant := 1; -- debugging is on
514 -- Condition sharing attributes
516 COND_SHARED
: constant := 0; -- shared between processes
517 COND_NOTSHARED
: constant := 1; -- not shared between processes
519 -- Condition Operations
521 function pthread_cond_init
522 (cond
: access pthread_cond_t
;
523 attr
: access pthread_condattr_t
) return int
;
524 pragma Import
(C
, pthread_cond_init
, "pthread_cond_init");
526 function pthread_cond_destroy
527 (cond
: access pthread_cond_t
) return int
;
528 pragma Import
(C
, pthread_cond_destroy
, "pthread_cond_destroy");
530 function pthread_cond_signal
(cond
: access pthread_cond_t
) return int
;
531 pragma Import
(C
, pthread_cond_signal
, "pthread_cond_signal");
533 function pthread_cond_wait
534 (cond
: access pthread_cond_t
;
535 mutex
: access pthread_mutex_t
) return int
;
536 pragma Import
(C
, pthread_cond_wait
, "pthread_cond_wait");
538 function pthread_cond_timedwait
539 (cond
: access pthread_cond_t
;
540 mutex
: access pthread_mutex_t
;
541 abstime
: access struct_timeval
) return int
;
542 pragma Import
(C
, pthread_cond_timedwait
, "pthread_cond_timedwait");
544 -- Thread-Specific Data
546 type foo_h_proc_1
is access procedure (value
: Address
);
548 function pthread_key_create
549 (key
: access pthread_key_t
; destructor
: foo_h_proc_1
) return int
;
550 pragma Import
(C
, pthread_key_create
, "pthread_key_create");
552 function pthread_setspecific
553 (key
: pthread_key_t
; value
: Address
) return int
;
554 pragma Import
(C
, pthread_setspecific
, "pthread_setspecific");
556 function pthread_getspecific
557 (key
: pthread_key_t
; value
: access Address
) return int
;
558 pragma Import
(C
, pthread_getspecific
, "pthread_getspecific");
560 type foo_h_proc_2
is access procedure;
562 function pthread_exec_begin
(init
: access pthread_init_struct
) return int
;
563 pragma Import
(C
, pthread_exec_begin
, "pthread_exec_begin");
565 function sproc_create
566 (sproc_id
: access sproc_t
;
567 attr
: access sproc_attr_t
;
568 start_routine
: sproc_start_addr
;
569 arg
: Address
) return int
;
570 pragma Import
(C
, sproc_create
, "sproc_create");
572 function sproc_self
return sproc_t
;
573 pragma Import
(C
, sproc_self
, "sproc_self");
575 -- if equal fast TRUE is returned - common case
576 -- if not equal thread resource must NOT be null in order to compare bits
579 -- Sproc attribute initialize / destroy
582 function sproc_attr_init
(attr
: access sproc_attr_t
) return int
;
583 pragma Import
(C
, sproc_attr_init
, "sproc_attr_init");
585 function sproc_attr_destroy
(attr
: access sproc_attr_t
) return int
;
586 pragma Import
(C
, sproc_attr_destroy
, "sproc_attr_destroy");
588 function sproc_attr_setresources
589 (attr
: access sproc_attr_t
; resources
: resource_t
) return int
;
590 pragma Import
(C
, sproc_attr_setresources
, "sproc_attr_setresources");
592 function sproc_attr_getresources
593 (attr
: access sproc_attr_t
;
594 resources
: access resource_t
) return int
;
595 pragma Import
(C
, sproc_attr_getresources
, "sproc_attr_getresources");
597 function sproc_attr_setcpu
598 (attr
: access sproc_attr_t
; cpu_num
: int
) return int
;
599 pragma Import
(C
, sproc_attr_setcpu
, "sproc_attr_setcpu");
601 function sproc_attr_getcpu
602 (attr
: access sproc_attr_t
; cpu_num
: access int
) return int
;
603 pragma Import
(C
, sproc_attr_getcpu
, "sproc_attr_getcpu");
605 function sproc_attr_setresident
606 (attr
: access sproc_attr_t
; resident
: int
) return int
;
607 pragma Import
(C
, sproc_attr_setresident
, "sproc_attr_setresident");
609 function sproc_attr_getresident
610 (attr
: access sproc_attr_t
; resident
: access int
) return int
;
611 pragma Import
(C
, sproc_attr_getresident
, "sproc_attr_getresident");
613 function sproc_attr_setname
614 (attr
: access sproc_attr_t
; name
: chars_ptr
) return int
;
615 pragma Import
(C
, sproc_attr_setname
, "sproc_attr_setname");
617 function sproc_attr_getname
618 (attr
: access sproc_attr_t
; name
: chars_ptr
) return int
;
619 pragma Import
(C
, sproc_attr_getname
, "sproc_attr_getname");
621 function sproc_attr_setstacksize
622 (attr
: access sproc_attr_t
; stacksize
: size_t
) return int
;
623 pragma Import
(C
, sproc_attr_setstacksize
, "sproc_attr_setstacksize");
625 function sproc_attr_getstacksize
626 (attr
: access sproc_attr_t
; stacksize
: access size_t
) return int
;
627 pragma Import
(C
, sproc_attr_getstacksize
, "sproc_attr_getstacksize");
629 function sproc_attr_setprio
630 (attr
: access sproc_attr_t
; priority
: int
) return int
;
631 pragma Import
(C
, sproc_attr_setprio
, "sproc_attr_setprio");
633 function sproc_attr_getprio
634 (attr
: access sproc_attr_t
; priority
: access int
) return int
;
635 pragma Import
(C
, sproc_attr_getprio
, "sproc_attr_getprio");
637 function sproc_attr_setbthread
638 (attr
: access sproc_attr_t
; bthread
: ptcb_p
) return int
;
639 pragma Import
(C
, sproc_attr_setbthread
, "sproc_attr_setbthread");
641 function sproc_attr_getbthread
642 (attr
: access sproc_attr_t
; bthread
: access ptcb_p
) return int
;
643 pragma Import
(C
, sproc_attr_getbthread
, "sproc_attr_getbthread");
645 SPROC_NO_RESOURCES
: constant := 0;
646 SPROC_ANY_CPU
: constant := -1;
647 SPROC_MY_PRIORITY
: constant := -1;
648 SPROC_SWAPPED
: constant := 0;
649 SPROC_RESIDENT
: constant := 1;
651 type isr_address
is access procedure;
653 function intr_attach
(sig
: int
; isr
: isr_address
) return int
;
654 pragma Import
(C
, intr_attach
, "intr_attach");
656 Intr_Attach_Reset
: constant Boolean := False;
657 -- True if intr_attach is reset after an interrupt handler is called
659 function intr_exchange
662 oisr
: access isr_address
) return int
;
663 pragma Import
(C
, intr_exchange
, "intr_exchange");
665 function intr_current_isr
667 oisr
: access isr_address
)
669 pragma Import
(C
, intr_current_isr
, "intr_current_isr");
673 type clockid_t
is new int
;
675 CLOCK_REALTIME
: constant clockid_t
:= 1;
676 CLOCK_SGI_CYCLE
: constant clockid_t
:= 2;
677 CLOCK_SGI_FAST
: constant clockid_t
:= 3;
679 type pthread_t
is new Address
; -- thread identifier
680 type pthread_mutex_t
is new Address
; -- mutex identifier
681 type pthread_cond_t
is new Address
; -- cond identifier
682 type pthread_attr_t
is new Address
; -- pthread attributes
683 type pthread_mutexattr_t
is new Address
; -- mutex attributes
684 type pthread_condattr_t
is new Address
; -- mutex attributes
685 type sem_t
is new Address
; -- semaphore identifier
686 type pthread_key_t
is new Address
; -- per thread key
688 type sigbits_t
is array (Integer range 0 .. 3) of unsigned
;
689 type sigset_t
is record
692 pragma Convention
(C
, sigset_t
);
694 type pid_t
is new long
;
696 end System
.OS_Interface
;