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) 1991-1994, Florida State University --
10 -- Copyright (C) 1995-2004, 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 or remove the pragma
41 -- Preelaborate. This package is designed to be a bottom-level (leaf) package.
45 with Interfaces
.C
.Strings
;
46 with Unchecked_Conversion
;
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 function Thread_Body_Access
is new
274 Unchecked_Conversion
(System
.Address
, Thread_Body
);
276 type pthread_t
is private; -- thread identifier
277 subtype Thread_Id
is pthread_t
;
279 type pthread_mutex_t
is private; -- mutex identifier
280 type pthread_cond_t
is private; -- cond identifier
281 type pthread_attr_t
is private; -- pthread attributes
282 type pthread_mutexattr_t
is private; -- mutex attributes
283 type pthread_condattr_t
is private; -- mutex attributes
284 type sem_t
is private; -- semaphore identifier
285 type pthread_key_t
is private; -- per thread key
287 subtype pthread_once_t
is int
; -- dynamic package initialization
288 subtype resource_t
is long
; -- sproc. resource info.
289 type start_addr
is access function (arg
: Address
) return Address
;
290 type sproc_start_addr
is access function (arg
: Address
) return int
;
292 access function (arg
: Address
; arg1
: Address
) return Address
;
294 -- SGI specific types
296 subtype sproc_t
is Address
; -- sproc identifier
297 subtype sproc_attr_t
is Address
; -- sproc attributes
299 subtype spcb_p
is Address
;
300 subtype ptcb_p
is Address
;
302 -- Pthread Error Types
304 FUNC_OK
: constant := 0;
305 FUNC_ERR
: constant := -1;
307 -- pthread run-time initialization data structure
309 type pthread_init_struct
is record
310 conf_initsize
: int
; -- shared area size
311 max_sproc_count
: int
; -- maximum number of sprocs
312 sproc_stack_size
: size_t
; -- sproc stack size
313 os_default_priority
: int
; -- default IRIX pri for main process
314 os_sched_signal
: int
; -- default OS scheduling signal
315 guard_pages
: int
; -- number of guard pages per stack
316 init_sproc_count
: int
; -- initial number of sprocs
320 -- Pthread Attribute Initialize / Destroy
323 function pthread_attr_init
(attr
: access pthread_attr_t
) return int
;
324 pragma Import
(C
, pthread_attr_init
, "pthread_attr_init");
326 function pthread_attr_destroy
(attr
: access pthread_attr_t
) return int
;
327 pragma Import
(C
, pthread_attr_destroy
, "pthread_attr_destroy");
333 function pthread_attr_setstacksize
334 (attr
: access pthread_attr_t
; stacksize
: size_t
) return int
;
335 pragma Import
(C
, pthread_attr_setstacksize
, "pthread_attr_setstacksize");
337 function pthread_attr_setdetachstate
338 (attr
: access pthread_attr_t
; detachstate
: int
) return int
;
339 pragma Import
(C
, pthread_attr_setdetachstate
);
341 function pthread_attr_setname
342 (attr
: access pthread_attr_t
; name
: chars_ptr
) return int
;
343 pragma Import
(C
, pthread_attr_setname
, "pthread_attr_setname");
346 -- Thread Scheduling Attributes
349 function pthread_attr_setscope
350 (attr
: access pthread_attr_t
; contentionscope
: int
) return int
;
351 pragma Import
(C
, pthread_attr_setscope
, "pthread_attr_setscope");
353 function pthread_attr_setinheritsched
354 (attr
: access pthread_attr_t
; inherit
: int
) return int
;
356 (C
, pthread_attr_setinheritsched
, "pthread_attr_setinheritsched");
358 function pthread_attr_setsched
359 (attr
: access pthread_attr_t
; scheduler
: int
) return int
;
360 pragma Import
(C
, pthread_attr_setsched
, "pthread_attr_setsched");
362 function pthread_attr_setprio
363 (attr
: access pthread_attr_t
; priority
: int
) return int
;
364 pragma Import
(C
, pthread_attr_setprio
, "pthread_attr_setprio");
367 -- SGI Extensions to Thread Attributes
370 -- Bound to sproc attribute values
372 PTHREAD_BOUND
: constant := 1;
373 PTHREAD_NOT_BOUND
: constant := 0;
375 function pthread_attr_setresources
376 (attr
: access pthread_attr_t
; resources
: resource_t
) return int
;
377 pragma Import
(C
, pthread_attr_setresources
, "pthread_attr_setresources");
379 function pthread_attr_set_boundtosproc
380 (attr
: access pthread_attr_t
; bound_to_sproc
: int
) return int
;
382 (C
, pthread_attr_set_boundtosproc
, "pthread_attr_set_boundtosproc");
384 function pthread_attr_set_bsproc
385 (attr
: access pthread_attr_t
; bsproc
: spcb_p
) return int
;
386 pragma Import
(C
, pthread_attr_set_bsproc
, "pthread_attr_set_bsproc");
388 function pthread_attr_set_tslice
389 (attr
: access pthread_attr_t
;
390 ts_interval
: access struct_timeval
) return int
;
391 pragma Import
(C
, pthread_attr_set_tslice
, "pthread_attr_set_tslice");
394 -- Thread Creation & Management
397 function pthread_create
398 (thread
: access pthread_t
;
399 attr
: access pthread_attr_t
;
400 start_routine
: start_addr
;
401 arg
: Address
) return int
;
402 pragma Import
(C
, pthread_create
, "pthread_create");
404 procedure pthread_exit
(status
: Address
);
405 pragma Import
(C
, pthread_exit
, "pthread_exit");
407 procedure pthread_yield
(arg
: Address
:= System
.Null_Address
);
408 pragma Import
(C
, pthread_yield
, "pthread_yield");
410 function pthread_self
return pthread_t
;
411 pragma Import
(C
, pthread_self
, "pthread_self");
413 function pthread_kill
(thread
: pthread_t
; sig
: int
) return int
;
414 pragma Import
(C
, pthread_kill
, "pthread_kill");
417 -- SGI Extensions to POSIX thread operations
420 function pthread_setprio
(thread
: pthread_t
; priority
: int
) return int
;
421 pragma Import
(C
, pthread_setprio
, "pthread_setprio");
423 function pthread_suspend
(thread
: pthread_t
) return int
;
424 pragma Import
(C
, pthread_suspend
, "pthread_suspend");
426 function pthread_resume
(thread
: pthread_t
) return int
;
427 pragma Import
(C
, pthread_resume
, "pthread_resume");
429 function pthread_get_current_ada_tcb
return Address
;
430 pragma Import
(C
, pthread_get_current_ada_tcb
);
432 function pthread_set_ada_tcb
433 (thread
: pthread_t
; data
: Address
) return int
;
434 pragma Import
(C
, pthread_set_ada_tcb
, "pthread_set_ada_tcb");
436 -- Mutex Initialization / Destruction
438 function pthread_mutexattr_init
439 (attr
: access pthread_mutexattr_t
) return int
;
440 pragma Import
(C
, pthread_mutexattr_init
, "pthread_mutexattr_init");
442 function pthread_mutexattr_destroy
443 (attr
: access pthread_mutexattr_t
) return int
;
444 pragma Import
(C
, pthread_mutexattr_destroy
, "pthread_mutexattr_destroy");
446 function pthread_mutexattr_setqueueorder
447 (attr
: access pthread_mutexattr_t
; order
: int
) return int
;
448 pragma Import
(C
, pthread_mutexattr_setqueueorder
);
450 function pthread_mutexattr_setceilingprio
451 (attr
: access pthread_mutexattr_t
; priority
: int
) return int
;
452 pragma Import
(C
, pthread_mutexattr_setceilingprio
);
456 -- Threads queueing order
458 MUTEX_PRIORITY
: constant := 0; -- wait in priority order
459 MUTEX_FIFO
: constant := 1; -- first-in-first-out
460 MUTEX_PRIORITY_INHERIT
: constant := 2; -- priority inhertance mutex
461 MUTEX_PRIORITY_CEILING
: constant := 3; -- priority ceiling mutex
463 -- Mutex debugging options
465 MUTEX_NO_DEBUG
: constant := 0; -- no debugging on mutex
466 MUTEX_DEBUG
: constant := 1; -- debugging is on
468 -- Mutex spin on lock operations
470 MUTEX_NO_SPIN
: constant := 0; -- no spin, try once only
471 MUTEX_SPIN_ONLY
: constant := -1; -- spin forever
472 -- cnt > 0, limited spin
473 -- Mutex sharing attributes
475 MUTEX_SHARED
: constant := 0; -- shared between processes
476 MUTEX_NOTSHARED
: constant := 1; -- not shared between processes
480 function pthread_mutex_init
481 (mutex
: access pthread_mutex_t
;
482 attr
: access pthread_mutexattr_t
) return int
;
483 pragma Import
(C
, pthread_mutex_init
, "pthread_mutex_init");
485 function pthread_mutex_destroy
486 (mutex
: access pthread_mutex_t
) return int
;
487 pragma Import
(C
, pthread_mutex_destroy
, "pthread_mutex_destroy");
489 function pthread_mutex_lock
490 (mutex
: access pthread_mutex_t
) return int
;
491 pragma Import
(C
, pthread_mutex_lock
, "pthread_mutex_lock");
493 function pthread_mutex_unlock
494 (mutex
: access pthread_mutex_t
) return int
;
495 pragma Import
(C
, pthread_mutex_unlock
, "pthread_mutex_unlock");
497 -- Condition Initialization / Destruction
499 function pthread_condattr_init
500 (attr
: access pthread_condattr_t
) return int
;
501 pragma Import
(C
, pthread_condattr_init
, "pthread_condattr_init");
503 function pthread_condattr_destroy
504 (attr
: access pthread_condattr_t
) return int
;
505 pragma Import
(C
, pthread_condattr_destroy
, "pthread_condattr_destroy");
507 -- Condition Attributes
509 COND_PRIORITY
: constant := 0; -- wait in priority order
510 COND_FIFO
: constant := 1; -- first-in-first-out
512 -- Condition debugging options
514 COND_NO_DEBUG
: constant := 0; -- no debugging on mutex
515 COND_DEBUG
: constant := 1; -- debugging is on
517 -- Condition sharing attributes
519 COND_SHARED
: constant := 0; -- shared between processes
520 COND_NOTSHARED
: constant := 1; -- not shared between processes
522 -- Condition Operations
524 function pthread_cond_init
525 (cond
: access pthread_cond_t
;
526 attr
: access pthread_condattr_t
) return int
;
527 pragma Import
(C
, pthread_cond_init
, "pthread_cond_init");
529 function pthread_cond_destroy
530 (cond
: access pthread_cond_t
) return int
;
531 pragma Import
(C
, pthread_cond_destroy
, "pthread_cond_destroy");
533 function pthread_cond_signal
(cond
: access pthread_cond_t
) return int
;
534 pragma Import
(C
, pthread_cond_signal
, "pthread_cond_signal");
536 function pthread_cond_wait
537 (cond
: access pthread_cond_t
;
538 mutex
: access pthread_mutex_t
) return int
;
539 pragma Import
(C
, pthread_cond_wait
, "pthread_cond_wait");
541 function pthread_cond_timedwait
542 (cond
: access pthread_cond_t
;
543 mutex
: access pthread_mutex_t
;
544 abstime
: access struct_timeval
) return int
;
545 pragma Import
(C
, pthread_cond_timedwait
, "pthread_cond_timedwait");
547 -- Thread-Specific Data
549 type foo_h_proc_1
is access procedure (value
: Address
);
551 function pthread_key_create
552 (key
: access pthread_key_t
; destructor
: foo_h_proc_1
) return int
;
553 pragma Import
(C
, pthread_key_create
, "pthread_key_create");
555 function pthread_setspecific
556 (key
: pthread_key_t
; value
: Address
) return int
;
557 pragma Import
(C
, pthread_setspecific
, "pthread_setspecific");
559 function pthread_getspecific
560 (key
: pthread_key_t
; value
: access Address
) return int
;
561 pragma Import
(C
, pthread_getspecific
, "pthread_getspecific");
563 type foo_h_proc_2
is access procedure;
565 function pthread_exec_begin
(init
: access pthread_init_struct
) return int
;
566 pragma Import
(C
, pthread_exec_begin
, "pthread_exec_begin");
568 function sproc_create
569 (sproc_id
: access sproc_t
;
570 attr
: access sproc_attr_t
;
571 start_routine
: sproc_start_addr
;
572 arg
: Address
) return int
;
573 pragma Import
(C
, sproc_create
, "sproc_create");
575 function sproc_self
return sproc_t
;
576 pragma Import
(C
, sproc_self
, "sproc_self");
578 -- if equal fast TRUE is returned - common case
579 -- if not equal thread resource must NOT be null in order to compare bits
582 -- Sproc attribute initialize / destroy
585 function sproc_attr_init
(attr
: access sproc_attr_t
) return int
;
586 pragma Import
(C
, sproc_attr_init
, "sproc_attr_init");
588 function sproc_attr_destroy
(attr
: access sproc_attr_t
) return int
;
589 pragma Import
(C
, sproc_attr_destroy
, "sproc_attr_destroy");
591 function sproc_attr_setresources
592 (attr
: access sproc_attr_t
; resources
: resource_t
) return int
;
593 pragma Import
(C
, sproc_attr_setresources
, "sproc_attr_setresources");
595 function sproc_attr_getresources
596 (attr
: access sproc_attr_t
;
597 resources
: access resource_t
) return int
;
598 pragma Import
(C
, sproc_attr_getresources
, "sproc_attr_getresources");
600 function sproc_attr_setcpu
601 (attr
: access sproc_attr_t
; cpu_num
: int
) return int
;
602 pragma Import
(C
, sproc_attr_setcpu
, "sproc_attr_setcpu");
604 function sproc_attr_getcpu
605 (attr
: access sproc_attr_t
; cpu_num
: access int
) return int
;
606 pragma Import
(C
, sproc_attr_getcpu
, "sproc_attr_getcpu");
608 function sproc_attr_setresident
609 (attr
: access sproc_attr_t
; resident
: int
) return int
;
610 pragma Import
(C
, sproc_attr_setresident
, "sproc_attr_setresident");
612 function sproc_attr_getresident
613 (attr
: access sproc_attr_t
; resident
: access int
) return int
;
614 pragma Import
(C
, sproc_attr_getresident
, "sproc_attr_getresident");
616 function sproc_attr_setname
617 (attr
: access sproc_attr_t
; name
: chars_ptr
) return int
;
618 pragma Import
(C
, sproc_attr_setname
, "sproc_attr_setname");
620 function sproc_attr_getname
621 (attr
: access sproc_attr_t
; name
: chars_ptr
) return int
;
622 pragma Import
(C
, sproc_attr_getname
, "sproc_attr_getname");
624 function sproc_attr_setstacksize
625 (attr
: access sproc_attr_t
; stacksize
: size_t
) return int
;
626 pragma Import
(C
, sproc_attr_setstacksize
, "sproc_attr_setstacksize");
628 function sproc_attr_getstacksize
629 (attr
: access sproc_attr_t
; stacksize
: access size_t
) return int
;
630 pragma Import
(C
, sproc_attr_getstacksize
, "sproc_attr_getstacksize");
632 function sproc_attr_setprio
633 (attr
: access sproc_attr_t
; priority
: int
) return int
;
634 pragma Import
(C
, sproc_attr_setprio
, "sproc_attr_setprio");
636 function sproc_attr_getprio
637 (attr
: access sproc_attr_t
; priority
: access int
) return int
;
638 pragma Import
(C
, sproc_attr_getprio
, "sproc_attr_getprio");
640 function sproc_attr_setbthread
641 (attr
: access sproc_attr_t
; bthread
: ptcb_p
) return int
;
642 pragma Import
(C
, sproc_attr_setbthread
, "sproc_attr_setbthread");
644 function sproc_attr_getbthread
645 (attr
: access sproc_attr_t
; bthread
: access ptcb_p
) return int
;
646 pragma Import
(C
, sproc_attr_getbthread
, "sproc_attr_getbthread");
648 SPROC_NO_RESOURCES
: constant := 0;
649 SPROC_ANY_CPU
: constant := -1;
650 SPROC_MY_PRIORITY
: constant := -1;
651 SPROC_SWAPPED
: constant := 0;
652 SPROC_RESIDENT
: constant := 1;
654 type isr_address
is access procedure;
656 function intr_attach
(sig
: int
; isr
: isr_address
) return int
;
657 pragma Import
(C
, intr_attach
, "intr_attach");
659 Intr_Attach_Reset
: constant Boolean := False;
660 -- True if intr_attach is reset after an interrupt handler is called
662 function intr_exchange
665 oisr
: access isr_address
) return int
;
666 pragma Import
(C
, intr_exchange
, "intr_exchange");
668 function intr_current_isr
670 oisr
: access isr_address
)
672 pragma Import
(C
, intr_current_isr
, "intr_current_isr");
676 type clockid_t
is new int
;
678 CLOCK_REALTIME
: constant clockid_t
:= 1;
679 CLOCK_SGI_CYCLE
: constant clockid_t
:= 2;
680 CLOCK_SGI_FAST
: constant clockid_t
:= 3;
682 type pthread_t
is new Address
; -- thread identifier
683 type pthread_mutex_t
is new Address
; -- mutex identifier
684 type pthread_cond_t
is new Address
; -- cond identifier
685 type pthread_attr_t
is new Address
; -- pthread attributes
686 type pthread_mutexattr_t
is new Address
; -- mutex attributes
687 type pthread_condattr_t
is new Address
; -- mutex attributes
688 type sem_t
is new Address
; -- semaphore identifier
689 type pthread_key_t
is new Address
; -- per thread key
691 type sigbits_t
is array (Integer range 0 .. 3) of unsigned
;
692 type sigset_t
is record
695 pragma Convention
(C
, sigset_t
);
697 type pid_t
is new long
;
699 end System
.OS_Interface
;