s-osinte-hpux-dce.ads [plain text]
with Interfaces.C;
with Unchecked_Conversion;
package System.OS_Interface is
pragma Preelaborate;
pragma Linker_Options ("-lcma");
subtype int is Interfaces.C.int;
subtype short is Interfaces.C.short;
subtype long is Interfaces.C.long;
subtype unsigned is Interfaces.C.unsigned;
subtype unsigned_short is Interfaces.C.unsigned_short;
subtype unsigned_long is Interfaces.C.unsigned_long;
subtype unsigned_char is Interfaces.C.unsigned_char;
subtype plain_char is Interfaces.C.plain_char;
subtype size_t is Interfaces.C.size_t;
function errno return int;
pragma Import (C, errno, "__get_errno");
EAGAIN : constant := 11;
EINTR : constant := 4;
EINVAL : constant := 22;
ENOMEM : constant := 12;
ETIME : constant := 52;
ETIMEDOUT : constant := 238;
FUNC_ERR : constant := -1;
Max_Interrupt : constant := 44;
type Signal is new int range 0 .. Max_Interrupt;
for Signal'Size use int'Size;
SIGHUP : constant := 1; SIGINT : constant := 2; SIGQUIT : constant := 3; SIGILL : constant := 4; SIGTRAP : constant := 5; SIGIOT : constant := 6; SIGABRT : constant := 6; SIGEMT : constant := 7; SIGFPE : constant := 8; SIGKILL : constant := 9; SIGBUS : constant := 10; SIGSEGV : constant := 11; SIGSYS : constant := 12; SIGPIPE : constant := 13; SIGALRM : constant := 14; SIGTERM : constant := 15; SIGUSR1 : constant := 16; SIGUSR2 : constant := 17; SIGCLD : constant := 18; SIGCHLD : constant := 18; SIGPWR : constant := 19; SIGVTALRM : constant := 20; SIGPROF : constant := 21; SIGIO : constant := 22; SIGPOLL : constant := 22; SIGWINCH : constant := 23; SIGSTOP : constant := 24; SIGTSTP : constant := 25; SIGCONT : constant := 26; SIGTTIN : constant := 27; SIGTTOU : constant := 28; SIGURG : constant := 29; SIGLOST : constant := 30; SIGDIL : constant := 32; SIGXCPU : constant := 33; SIGXFSZ : constant := 34;
SIGADAABORT : constant := SIGABRT;
type Signal_Set is array (Natural range <>) of Signal;
Unmasked : constant Signal_Set :=
(SIGBUS, SIGTRAP, SIGTTIN, SIGTTOU, SIGTSTP);
Reserved : constant Signal_Set := (SIGKILL, SIGSTOP);
type sigset_t is private;
type isr_address is access procedure (sig : int);
function intr_attach (sig : int; handler : isr_address) return long;
Intr_Attach_Reset : constant Boolean := True;
function sigaddset (set : access sigset_t; sig : Signal) return int;
pragma Import (C, sigaddset, "sigaddset");
function sigdelset (set : access sigset_t; sig : Signal) return int;
pragma Import (C, sigdelset, "sigdelset");
function sigfillset (set : access sigset_t) return int;
pragma Import (C, sigfillset, "sigfillset");
function sigismember (set : access sigset_t; sig : Signal) return int;
pragma Import (C, sigismember, "sigismember");
function sigemptyset (set : access sigset_t) return int;
pragma Import (C, sigemptyset, "sigemptyset");
type Signal_Handler is access procedure (signo : Signal);
type struct_sigaction is record
sa_handler : System.Address;
sa_mask : sigset_t;
sa_flags : int;
end record;
pragma Convention (C, struct_sigaction);
type struct_sigaction_ptr is access all struct_sigaction;
SA_RESTART : constant := 16#40#;
SA_SIGINFO : constant := 16#10#;
SIG_BLOCK : constant := 0;
SIG_UNBLOCK : constant := 1;
SIG_SETMASK : constant := 2;
SIG_DFL : constant := 0;
SIG_IGN : constant := 1;
SIG_ERR : constant := -1;
function sigaction
(sig : Signal;
act : struct_sigaction_ptr;
oact : struct_sigaction_ptr) return int;
pragma Import (C, sigaction, "sigaction");
type timespec is private;
function nanosleep (rqtp, rmtp : access timespec) return int;
pragma Import (C, nanosleep);
type clockid_t is private;
CLOCK_REALTIME : constant clockid_t;
function Clock_Gettime
(Clock_Id : clockid_t; Tp : access timespec) return int;
pragma Import (C, Clock_Gettime);
function To_Duration (TS : timespec) return Duration;
pragma Inline (To_Duration);
function To_Timespec (D : Duration) return timespec;
pragma Inline (To_Timespec);
type struct_timeval is private;
function To_Duration (TV : struct_timeval) return Duration;
pragma Inline (To_Duration);
function To_Timeval (D : Duration) return struct_timeval;
pragma Inline (To_Timeval);
SCHED_FIFO : constant := 0;
SCHED_RR : constant := 1;
SCHED_OTHER : constant := 2;
type pid_t is private;
function kill (pid : pid_t; sig : Signal) return int;
pragma Import (C, kill, "kill");
function getpid return pid_t;
pragma Import (C, getpid, "getpid");
type Thread_Body is access
function (arg : System.Address) return System.Address;
function Thread_Body_Access is new
Unchecked_Conversion (System.Address, Thread_Body);
type pthread_t is private;
subtype Thread_Id is pthread_t;
type pthread_mutex_t is limited private;
type pthread_cond_t is limited private;
type pthread_attr_t is limited private;
type pthread_mutexattr_t is limited private;
type pthread_condattr_t is limited private;
type pthread_key_t is private;
function Get_Stack_Base (thread : pthread_t) return Address;
pragma Inline (Get_Stack_Base);
procedure pthread_init;
pragma Inline (pthread_init);
function sigwait (set : access sigset_t) return int;
pragma Import (C, sigwait, "cma_sigwait");
function sigwait
(set : access sigset_t;
sig : access Signal) return int;
pragma Inline (sigwait);
function pthread_kill
(thread : pthread_t;
sig : Signal) return int;
pragma Inline (pthread_kill);
type sigset_t_ptr is access all sigset_t;
function pthread_sigmask
(how : int;
set : sigset_t_ptr;
oset : sigset_t_ptr) return int;
pragma Import (C, pthread_sigmask, "sigprocmask");
function pthread_mutexattr_init
(attr : access pthread_mutexattr_t) return int;
function pthread_mutexattr_destroy
(attr : access pthread_mutexattr_t) return int;
function pthread_mutex_init
(mutex : access pthread_mutex_t;
attr : access pthread_mutexattr_t) return int;
function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int;
function pthread_mutex_lock (mutex : access pthread_mutex_t) return int;
pragma Inline (pthread_mutex_lock);
function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int;
pragma Inline (pthread_mutex_unlock);
function pthread_condattr_init
(attr : access pthread_condattr_t) return int;
function pthread_condattr_destroy
(attr : access pthread_condattr_t) return int;
function pthread_cond_init
(cond : access pthread_cond_t;
attr : access pthread_condattr_t) return int;
function pthread_cond_destroy (cond : access pthread_cond_t) return int;
function pthread_cond_signal (cond : access pthread_cond_t) return int;
pragma Inline (pthread_cond_signal);
function pthread_cond_wait
(cond : access pthread_cond_t;
mutex : access pthread_mutex_t) return int;
pragma Inline (pthread_cond_wait);
function pthread_cond_timedwait
(cond : access pthread_cond_t;
mutex : access pthread_mutex_t;
abstime : access timespec) return int;
pragma Inline (pthread_cond_timedwait);
type struct_sched_param is record
sched_priority : int; end record;
function pthread_setschedparam
(thread : pthread_t;
policy : int;
param : access struct_sched_param) return int;
pragma Inline (pthread_setschedparam);
function sched_yield return int;
pragma Inline (sched_yield);
function pthread_attr_init (attributes : access pthread_attr_t) return int;
pragma Inline (pthread_attr_init);
function pthread_attr_destroy
(attributes : access pthread_attr_t) return int;
pragma Inline (pthread_attr_destroy);
function pthread_attr_setstacksize
(attr : access pthread_attr_t;
stacksize : size_t) return int;
pragma Inline (pthread_attr_setstacksize);
function pthread_create
(thread : access pthread_t;
attributes : access pthread_attr_t;
start_routine : Thread_Body;
arg : System.Address) return int;
pragma Inline (pthread_create);
procedure pthread_detach (thread : access pthread_t);
pragma Import (C, pthread_detach);
procedure pthread_exit (status : System.Address);
pragma Import (C, pthread_exit, "pthread_exit");
function pthread_self return pthread_t;
pragma Import (C, pthread_self, "pthread_self");
function pthread_setspecific
(key : pthread_key_t;
value : System.Address) return int;
pragma Inline (pthread_setspecific);
function pthread_getspecific (key : pthread_key_t) return System.Address;
pragma Inline (pthread_getspecific);
type destructor_pointer is access procedure (arg : System.Address);
function pthread_key_create
(key : access pthread_key_t;
destructor : destructor_pointer) return int;
pragma Inline (pthread_key_create);
private
type array_type_1 is array (Integer range 0 .. 7) of unsigned_long;
type sigset_t is record
X_X_sigbits : array_type_1;
end record;
pragma Convention (C, sigset_t);
type pid_t is new int;
type time_t is new long;
type timespec is record
tv_sec : time_t;
tv_nsec : long;
end record;
pragma Convention (C, timespec);
type clockid_t is new int;
CLOCK_REALTIME : constant clockid_t := 1;
type struct_timeval is record
tv_sec : time_t;
tv_usec : time_t;
end record;
pragma Convention (C, struct_timeval);
type cma_t_address is new System.Address;
type cma_t_handle is record
field1 : cma_t_address;
field2 : Short_Integer;
field3 : Short_Integer;
end record;
for cma_t_handle'Size use 64;
type pthread_attr_t is new cma_t_handle;
pragma Convention (C_Pass_By_Copy, pthread_attr_t);
type pthread_condattr_t is new cma_t_handle;
pragma Convention (C_Pass_By_Copy, pthread_condattr_t);
type pthread_mutexattr_t is new cma_t_handle;
pragma Convention (C_Pass_By_Copy, pthread_mutexattr_t);
type pthread_t is new cma_t_handle;
pragma Convention (C_Pass_By_Copy, pthread_t);
type pthread_mutex_t is new cma_t_handle;
pragma Convention (C_Pass_By_Copy, pthread_mutex_t);
type pthread_cond_t is new cma_t_handle;
pragma Convention (C_Pass_By_Copy, pthread_cond_t);
type pthread_key_t is new int;
end System.OS_Interface;