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 --
11 -- Copyright (C) 1997-2001 Free Software Foundation, Inc. --
13 -- GNARL is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNARL; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
24 -- As a special exception, if other files instantiate generics from this --
25 -- unit, or you link this unit with other files to produce an executable, --
26 -- this unit does not by itself cause the resulting executable to be --
27 -- covered by the GNU General Public License. This exception does not --
28 -- however invalidate any other reasons why the executable file might be --
29 -- covered by the GNU Public License. --
31 -- GNARL was developed by the GNARL team at Florida State University. --
32 -- Extensive contributions were provided by Ada Core Technologies Inc. --
34 ------------------------------------------------------------------------------
36 -- This is an Irix (old pthread library) version of this package.
38 -- This package encapsulates all direct interfaces to OS services
39 -- that are needed by children of System.
41 -- PLEASE DO NOT add any with-clauses to this package
42 -- or remove the pragma Elaborate_Body.
43 -- It is designed to be a bottom-level (leaf) package.
47 with Interfaces
.C
.Strings
;
49 package System
.OS_Interface
is
53 pragma Linker_Options
("-lathread");
55 subtype int
is Interfaces
.C
.int
;
56 subtype short
is Interfaces
.C
.short
;
57 subtype long
is Interfaces
.C
.long
;
58 subtype unsigned
is Interfaces
.C
.unsigned
;
59 subtype unsigned_short
is Interfaces
.C
.unsigned_short
;
60 subtype unsigned_long
is Interfaces
.C
.unsigned_long
;
61 subtype unsigned_char
is Interfaces
.C
.unsigned_char
;
62 subtype plain_char
is Interfaces
.C
.plain_char
;
63 subtype size_t
is Interfaces
.C
.size_t
;
64 subtype chars_ptr
is Interfaces
.C
.Strings
.chars_ptr
;
70 function errno
return int
;
71 pragma Import
(C
, errno
, "__get_errno");
73 EINTR
: constant := 4; -- interrupted system call
74 EAGAIN
: constant := 11; -- No more processes
75 ENOMEM
: constant := 12; -- Not enough core
76 EINVAL
: constant := 22; -- Invalid argument
77 ETIMEDOUT
: constant := 145; -- Connection timed out
83 Max_Interrupt
: constant := 64;
84 type Signal
is new int
range 0 .. Max_Interrupt
;
85 for Signal
'Size use int
'Size;
87 SIGHUP
: constant := 1; -- hangup
88 SIGINT
: constant := 2; -- interrupt (rubout)
89 SIGQUIT
: constant := 3; -- quit (ASCD FS)
90 SIGILL
: constant := 4; -- illegal instruction (not reset)
91 SIGTRAP
: constant := 5; -- trace trap (not reset)
92 SIGIOT
: constant := 6; -- IOT instruction
93 SIGABRT
: constant := 6; -- used by abort, replace SIGIOT in the
95 SIGEMT
: constant := 7; -- EMT instruction
96 SIGFPE
: constant := 8; -- floating point exception
97 SIGKILL
: constant := 9; -- kill (cannot be caught or ignored)
98 SIGBUS
: constant := 10; -- bus error
99 SIGSEGV
: constant := 11; -- segmentation violation
100 SIGSYS
: constant := 12; -- bad argument to system call
101 SIGPIPE
: constant := 13; -- write on a pipe with no one to read it
102 SIGALRM
: constant := 14; -- alarm clock
103 SIGTERM
: constant := 15; -- software termination signal from kill
104 SIGUSR1
: constant := 16; -- user defined signal 1
105 SIGUSR2
: constant := 17; -- user defined signal 2
106 SIGCLD
: constant := 18; -- alias for SIGCHLD
107 SIGCHLD
: constant := 18; -- child status change
108 SIGPWR
: constant := 19; -- power-fail restart
109 SIGWINCH
: constant := 20; -- window size change
110 SIGURG
: constant := 21; -- urgent condition on IO channel
111 SIGPOLL
: constant := 22; -- pollable event occurred
112 SIGIO
: constant := 22; -- I/O possible (Solaris SIGPOLL alias)
113 SIGSTOP
: constant := 23; -- stop (cannot be caught or ignored)
114 SIGTSTP
: constant := 24; -- user stop requested from tty
115 SIGCONT
: constant := 25; -- stopped process has been continued
116 SIGTTIN
: constant := 26; -- background tty read attempted
117 SIGTTOU
: constant := 27; -- background tty write attempted
118 SIGVTALRM
: constant := 28; -- virtual timer expired
119 SIGPROF
: constant := 29; -- profiling timer expired
120 SIGXCPU
: constant := 30; -- CPU time limit exceeded
121 SIGXFSZ
: constant := 31; -- filesize limit exceeded
122 SIGK32
: constant := 32; -- reserved for kernel (IRIX)
123 SIGCKPT
: constant := 33; -- Checkpoint warning
124 SIGRESTART
: constant := 34; -- Restart warning
125 SIGUME
: constant := 35; -- Uncorrectable memory error
126 -- Signals defined for Posix 1003.1c.
127 SIGPTINTR
: constant := 47;
128 SIGPTRESCHED
: constant := 48;
129 -- Posix 1003.1b signals
130 SIGRTMIN
: constant := 49; -- Posix 1003.1b signals
131 SIGRTMAX
: constant := 64; -- Posix 1003.1b signals
133 type sigset_t
is private;
134 type sigset_t_ptr
is access all sigset_t
;
136 function sigaddset
(set
: access sigset_t
; sig
: Signal
) return int
;
137 pragma Import
(C
, sigaddset
, "sigaddset");
139 function sigdelset
(set
: access sigset_t
; sig
: Signal
) return int
;
140 pragma Import
(C
, sigdelset
, "sigdelset");
142 function sigfillset
(set
: access sigset_t
) return int
;
143 pragma Import
(C
, sigfillset
, "sigfillset");
145 function sigismember
(set
: access sigset_t
; sig
: Signal
) return int
;
146 pragma Import
(C
, sigismember
, "sigismember");
148 function sigemptyset
(set
: access sigset_t
) return int
;
149 pragma Import
(C
, sigemptyset
, "sigemptyset");
151 type siginfo_t
is record
155 bit_field_substitute_1
: String (1 .. 116);
157 pragma Convention
(C
, siginfo_t
);
159 type array_type_2
is array (Integer range 0 .. 1) of int
;
160 type struct_sigaction
is record
162 sa_handler
: System
.Address
;
164 sa_resv
: array_type_2
;
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;
178 act
: struct_sigaction_ptr
;
179 oact
: struct_sigaction_ptr
:= null) return int
;
180 pragma Import
(C
, sigaction
, "sigaction");
186 type time_t
is new int
;
188 type timespec
is record
192 pragma Convention
(C
, timespec
);
193 type timespec_ptr
is access all timespec
;
195 function To_Duration
(TS
: timespec
) return Duration;
196 pragma Inline
(To_Duration
);
198 function To_Timespec
(D
: Duration) return timespec
;
199 pragma Inline
(To_Timespec
);
201 type timer_t
is new Integer;
202 type clockid_t
is private;
204 CLOCK_REALTIME
: constant clockid_t
;
205 CLOCK_SGI_FAST
: constant clockid_t
;
206 CLOCK_SGI_CYCLE
: constant clockid_t
;
208 SGI_CYCLECNTR_SIZE
: constant := 165;
209 function syssgi
(request
: Interfaces
.C
.int
) return Interfaces
.C
.ptrdiff_t
;
211 pragma Import
(C
, syssgi
, "syssgi");
213 function clock_gettime
214 (clock_id
: clockid_t
;
215 tp
: access timespec
) return int
;
216 pragma Import
(C
, clock_gettime
, "clock_gettime");
218 function clock_getres
219 (clock_id
: clockid_t
; tp
: access timespec
) return int
;
220 pragma Import
(C
, clock_getres
, "clock_getres");
222 type struct_timeval
is record
226 pragma Convention
(C
, struct_timeval
);
228 function To_Duration
(TV
: struct_timeval
) return Duration;
229 pragma Inline
(To_Duration
);
231 function To_Timeval
(D
: Duration) return struct_timeval
;
232 pragma Inline
(To_Timeval
);
234 function gettimeofday
235 (tv
: access struct_timeval
;
236 tz
: System
.Address
:= System
.Null_Address
) return int
;
237 pragma Import
(C
, gettimeofday
, "gettimeofday");
239 -------------------------
240 -- Priority Scheduling --
241 -------------------------
243 SCHED_FIFO
: constant := 0;
244 SCHED_RR
: constant := 0;
245 SCHED_OTHER
: constant := 0;
251 type pid_t
is private;
253 function kill
(pid
: pid_t
; sig
: Signal
) return int
;
254 pragma Import
(C
, kill
, "kill");
256 function getpid
return pid_t
;
257 pragma Import
(C
, getpid
, "getpid");
259 ---------------------------------------
260 -- Nonstandard Thread Initialization --
261 ---------------------------------------
263 procedure pthread_init
;
264 pragma Inline
(pthread_init
);
265 -- This is a dummy procedure to share some GNULLI files
271 type Thread_Body
is access
272 function (arg
: System
.Address
) return System
.Address
;
274 type pthread_t
is private; -- thread identifier
275 subtype Thread_Id
is pthread_t
;
277 type pthread_mutex_t
is private; -- mutex identifier
278 type pthread_cond_t
is private; -- cond identifier
279 type pthread_attr_t
is private; -- pthread attributes
280 type pthread_mutexattr_t
is private; -- mutex attributes
281 type pthread_condattr_t
is private; -- mutex attributes
282 type sem_t
is private; -- semaphore identifier
283 type pthread_key_t
is private; -- per thread key
285 subtype pthread_once_t
is int
; -- dynamic package initialization
286 subtype resource_t
is long
; -- sproc. resource info.
287 type start_addr
is access function (arg
: Address
) return Address
;
288 type sproc_start_addr
is access function (arg
: Address
) return int
;
290 access function (arg
: Address
; arg1
: Address
) return Address
;
292 -- SGI specific types
294 subtype sproc_t
is Address
; -- sproc identifier
295 subtype sproc_attr_t
is Address
; -- sproc attributes
297 subtype spcb_p
is Address
;
298 subtype ptcb_p
is Address
;
300 -- Pthread Error Types
302 FUNC_OK
: constant := 0;
303 FUNC_ERR
: constant := -1;
305 -- pthread run-time initialization data structure
307 type pthread_init_struct
is record
308 conf_initsize
: int
; -- shared area size
309 max_sproc_count
: int
; -- maximum number of sprocs
310 sproc_stack_size
: size_t
; -- sproc stack size
311 os_default_priority
: int
; -- default IRIX pri for main process
312 os_sched_signal
: int
; -- default OS scheduling signal
313 guard_pages
: int
; -- number of guard pages per stack
314 init_sproc_count
: int
; -- initial number of sprocs
318 -- Pthread Attribute Initialize / Destroy
321 function pthread_attr_init
(attr
: access pthread_attr_t
) return int
;
322 pragma Import
(C
, pthread_attr_init
, "pthread_attr_init");
324 function pthread_attr_destroy
(attr
: access pthread_attr_t
) return int
;
325 pragma Import
(C
, pthread_attr_destroy
, "pthread_attr_destroy");
331 function pthread_attr_setstacksize
332 (attr
: access pthread_attr_t
; stacksize
: size_t
) return int
;
333 pragma Import
(C
, pthread_attr_setstacksize
, "pthread_attr_setstacksize");
335 function pthread_attr_setdetachstate
336 (attr
: access pthread_attr_t
; detachstate
: int
) return int
;
337 pragma Import
(C
, pthread_attr_setdetachstate
);
339 function pthread_attr_setname
340 (attr
: access pthread_attr_t
; name
: chars_ptr
) return int
;
341 pragma Import
(C
, pthread_attr_setname
, "pthread_attr_setname");
344 -- Thread Scheduling Attributes
347 function pthread_attr_setscope
348 (attr
: access pthread_attr_t
; contentionscope
: int
) return int
;
349 pragma Import
(C
, pthread_attr_setscope
, "pthread_attr_setscope");
351 function pthread_attr_setinheritsched
352 (attr
: access pthread_attr_t
; inherit
: int
) return int
;
354 (C
, pthread_attr_setinheritsched
, "pthread_attr_setinheritsched");
356 function pthread_attr_setsched
357 (attr
: access pthread_attr_t
; scheduler
: int
) return int
;
358 pragma Import
(C
, pthread_attr_setsched
, "pthread_attr_setsched");
360 function pthread_attr_setprio
361 (attr
: access pthread_attr_t
; priority
: int
) return int
;
362 pragma Import
(C
, pthread_attr_setprio
, "pthread_attr_setprio");
365 -- SGI Extensions to Thread Attributes
368 -- Bound to sproc attribute values
370 PTHREAD_BOUND
: constant := 1;
371 PTHREAD_NOT_BOUND
: constant := 0;
373 function pthread_attr_setresources
374 (attr
: access pthread_attr_t
; resources
: resource_t
) return int
;
375 pragma Import
(C
, pthread_attr_setresources
, "pthread_attr_setresources");
377 function pthread_attr_set_boundtosproc
378 (attr
: access pthread_attr_t
; bound_to_sproc
: int
) return int
;
380 (C
, pthread_attr_set_boundtosproc
, "pthread_attr_set_boundtosproc");
382 function pthread_attr_set_bsproc
383 (attr
: access pthread_attr_t
; bsproc
: spcb_p
) return int
;
384 pragma Import
(C
, pthread_attr_set_bsproc
, "pthread_attr_set_bsproc");
386 function pthread_attr_set_tslice
387 (attr
: access pthread_attr_t
;
388 ts_interval
: access struct_timeval
) return int
;
389 pragma Import
(C
, pthread_attr_set_tslice
, "pthread_attr_set_tslice");
392 -- Thread Creation & Management
395 function pthread_create
396 (thread
: access pthread_t
;
397 attr
: access pthread_attr_t
;
398 start_routine
: start_addr
;
399 arg
: Address
) return int
;
400 pragma Import
(C
, pthread_create
, "pthread_create");
402 procedure pthread_exit
(status
: Address
);
403 pragma Import
(C
, pthread_exit
, "pthread_exit");
405 procedure pthread_yield
(arg
: Address
:= System
.Null_Address
);
406 pragma Import
(C
, pthread_yield
, "pthread_yield");
408 function pthread_self
return pthread_t
;
409 pragma Import
(C
, pthread_self
, "pthread_self");
411 function pthread_kill
(thread
: pthread_t
; sig
: int
) return int
;
412 pragma Import
(C
, pthread_kill
, "pthread_kill");
415 -- SGI Extensions to POSIX thread operations
418 function pthread_setprio
(thread
: pthread_t
; priority
: int
) return int
;
419 pragma Import
(C
, pthread_setprio
, "pthread_setprio");
421 function pthread_suspend
(thread
: pthread_t
) return int
;
422 pragma Import
(C
, pthread_suspend
, "pthread_suspend");
424 function pthread_resume
(thread
: pthread_t
) return int
;
425 pragma Import
(C
, pthread_resume
, "pthread_resume");
427 function pthread_get_current_ada_tcb
return Address
;
428 pragma Import
(C
, pthread_get_current_ada_tcb
);
430 function pthread_set_ada_tcb
431 (thread
: pthread_t
; data
: Address
) return int
;
432 pragma Import
(C
, pthread_set_ada_tcb
, "pthread_set_ada_tcb");
434 -- Mutex Initialization / Destruction
436 function pthread_mutexattr_init
437 (attr
: access pthread_mutexattr_t
) return int
;
438 pragma Import
(C
, pthread_mutexattr_init
, "pthread_mutexattr_init");
440 function pthread_mutexattr_destroy
441 (attr
: access pthread_mutexattr_t
) return int
;
442 pragma Import
(C
, pthread_mutexattr_destroy
, "pthread_mutexattr_destroy");
444 function pthread_mutexattr_setqueueorder
445 (attr
: access pthread_mutexattr_t
; order
: int
) return int
;
446 pragma Import
(C
, pthread_mutexattr_setqueueorder
);
448 function pthread_mutexattr_setceilingprio
449 (attr
: access pthread_mutexattr_t
; priority
: int
) return int
;
450 pragma Import
(C
, pthread_mutexattr_setceilingprio
);
454 -- Threads queueing order
456 MUTEX_PRIORITY
: constant := 0; -- wait in priority order
457 MUTEX_FIFO
: constant := 1; -- first-in-first-out
458 MUTEX_PRIORITY_INHERIT
: constant := 2; -- priority inhertance mutex
459 MUTEX_PRIORITY_CEILING
: constant := 3; -- priority ceiling mutex
461 -- Mutex debugging options
463 MUTEX_NO_DEBUG
: constant := 0; -- no debugging on mutex
464 MUTEX_DEBUG
: constant := 1; -- debugging is on
466 -- Mutex spin on lock operations
468 MUTEX_NO_SPIN
: constant := 0; -- no spin, try once only
469 MUTEX_SPIN_ONLY
: constant := -1; -- spin forever
470 -- cnt > 0, limited spin
471 -- Mutex sharing attributes
473 MUTEX_SHARED
: constant := 0; -- shared between processes
474 MUTEX_NOTSHARED
: constant := 1; -- not shared between processes
478 function pthread_mutex_init
479 (mutex
: access pthread_mutex_t
;
480 attr
: access pthread_mutexattr_t
) return int
;
481 pragma Import
(C
, pthread_mutex_init
, "pthread_mutex_init");
483 function pthread_mutex_destroy
484 (mutex
: access pthread_mutex_t
) return int
;
485 pragma Import
(C
, pthread_mutex_destroy
, "pthread_mutex_destroy");
487 function pthread_mutex_lock
488 (mutex
: access pthread_mutex_t
) return int
;
489 pragma Import
(C
, pthread_mutex_lock
, "pthread_mutex_lock");
491 function pthread_mutex_unlock
492 (mutex
: access pthread_mutex_t
) return int
;
493 pragma Import
(C
, pthread_mutex_unlock
, "pthread_mutex_unlock");
495 -- Condition Initialization / Destruction
497 function pthread_condattr_init
498 (attr
: access pthread_condattr_t
) return int
;
499 pragma Import
(C
, pthread_condattr_init
, "pthread_condattr_init");
501 function pthread_condattr_destroy
502 (attr
: access pthread_condattr_t
) return int
;
503 pragma Import
(C
, pthread_condattr_destroy
, "pthread_condattr_destroy");
505 -- Condition Attributes
507 COND_PRIORITY
: constant := 0; -- wait in priority order
508 COND_FIFO
: constant := 1; -- first-in-first-out
510 -- Condition debugging options
512 COND_NO_DEBUG
: constant := 0; -- no debugging on mutex
513 COND_DEBUG
: constant := 1; -- debugging is on
515 -- Condition sharing attributes
517 COND_SHARED
: constant := 0; -- shared between processes
518 COND_NOTSHARED
: constant := 1; -- not shared between processes
520 -- Condition Operations
522 function pthread_cond_init
523 (cond
: access pthread_cond_t
;
524 attr
: access pthread_condattr_t
) return int
;
525 pragma Import
(C
, pthread_cond_init
, "pthread_cond_init");
527 function pthread_cond_destroy
528 (cond
: access pthread_cond_t
) return int
;
529 pragma Import
(C
, pthread_cond_destroy
, "pthread_cond_destroy");
531 function pthread_cond_signal
(cond
: access pthread_cond_t
) return int
;
532 pragma Import
(C
, pthread_cond_signal
, "pthread_cond_signal");
534 function pthread_cond_wait
535 (cond
: access pthread_cond_t
;
536 mutex
: access pthread_mutex_t
) return int
;
537 pragma Import
(C
, pthread_cond_wait
, "pthread_cond_wait");
539 function pthread_cond_timedwait
540 (cond
: access pthread_cond_t
;
541 mutex
: access pthread_mutex_t
;
542 abstime
: access struct_timeval
) return int
;
543 pragma Import
(C
, pthread_cond_timedwait
, "pthread_cond_timedwait");
545 -- Thread-Specific Data
547 type foo_h_proc_1
is access procedure (value
: Address
);
549 function pthread_key_create
550 (key
: access pthread_key_t
; destructor
: foo_h_proc_1
) return int
;
551 pragma Import
(C
, pthread_key_create
, "pthread_key_create");
553 function pthread_setspecific
554 (key
: pthread_key_t
; value
: Address
) return int
;
555 pragma Import
(C
, pthread_setspecific
, "pthread_setspecific");
557 function pthread_getspecific
558 (key
: pthread_key_t
; value
: access Address
) return int
;
559 pragma Import
(C
, pthread_getspecific
, "pthread_getspecific");
561 type foo_h_proc_2
is access procedure;
563 function pthread_exec_begin
(init
: access pthread_init_struct
) return int
;
564 pragma Import
(C
, pthread_exec_begin
, "pthread_exec_begin");
566 function sproc_create
567 (sproc_id
: access sproc_t
;
568 attr
: access sproc_attr_t
;
569 start_routine
: sproc_start_addr
;
570 arg
: Address
) return int
;
571 pragma Import
(C
, sproc_create
, "sproc_create");
573 function sproc_self
return sproc_t
;
574 pragma Import
(C
, sproc_self
, "sproc_self");
576 -- if equal fast TRUE is returned - common case
577 -- if not equal thread resource must NOT be null in order to compare bits
580 -- Sproc attribute initialize / destroy
583 function sproc_attr_init
(attr
: access sproc_attr_t
) return int
;
584 pragma Import
(C
, sproc_attr_init
, "sproc_attr_init");
586 function sproc_attr_destroy
(attr
: access sproc_attr_t
) return int
;
587 pragma Import
(C
, sproc_attr_destroy
, "sproc_attr_destroy");
589 function sproc_attr_setresources
590 (attr
: access sproc_attr_t
; resources
: resource_t
) return int
;
591 pragma Import
(C
, sproc_attr_setresources
, "sproc_attr_setresources");
593 function sproc_attr_getresources
594 (attr
: access sproc_attr_t
;
595 resources
: access resource_t
) return int
;
596 pragma Import
(C
, sproc_attr_getresources
, "sproc_attr_getresources");
598 function sproc_attr_setcpu
599 (attr
: access sproc_attr_t
; cpu_num
: int
) return int
;
600 pragma Import
(C
, sproc_attr_setcpu
, "sproc_attr_setcpu");
602 function sproc_attr_getcpu
603 (attr
: access sproc_attr_t
; cpu_num
: access int
) return int
;
604 pragma Import
(C
, sproc_attr_getcpu
, "sproc_attr_getcpu");
606 function sproc_attr_setresident
607 (attr
: access sproc_attr_t
; resident
: int
) return int
;
608 pragma Import
(C
, sproc_attr_setresident
, "sproc_attr_setresident");
610 function sproc_attr_getresident
611 (attr
: access sproc_attr_t
; resident
: access int
) return int
;
612 pragma Import
(C
, sproc_attr_getresident
, "sproc_attr_getresident");
614 function sproc_attr_setname
615 (attr
: access sproc_attr_t
; name
: chars_ptr
) return int
;
616 pragma Import
(C
, sproc_attr_setname
, "sproc_attr_setname");
618 function sproc_attr_getname
619 (attr
: access sproc_attr_t
; name
: chars_ptr
) return int
;
620 pragma Import
(C
, sproc_attr_getname
, "sproc_attr_getname");
622 function sproc_attr_setstacksize
623 (attr
: access sproc_attr_t
; stacksize
: size_t
) return int
;
624 pragma Import
(C
, sproc_attr_setstacksize
, "sproc_attr_setstacksize");
626 function sproc_attr_getstacksize
627 (attr
: access sproc_attr_t
; stacksize
: access size_t
) return int
;
628 pragma Import
(C
, sproc_attr_getstacksize
, "sproc_attr_getstacksize");
630 function sproc_attr_setprio
631 (attr
: access sproc_attr_t
; priority
: int
) return int
;
632 pragma Import
(C
, sproc_attr_setprio
, "sproc_attr_setprio");
634 function sproc_attr_getprio
635 (attr
: access sproc_attr_t
; priority
: access int
) return int
;
636 pragma Import
(C
, sproc_attr_getprio
, "sproc_attr_getprio");
638 function sproc_attr_setbthread
639 (attr
: access sproc_attr_t
; bthread
: ptcb_p
) return int
;
640 pragma Import
(C
, sproc_attr_setbthread
, "sproc_attr_setbthread");
642 function sproc_attr_getbthread
643 (attr
: access sproc_attr_t
; bthread
: access ptcb_p
) return int
;
644 pragma Import
(C
, sproc_attr_getbthread
, "sproc_attr_getbthread");
646 SPROC_NO_RESOURCES
: constant := 0;
647 SPROC_ANY_CPU
: constant := -1;
648 SPROC_MY_PRIORITY
: constant := -1;
649 SPROC_SWAPPED
: constant := 0;
650 SPROC_RESIDENT
: constant := 1;
652 type isr_address
is access procedure;
654 function intr_attach
(sig
: int
; isr
: isr_address
) return int
;
655 pragma Import
(C
, intr_attach
, "intr_attach");
657 Intr_Attach_Reset
: constant Boolean := False;
658 -- True if intr_attach is reset after an interrupt handler is called
660 function intr_exchange
663 oisr
: access isr_address
) return int
;
664 pragma Import
(C
, intr_exchange
, "intr_exchange");
666 function intr_current_isr
668 oisr
: access isr_address
)
670 pragma Import
(C
, intr_current_isr
, "intr_current_isr");
674 type clockid_t
is new int
;
676 CLOCK_REALTIME
: constant clockid_t
:= 1;
677 CLOCK_SGI_CYCLE
: constant clockid_t
:= 2;
678 CLOCK_SGI_FAST
: constant clockid_t
:= 3;
680 type pthread_t
is new Address
; -- thread identifier
681 type pthread_mutex_t
is new Address
; -- mutex identifier
682 type pthread_cond_t
is new Address
; -- cond identifier
683 type pthread_attr_t
is new Address
; -- pthread attributes
684 type pthread_mutexattr_t
is new Address
; -- mutex attributes
685 type pthread_condattr_t
is new Address
; -- mutex attributes
686 type sem_t
is new Address
; -- semaphore identifier
687 type pthread_key_t
is new Address
; -- per thread key
689 type sigbits_t
is array (Integer range 0 .. 3) of unsigned
;
690 type sigset_t
is record
693 pragma Convention
(C
, sigset_t
);
695 type pid_t
is new long
;
697 end System
.OS_Interface
;