-- S p e c --
-- --
-- Copyright (C) 1991-1994, Florida State University --
--- Copyright (C) 1995-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 1995-2008, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- This is a LynxOS (Native) version of this package
-- This package encapsulates all direct interfaces to OS services
--- that are needed by children of System.
+-- that are needed by the tasking run-time (libgnarl).
-- PLEASE DO NOT add any with-clauses to this package or remove the pragma
-- Preelaborate. This package is designed to be a bottom-level (leaf) package.
+with Ada.Unchecked_Conversion;
+
with Interfaces.C;
-with Unchecked_Conversion;
package System.OS_Interface is
pragma Preelaborate;
----------
Time_Slice_Supported : constant Boolean := True;
- -- Indicates wether time slicing is supported
+ -- Indicates whether time slicing is supported
type timespec is private;
pragma Convention (C, struct_timezone);
type struct_timezone_ptr is access all struct_timezone;
- type struct_timeval is private;
- -- This is needed on systems that do not have clock_gettime()
- -- but do have gettimeofday().
-
- function To_Duration (TV : struct_timeval) return Duration;
- pragma Inline (To_Duration);
-
- function To_Timeval (D : Duration) return struct_timeval;
- pragma Inline (To_Timeval);
-
-------------------------
-- Priority Scheduling --
-------------------------
SCHED_RR : constant := 16#00100000#;
SCHED_OTHER : constant := 16#00400000#;
+ function To_Target_Priority
+ (Prio : System.Any_Priority) return Interfaces.C.int;
+ -- Maps System.Any_Priority to a POSIX priority
+
-------------
-- Process --
-------------
type Thread_Body is access
function (arg : System.Address) return System.Address;
+ pragma Convention (C, Thread_Body);
function Thread_Body_Access is new
- Unchecked_Conversion (System.Address, Thread_Body);
+ Ada.Unchecked_Conversion (System.Address, Thread_Body);
type pthread_t is private;
subtype Thread_Id is pthread_t;
PTHREAD_CREATE_DETACHED : constant := 0;
+ PTHREAD_SCOPE_PROCESS : constant := 0;
+ PTHREAD_SCOPE_SYSTEM : constant := 1;
+
-----------
-- Stack --
-----------
+ Alternate_Stack_Size : constant := 0;
+ -- No alternate signal stack is used on this platform
+
Stack_Base_Available : constant Boolean := False;
- -- Indicates wether the stack base is available on this target.
+ -- Indicates whether the stack base is available on this target
function Get_Stack_Base (thread : pthread_t) return Address;
pragma Inline (Get_Stack_Base);
function pthread_kill (thread : pthread_t; sig : Signal) return int;
pragma Import (C, pthread_kill, "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;
+ set : access sigset_t;
+ oset : access sigset_t) return int;
pragma Import (C, pthread_sigmask, "sigprocmask");
--------------------------
mutex : access pthread_mutex_t;
reltime : access timespec) return int;
pragma Inline (pthread_cond_timedwait);
- -- LynxOS has a nonstandard pthrad_cond_timedwait
+ -- LynxOS has a nonstandard pthread_cond_timedwait
Relative_Timed_Wait : constant Boolean := True;
-- pthread_cond_timedwait requires a relative delay time
-- LynxOS has a non standard pthread_getspecific
type destructor_pointer is access procedure (arg : System.Address);
+ pragma Convention (C, destructor_pointer);
function pthread_key_create
(key : access pthread_key_t;
type clockid_t is new unsigned_char;
CLOCK_REALTIME : constant clockid_t := 0;
- type struct_timeval is record
- tv_sec : time_t;
- tv_usec : time_t;
- end record;
- pragma Convention (C, struct_timeval);
-
type st_t is record
stksize : int;
prio : int;