a-intnam-lynxos.ads, [...]: Removed, no longer maintained.
2014-01-26 Arnaud Charlet <charlet@adacore.com> * a-intnam-lynxos.ads, mlib-tgt-specific-lynxos.adb, s-osinte-lynxos-3.adb, s-osinte-lynxos-3.ads, s-osinte-lynxos.adb, s-osinte-lynxos.ads, s-taprop-lynxos.adb, s-tpopsp-lynxos.adb, system-lynxos-ppc.ads, system-lynxos-x86.ads: Removed, no longer maintained. From-SVN: r207114
This commit is contained in:
parent
b4dfb6814d
commit
87e9c2a2f0
@ -1,3 +1,11 @@
|
||||
2014-01-26 Arnaud Charlet <charlet@adacore.com>
|
||||
|
||||
* a-intnam-lynxos.ads, mlib-tgt-specific-lynxos.adb,
|
||||
s-osinte-lynxos-3.adb, s-osinte-lynxos-3.ads, s-osinte-lynxos.adb,
|
||||
s-osinte-lynxos.ads, s-taprop-lynxos.adb, s-tpopsp-lynxos.adb,
|
||||
system-lynxos-ppc.ads, system-lynxos-x86.ads: Removed, no longer
|
||||
maintained.
|
||||
|
||||
2014-01-25 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gcc-interface/Makefile.in: Fix oversight.
|
||||
|
@ -1,166 +0,0 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- --
|
||||
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
|
||||
-- --
|
||||
-- A D A . I N T E R R U P T S . N A M E S --
|
||||
-- --
|
||||
-- S p e c --
|
||||
-- --
|
||||
-- Copyright (C) 1991-2011, 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- --
|
||||
-- ware Foundation; either version 3, or (at your option) any later ver- --
|
||||
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
||||
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
||||
-- or FITNESS FOR A PARTICULAR PURPOSE. --
|
||||
-- --
|
||||
-- As a special exception under Section 7 of GPL version 3, you are granted --
|
||||
-- additional permissions described in the GCC Runtime Library Exception, --
|
||||
-- version 3.1, as published by the Free Software Foundation. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License and --
|
||||
-- a copy of the GCC Runtime Library Exception along with this program; --
|
||||
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
|
||||
-- <http://www.gnu.org/licenses/>. --
|
||||
-- --
|
||||
-- GNARL was developed by the GNARL team at Florida State University. --
|
||||
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
|
||||
-- --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
-- This is a LynxOS version of this package
|
||||
|
||||
-- The following signals are reserved by the run time:
|
||||
|
||||
-- SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGTRAP, SIGABRT, SIGINT,
|
||||
-- SIGWAITING, SIGLWP, SIGTTIN, SIGTTOU, SIGTSTP, SIGPROF, SIGSTOP, SIGKILL
|
||||
|
||||
-- The pragma Unreserve_All_Interrupts affects the following signal(s):
|
||||
|
||||
-- SIGINT: made available for Ada handler
|
||||
|
||||
with System.OS_Interface;
|
||||
|
||||
package Ada.Interrupts.Names is
|
||||
|
||||
-- All identifiers in this unit are implementation defined
|
||||
|
||||
pragma Implementation_Defined;
|
||||
|
||||
-- Beware that the mapping of names to signals may be many-to-one. There
|
||||
-- may be aliases.
|
||||
|
||||
SIGHUP : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGHUP; -- hangup
|
||||
|
||||
SIGINT : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGINT; -- interrupt (rubout)
|
||||
|
||||
SIGQUIT : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGQUIT; -- quit (ASCD FS)
|
||||
|
||||
SIGILL : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGILL; -- illegal instruction (not reset)
|
||||
|
||||
SIGTRAP : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGTRAP; -- trace trap (not reset)
|
||||
|
||||
SIGBRK : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGBRK; -- break
|
||||
|
||||
SIGIOT : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGIOT; -- IOT instruction
|
||||
|
||||
SIGABRT : constant Interrupt_ID := -- used by abort,
|
||||
System.OS_Interface.SIGABRT; -- replace SIGIOT in the future
|
||||
|
||||
SIGCORE : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGCORE; -- kill with core dump
|
||||
|
||||
SIGEMT : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGEMT; -- EMT instruction
|
||||
|
||||
SIGFPE : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGFPE; -- floating point exception
|
||||
|
||||
SIGKILL : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGKILL; -- kill (cannot be caught or ignored)
|
||||
|
||||
SIGBUS : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGBUS; -- bus error
|
||||
|
||||
SIGSEGV : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGSEGV; -- segmentation violation
|
||||
|
||||
SIGSYS : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGSYS; -- bad argument to system call
|
||||
|
||||
SIGPIPE : constant Interrupt_ID := -- write on a pipe with
|
||||
System.OS_Interface.SIGPIPE; -- no one to read it
|
||||
|
||||
SIGALRM : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGALRM; -- alarm clock
|
||||
|
||||
SIGTERM : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGTERM; -- software termination signal from kill
|
||||
|
||||
SIGURG : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGURG; -- urgent condition on IO channel
|
||||
|
||||
SIGSTOP : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGSTOP; -- stop (cannot be caught or ignored)
|
||||
|
||||
SIGTSTP : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGTSTP; -- user stop requested from tty
|
||||
|
||||
SIGCONT : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGCONT; -- stopped process has been continued
|
||||
|
||||
SIGCLD : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGCLD; -- child status change
|
||||
|
||||
SIGCHLD : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGCHLD; -- 4.3BSD's/POSIX name for SIGCLD
|
||||
|
||||
SIGTTIN : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGTTIN; -- background tty read attempted
|
||||
|
||||
SIGTTOU : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGTTOU; -- background tty write attempted
|
||||
|
||||
SIGPOLL : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGPOLL; -- pollable event occurred
|
||||
|
||||
SIGIO : constant Interrupt_ID := -- input/output possible,
|
||||
System.OS_Interface.SIGIO; -- SIGPOLL alias (Solaris)
|
||||
|
||||
SIGXCPU : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGXCPU; -- CPU time limit exceeded
|
||||
|
||||
SIGXFSZ : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGXFSZ; -- filesize limit exceeded
|
||||
|
||||
SIGVTALRM : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGVTALRM; -- virtual timer expired
|
||||
|
||||
SIGPROF : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGPROF; -- profiling timer expired
|
||||
|
||||
SIGWINCH : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGWINCH; -- window size change
|
||||
|
||||
SIGLOST : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGLOST; -- SUN 4.1 compatibility
|
||||
|
||||
SIGUSR1 : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGUSR1; -- user defined signal 1
|
||||
|
||||
SIGUSR2 : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGUSR2; -- user defined signal 2
|
||||
|
||||
SIGPRIO : constant Interrupt_ID :=
|
||||
System.OS_Interface.SIGPRIO;
|
||||
-- sent to a process with its priority
|
||||
-- or group is changed
|
||||
end Ada.Interrupts.Names;
|
@ -1,149 +0,0 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- --
|
||||
-- GNAT COMPILER COMPONENTS --
|
||||
-- --
|
||||
-- M L I B . T G T . S P E C I F I C --
|
||||
-- (LynxOS Version) --
|
||||
-- --
|
||||
-- B o d y --
|
||||
-- --
|
||||
-- Copyright (C) 2003-2008, Free Software Foundation, Inc. --
|
||||
-- --
|
||||
-- GNAT 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- --
|
||||
-- ware Foundation; either version 3, or (at your option) any later ver- --
|
||||
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
||||
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
||||
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
|
||||
-- for more details. You should have received a copy of the GNU General --
|
||||
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
|
||||
-- http://www.gnu.org/licenses for a complete copy of the license. --
|
||||
-- --
|
||||
-- GNAT was originally developed by the GNAT team at New York University. --
|
||||
-- Extensive contributions were provided by Ada Core Technologies Inc. --
|
||||
-- --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
-- This is the LynxOS version of the body
|
||||
|
||||
package body MLib.Tgt.Specific is
|
||||
|
||||
-- Non default subprograms
|
||||
|
||||
procedure Build_Dynamic_Library
|
||||
(Ofiles : Argument_List;
|
||||
Options : Argument_List;
|
||||
Interfaces : Argument_List;
|
||||
Lib_Filename : String;
|
||||
Lib_Dir : String;
|
||||
Symbol_Data : Symbol_Record;
|
||||
Driver_Name : Name_Id := No_Name;
|
||||
Lib_Version : String := "";
|
||||
Auto_Init : Boolean := False);
|
||||
|
||||
function DLL_Ext return String;
|
||||
|
||||
function Dynamic_Option return String;
|
||||
|
||||
function PIC_Option return String;
|
||||
|
||||
function Library_Major_Minor_Id_Supported return Boolean;
|
||||
|
||||
function Standalone_Library_Auto_Init_Is_Supported return Boolean;
|
||||
|
||||
function Support_For_Libraries return Library_Support;
|
||||
|
||||
---------------------------
|
||||
-- Build_Dynamic_Library --
|
||||
---------------------------
|
||||
|
||||
procedure Build_Dynamic_Library
|
||||
(Ofiles : Argument_List;
|
||||
Options : Argument_List;
|
||||
Interfaces : Argument_List;
|
||||
Lib_Filename : String;
|
||||
Lib_Dir : String;
|
||||
Symbol_Data : Symbol_Record;
|
||||
Driver_Name : Name_Id := No_Name;
|
||||
Lib_Version : String := "";
|
||||
Auto_Init : Boolean := False)
|
||||
is
|
||||
pragma Unreferenced (Ofiles);
|
||||
pragma Unreferenced (Options);
|
||||
pragma Unreferenced (Interfaces);
|
||||
pragma Unreferenced (Lib_Filename);
|
||||
pragma Unreferenced (Lib_Dir);
|
||||
pragma Unreferenced (Symbol_Data);
|
||||
pragma Unreferenced (Driver_Name);
|
||||
pragma Unreferenced (Lib_Version);
|
||||
pragma Unreferenced (Auto_Init);
|
||||
|
||||
begin
|
||||
null;
|
||||
end Build_Dynamic_Library;
|
||||
|
||||
-------------
|
||||
-- DLL_Ext --
|
||||
-------------
|
||||
|
||||
function DLL_Ext return String is
|
||||
begin
|
||||
return "";
|
||||
end DLL_Ext;
|
||||
|
||||
--------------------
|
||||
-- Dynamic_Option --
|
||||
--------------------
|
||||
|
||||
function Dynamic_Option return String is
|
||||
begin
|
||||
return "";
|
||||
end Dynamic_Option;
|
||||
|
||||
--------------------------------------
|
||||
-- Library_Major_Minor_Id_Supported --
|
||||
--------------------------------------
|
||||
|
||||
function Library_Major_Minor_Id_Supported return Boolean is
|
||||
begin
|
||||
return False;
|
||||
end Library_Major_Minor_Id_Supported;
|
||||
|
||||
----------------
|
||||
-- PIC_Option --
|
||||
----------------
|
||||
|
||||
function PIC_Option return String is
|
||||
begin
|
||||
return "";
|
||||
end PIC_Option;
|
||||
|
||||
-----------------------------------------------
|
||||
-- Standalone_Library_Auto_Init_Is_Supported --
|
||||
-----------------------------------------------
|
||||
|
||||
function Standalone_Library_Auto_Init_Is_Supported return Boolean is
|
||||
begin
|
||||
return False;
|
||||
end Standalone_Library_Auto_Init_Is_Supported;
|
||||
|
||||
---------------------------
|
||||
-- Support_For_Libraries --
|
||||
---------------------------
|
||||
|
||||
function Support_For_Libraries return Library_Support is
|
||||
begin
|
||||
return Static_Only;
|
||||
end Support_For_Libraries;
|
||||
|
||||
begin
|
||||
Build_Dynamic_Library_Ptr := Build_Dynamic_Library'Access;
|
||||
DLL_Ext_Ptr := DLL_Ext'Access;
|
||||
Dynamic_Option_Ptr := Dynamic_Option'Access;
|
||||
Library_Major_Minor_Id_Supported_Ptr :=
|
||||
Library_Major_Minor_Id_Supported'Access;
|
||||
PIC_Option_Ptr := PIC_Option'Access;
|
||||
Standalone_Library_Auto_Init_Is_Supported_Ptr :=
|
||||
Standalone_Library_Auto_Init_Is_Supported'Access;
|
||||
Support_For_Libraries_Ptr := Support_For_Libraries'Access;
|
||||
end MLib.Tgt.Specific;
|
@ -1,575 +0,0 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- --
|
||||
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
|
||||
-- --
|
||||
-- S Y S T E M . O S _ I N T E R F A C E --
|
||||
-- --
|
||||
-- B o d y --
|
||||
-- --
|
||||
-- Copyright (C) 1999-2009, 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- --
|
||||
-- ware Foundation; either version 3, or (at your option) any later ver- --
|
||||
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
||||
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
||||
-- or FITNESS FOR A PARTICULAR PURPOSE. --
|
||||
-- --
|
||||
-- As a special exception under Section 7 of GPL version 3, you are granted --
|
||||
-- additional permissions described in the GCC Runtime Library Exception, --
|
||||
-- version 3.1, as published by the Free Software Foundation. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License and --
|
||||
-- a copy of the GCC Runtime Library Exception along with this program; --
|
||||
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
|
||||
-- <http://www.gnu.org/licenses/>. --
|
||||
-- --
|
||||
-- GNARL was developed by the GNARL team at Florida State University. --
|
||||
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
|
||||
-- --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
-- This is a LynxOS (Native) version of this package
|
||||
|
||||
pragma Polling (Off);
|
||||
-- Turn off polling, we do not want ATC polling to take place during
|
||||
-- tasking operations. It causes infinite loops and other problems.
|
||||
|
||||
package body System.OS_Interface is
|
||||
|
||||
use Interfaces.C;
|
||||
|
||||
-------------------
|
||||
-- clock_gettime --
|
||||
-------------------
|
||||
|
||||
function clock_gettime
|
||||
(clock_id : clockid_t;
|
||||
tp : access timespec)
|
||||
return int
|
||||
is
|
||||
function clock_gettime_base
|
||||
(clock_id : clockid_t;
|
||||
tp : access timespec)
|
||||
return int;
|
||||
pragma Import (C, clock_gettime_base, "clock_gettime");
|
||||
|
||||
begin
|
||||
if clock_gettime_base (clock_id, tp) /= 0 then
|
||||
return errno;
|
||||
end if;
|
||||
|
||||
return 0;
|
||||
end clock_gettime;
|
||||
|
||||
-----------------
|
||||
-- To_Duration --
|
||||
-----------------
|
||||
|
||||
function To_Duration (TS : timespec) return Duration is
|
||||
begin
|
||||
return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9;
|
||||
end To_Duration;
|
||||
|
||||
------------------------
|
||||
-- To_Target_Priority --
|
||||
------------------------
|
||||
|
||||
function To_Target_Priority
|
||||
(Prio : System.Any_Priority) return Interfaces.C.int
|
||||
is
|
||||
begin
|
||||
return Interfaces.C.int (Prio);
|
||||
end To_Target_Priority;
|
||||
|
||||
-----------------
|
||||
-- To_Timespec --
|
||||
-----------------
|
||||
|
||||
function To_Timespec (D : Duration) return timespec is
|
||||
S : time_t;
|
||||
F : Duration;
|
||||
|
||||
begin
|
||||
S := time_t (Long_Long_Integer (D));
|
||||
F := D - Duration (S);
|
||||
|
||||
-- If F has negative value due to a round-up, adjust for positive F
|
||||
-- value.
|
||||
|
||||
if F < 0.0 then
|
||||
S := S - 1;
|
||||
F := F + 1.0;
|
||||
end if;
|
||||
|
||||
return timespec'(tv_sec => S,
|
||||
tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
|
||||
end To_Timespec;
|
||||
|
||||
-------------------------
|
||||
-- POSIX.1c Section 3 --
|
||||
-------------------------
|
||||
|
||||
function sigwait
|
||||
(set : access sigset_t;
|
||||
sig : access Signal)
|
||||
return int
|
||||
is
|
||||
function sigwait_base
|
||||
(set : access sigset_t;
|
||||
value : System.Address)
|
||||
return Signal;
|
||||
pragma Import (C, sigwait_base, "sigwait");
|
||||
|
||||
begin
|
||||
sig.all := sigwait_base (set, Null_Address);
|
||||
|
||||
if sig.all = -1 then
|
||||
return errno;
|
||||
end if;
|
||||
|
||||
return 0;
|
||||
end sigwait;
|
||||
|
||||
--------------------------
|
||||
-- POSIX.1c Section 11 --
|
||||
--------------------------
|
||||
|
||||
-- For all the following functions, LynxOS threads has the POSIX Draft 4
|
||||
-- behavior; it sets errno but the standard Posix requires it to be
|
||||
-- returned.
|
||||
|
||||
function pthread_mutexattr_init
|
||||
(attr : access pthread_mutexattr_t)
|
||||
return int
|
||||
is
|
||||
function pthread_mutexattr_create
|
||||
(attr : access pthread_mutexattr_t)
|
||||
return int;
|
||||
pragma Import (C, pthread_mutexattr_create, "pthread_mutexattr_create");
|
||||
|
||||
begin
|
||||
if pthread_mutexattr_create (attr) /= 0 then
|
||||
return errno;
|
||||
end if;
|
||||
|
||||
return 0;
|
||||
end pthread_mutexattr_init;
|
||||
|
||||
function pthread_mutexattr_destroy
|
||||
(attr : access pthread_mutexattr_t)
|
||||
return int
|
||||
is
|
||||
function pthread_mutexattr_delete
|
||||
(attr : access pthread_mutexattr_t)
|
||||
return int;
|
||||
pragma Import (C, pthread_mutexattr_delete, "pthread_mutexattr_delete");
|
||||
|
||||
begin
|
||||
if pthread_mutexattr_delete (attr) /= 0 then
|
||||
return errno;
|
||||
end if;
|
||||
|
||||
return 0;
|
||||
end pthread_mutexattr_destroy;
|
||||
|
||||
function pthread_mutex_init
|
||||
(mutex : access pthread_mutex_t;
|
||||
attr : access pthread_mutexattr_t)
|
||||
return int
|
||||
is
|
||||
function pthread_mutex_init_base
|
||||
(mutex : access pthread_mutex_t;
|
||||
attr : pthread_mutexattr_t)
|
||||
return int;
|
||||
pragma Import (C, pthread_mutex_init_base, "pthread_mutex_init");
|
||||
|
||||
begin
|
||||
if pthread_mutex_init_base (mutex, attr.all) /= 0 then
|
||||
return errno;
|
||||
end if;
|
||||
|
||||
return 0;
|
||||
end pthread_mutex_init;
|
||||
|
||||
function pthread_mutex_destroy
|
||||
(mutex : access pthread_mutex_t)
|
||||
return int
|
||||
is
|
||||
function pthread_mutex_destroy_base
|
||||
(mutex : access pthread_mutex_t)
|
||||
return int;
|
||||
pragma Import (C, pthread_mutex_destroy_base, "pthread_mutex_destroy");
|
||||
|
||||
begin
|
||||
if pthread_mutex_destroy_base (mutex) /= 0 then
|
||||
return errno;
|
||||
end if;
|
||||
|
||||
return 0;
|
||||
end pthread_mutex_destroy;
|
||||
|
||||
function pthread_mutex_lock
|
||||
(mutex : access pthread_mutex_t)
|
||||
return int
|
||||
is
|
||||
function pthread_mutex_lock_base
|
||||
(mutex : access pthread_mutex_t)
|
||||
return int;
|
||||
pragma Import (C, pthread_mutex_lock_base, "pthread_mutex_lock");
|
||||
|
||||
begin
|
||||
if pthread_mutex_lock_base (mutex) /= 0 then
|
||||
return errno;
|
||||
end if;
|
||||
|
||||
return 0;
|
||||
end pthread_mutex_lock;
|
||||
|
||||
function pthread_mutex_unlock
|
||||
(mutex : access pthread_mutex_t)
|
||||
return int
|
||||
is
|
||||
function pthread_mutex_unlock_base
|
||||
(mutex : access pthread_mutex_t)
|
||||
return int;
|
||||
pragma Import (C, pthread_mutex_unlock_base, "pthread_mutex_unlock");
|
||||
|
||||
begin
|
||||
if pthread_mutex_unlock_base (mutex) /= 0 then
|
||||
return errno;
|
||||
end if;
|
||||
|
||||
return 0;
|
||||
end pthread_mutex_unlock;
|
||||
|
||||
function pthread_condattr_init
|
||||
(attr : access pthread_condattr_t)
|
||||
return int
|
||||
is
|
||||
function pthread_condattr_create
|
||||
(attr : access pthread_condattr_t)
|
||||
return int;
|
||||
pragma Import (C, pthread_condattr_create, "pthread_condattr_create");
|
||||
|
||||
begin
|
||||
if pthread_condattr_create (attr) /= 0 then
|
||||
return errno;
|
||||
end if;
|
||||
|
||||
return 0;
|
||||
end pthread_condattr_init;
|
||||
|
||||
function pthread_condattr_destroy
|
||||
(attr : access pthread_condattr_t)
|
||||
return int
|
||||
is
|
||||
function pthread_condattr_delete
|
||||
(attr : access pthread_condattr_t)
|
||||
return int;
|
||||
pragma Import (C, pthread_condattr_delete, "pthread_condattr_delete");
|
||||
|
||||
begin
|
||||
if pthread_condattr_delete (attr) /= 0 then
|
||||
return errno;
|
||||
end if;
|
||||
|
||||
return 0;
|
||||
end pthread_condattr_destroy;
|
||||
|
||||
function pthread_cond_init
|
||||
(cond : access pthread_cond_t;
|
||||
attr : access pthread_condattr_t)
|
||||
return int
|
||||
is
|
||||
function pthread_cond_init_base
|
||||
(cond : access pthread_cond_t;
|
||||
attr : pthread_condattr_t)
|
||||
return int;
|
||||
pragma Import (C, pthread_cond_init_base, "pthread_cond_init");
|
||||
|
||||
begin
|
||||
if pthread_cond_init_base (cond, attr.all) /= 0 then
|
||||
return errno;
|
||||
end if;
|
||||
|
||||
return 0;
|
||||
end pthread_cond_init;
|
||||
|
||||
function pthread_cond_destroy
|
||||
(cond : access pthread_cond_t)
|
||||
return int
|
||||
is
|
||||
function pthread_cond_destroy_base
|
||||
(cond : access pthread_cond_t)
|
||||
return int;
|
||||
pragma Import (C, pthread_cond_destroy_base, "pthread_cond_destroy");
|
||||
|
||||
begin
|
||||
if pthread_cond_destroy_base (cond) /= 0 then
|
||||
return errno;
|
||||
end if;
|
||||
|
||||
return 0;
|
||||
end pthread_cond_destroy;
|
||||
|
||||
function pthread_cond_signal
|
||||
(cond : access pthread_cond_t)
|
||||
return int
|
||||
is
|
||||
function pthread_cond_signal_base
|
||||
(cond : access pthread_cond_t)
|
||||
return int;
|
||||
pragma Import (C, pthread_cond_signal_base, "pthread_cond_signal");
|
||||
|
||||
begin
|
||||
if pthread_cond_signal_base (cond) /= 0 then
|
||||
return errno;
|
||||
end if;
|
||||
|
||||
return 0;
|
||||
end pthread_cond_signal;
|
||||
|
||||
function pthread_cond_wait
|
||||
(cond : access pthread_cond_t;
|
||||
mutex : access pthread_mutex_t)
|
||||
return int
|
||||
is
|
||||
function pthread_cond_wait_base
|
||||
(cond : access pthread_cond_t;
|
||||
mutex : access pthread_mutex_t)
|
||||
return int;
|
||||
pragma Import (C, pthread_cond_wait_base, "pthread_cond_wait");
|
||||
|
||||
begin
|
||||
if pthread_cond_wait_base (cond, mutex) /= 0 then
|
||||
return errno;
|
||||
end if;
|
||||
|
||||
return 0;
|
||||
end pthread_cond_wait;
|
||||
|
||||
function pthread_cond_timedwait
|
||||
(cond : access pthread_cond_t;
|
||||
mutex : access pthread_mutex_t;
|
||||
reltime : access timespec) return int
|
||||
is
|
||||
function pthread_cond_timedwait_base
|
||||
(cond : access pthread_cond_t;
|
||||
mutex : access pthread_mutex_t;
|
||||
reltime : access timespec) return int;
|
||||
pragma Import (C, pthread_cond_timedwait_base, "pthread_cond_timedwait");
|
||||
|
||||
begin
|
||||
if pthread_cond_timedwait_base (cond, mutex, reltime) /= 0 then
|
||||
if errno = EAGAIN then
|
||||
return ETIMEDOUT;
|
||||
end if;
|
||||
|
||||
return errno;
|
||||
end if;
|
||||
|
||||
return 0;
|
||||
end pthread_cond_timedwait;
|
||||
|
||||
--------------------------
|
||||
-- POSIX.1c Section 13 --
|
||||
--------------------------
|
||||
|
||||
function pthread_setschedparam
|
||||
(thread : pthread_t;
|
||||
policy : int;
|
||||
param : access struct_sched_param)
|
||||
return int
|
||||
is
|
||||
function pthread_setscheduler
|
||||
(thread : pthread_t;
|
||||
policy : int;
|
||||
prio : int)
|
||||
return int;
|
||||
pragma Import (C, pthread_setscheduler, "pthread_setscheduler");
|
||||
|
||||
begin
|
||||
if pthread_setscheduler (thread, policy, param.sched_priority) = -1 then
|
||||
return errno;
|
||||
end if;
|
||||
|
||||
return 0;
|
||||
end pthread_setschedparam;
|
||||
|
||||
function pthread_mutexattr_setprotocol
|
||||
(attr : access pthread_mutexattr_t;
|
||||
protocol : int)
|
||||
return int
|
||||
is
|
||||
pragma Unreferenced (attr, protocol);
|
||||
begin
|
||||
return 0;
|
||||
end pthread_mutexattr_setprotocol;
|
||||
|
||||
function pthread_mutexattr_setprioceiling
|
||||
(attr : access pthread_mutexattr_t;
|
||||
prioceiling : int)
|
||||
return int
|
||||
is
|
||||
pragma Unreferenced (attr, prioceiling);
|
||||
begin
|
||||
return 0;
|
||||
end pthread_mutexattr_setprioceiling;
|
||||
|
||||
function pthread_attr_setscope
|
||||
(attr : access pthread_attr_t;
|
||||
contentionscope : int)
|
||||
return int
|
||||
is
|
||||
pragma Unreferenced (attr, contentionscope);
|
||||
begin
|
||||
return 0;
|
||||
end pthread_attr_setscope;
|
||||
|
||||
function sched_yield return int is
|
||||
procedure pthread_yield;
|
||||
pragma Import (C, pthread_yield, "pthread_yield");
|
||||
|
||||
begin
|
||||
pthread_yield;
|
||||
return 0;
|
||||
end sched_yield;
|
||||
|
||||
-----------------------------
|
||||
-- P1003.1c - Section 16 --
|
||||
-----------------------------
|
||||
|
||||
function pthread_attr_setdetachstate
|
||||
(attr : access pthread_attr_t;
|
||||
detachstate : int)
|
||||
return int
|
||||
is
|
||||
pragma Unreferenced (attr, detachstate);
|
||||
begin
|
||||
return 0;
|
||||
end pthread_attr_setdetachstate;
|
||||
|
||||
function pthread_create
|
||||
(thread : access pthread_t;
|
||||
attributes : access pthread_attr_t;
|
||||
start_routine : Thread_Body;
|
||||
arg : System.Address)
|
||||
return int
|
||||
is
|
||||
-- The LynxOS pthread_create doesn't seems to work.
|
||||
-- Workaround : We're using st_new instead.
|
||||
--
|
||||
-- function pthread_create_base
|
||||
-- (thread : access pthread_t;
|
||||
-- attributes : pthread_attr_t;
|
||||
-- start_routine : Thread_Body;
|
||||
-- arg : System.Address)
|
||||
-- return int;
|
||||
-- pragma Import (C, pthread_create_base, "pthread_create");
|
||||
|
||||
St : aliased st_t := attributes.st;
|
||||
|
||||
function st_new
|
||||
(start_routine : Thread_Body;
|
||||
arg : System.Address;
|
||||
attributes : access st_t;
|
||||
thread : access pthread_t)
|
||||
return int;
|
||||
pragma Import (C, st_new, "st_new");
|
||||
|
||||
begin
|
||||
-- Following code would be used if above commented function worked
|
||||
|
||||
-- if pthread_create_base
|
||||
-- (thread, attributes.all, start_routine, arg) /= 0 then
|
||||
|
||||
if st_new (start_routine, arg, St'Access, thread) /= 0 then
|
||||
return errno;
|
||||
end if;
|
||||
|
||||
return 0;
|
||||
end pthread_create;
|
||||
|
||||
function pthread_detach (thread : pthread_t) return int is
|
||||
aliased_thread : aliased pthread_t := thread;
|
||||
|
||||
function pthread_detach_base (thread : access pthread_t) return int;
|
||||
pragma Import (C, pthread_detach_base, "pthread_detach");
|
||||
|
||||
begin
|
||||
if pthread_detach_base (aliased_thread'Access) /= 0 then
|
||||
return errno;
|
||||
end if;
|
||||
|
||||
return 0;
|
||||
end pthread_detach;
|
||||
|
||||
--------------------------
|
||||
-- POSIX.1c Section 17 --
|
||||
--------------------------
|
||||
|
||||
function pthread_setspecific
|
||||
(key : pthread_key_t;
|
||||
value : System.Address)
|
||||
return int
|
||||
is
|
||||
function pthread_setspecific_base
|
||||
(key : pthread_key_t;
|
||||
value : System.Address)
|
||||
return int;
|
||||
pragma Import (C, pthread_setspecific_base, "pthread_setspecific");
|
||||
|
||||
begin
|
||||
if pthread_setspecific_base (key, value) /= 0 then
|
||||
return errno;
|
||||
end if;
|
||||
|
||||
return 0;
|
||||
end pthread_setspecific;
|
||||
|
||||
function pthread_getspecific (key : pthread_key_t) return System.Address is
|
||||
procedure pthread_getspecific_base
|
||||
(key : pthread_key_t;
|
||||
value : access System.Address);
|
||||
pragma Import (C, pthread_getspecific_base, "pthread_getspecific");
|
||||
|
||||
value : aliased System.Address := System.Null_Address;
|
||||
|
||||
begin
|
||||
pthread_getspecific_base (key, value'Unchecked_Access);
|
||||
return value;
|
||||
end pthread_getspecific;
|
||||
|
||||
function Get_Stack_Base (thread : pthread_t) return Address is
|
||||
pragma Warnings (Off, thread);
|
||||
|
||||
begin
|
||||
return Null_Address;
|
||||
end Get_Stack_Base;
|
||||
|
||||
function pthread_key_create
|
||||
(key : access pthread_key_t;
|
||||
destructor : destructor_pointer)
|
||||
return int
|
||||
is
|
||||
function pthread_keycreate
|
||||
(key : access pthread_key_t;
|
||||
destructor : destructor_pointer)
|
||||
return int;
|
||||
pragma Import (C, pthread_keycreate, "pthread_keycreate");
|
||||
|
||||
begin
|
||||
if pthread_keycreate (key, destructor) /= 0 then
|
||||
return errno;
|
||||
end if;
|
||||
|
||||
return 0;
|
||||
end pthread_key_create;
|
||||
|
||||
procedure pthread_init is
|
||||
begin
|
||||
null;
|
||||
end pthread_init;
|
||||
|
||||
end System.OS_Interface;
|
@ -1,552 +0,0 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- --
|
||||
-- GNAT RUN-TIME COMPONENTS --
|
||||
-- --
|
||||
-- S Y S T E M . O S _ I N T E R F A C E --
|
||||
-- --
|
||||
-- S p e c --
|
||||
-- --
|
||||
-- Copyright (C) 1991-1994, Florida State University --
|
||||
-- Copyright (C) 1995-2011, Free Software Foundation, Inc. --
|
||||
-- --
|
||||
-- GNAT 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- --
|
||||
-- ware Foundation; either version 3, or (at your option) any later ver- --
|
||||
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
||||
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
||||
-- or FITNESS FOR A PARTICULAR PURPOSE. --
|
||||
-- --
|
||||
-- As a special exception under Section 7 of GPL version 3, you are granted --
|
||||
-- additional permissions described in the GCC Runtime Library Exception, --
|
||||
-- version 3.1, as published by the Free Software Foundation. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License and --
|
||||
-- a copy of the GCC Runtime Library Exception along with this program; --
|
||||
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
|
||||
-- <http://www.gnu.org/licenses/>. --
|
||||
-- --
|
||||
-- GNAT was originally developed by the GNAT team at New York University. --
|
||||
-- Extensive contributions were provided by Ada Core Technologies Inc. --
|
||||
-- --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
-- This is a LynxOS (Native) version of this package
|
||||
|
||||
-- This package encapsulates all direct interfaces to OS services
|
||||
-- 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;
|
||||
|
||||
package System.OS_Interface is
|
||||
pragma Preelaborate;
|
||||
|
||||
pragma Linker_Options ("-mthreads");
|
||||
|
||||
subtype int is Interfaces.C.int;
|
||||
subtype char is Interfaces.C.char;
|
||||
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;
|
||||
|
||||
-----------
|
||||
-- Errno --
|
||||
-----------
|
||||
|
||||
function errno return int;
|
||||
pragma Import (C, errno, "__get_errno");
|
||||
|
||||
EAGAIN : constant := 11;
|
||||
EINTR : constant := 4;
|
||||
EINVAL : constant := 22;
|
||||
ENOMEM : constant := 12;
|
||||
ETIMEDOUT : constant := 60;
|
||||
|
||||
-------------
|
||||
-- Signals --
|
||||
-------------
|
||||
|
||||
Max_Interrupt : constant := 63;
|
||||
type Signal is new int range 0 .. Max_Interrupt;
|
||||
for Signal'Size use int'Size;
|
||||
|
||||
SIGHUP : constant := 1; -- hangup
|
||||
SIGINT : constant := 2; -- interrupt (rubout)
|
||||
SIGQUIT : constant := 3; -- quit (ASCD FS)
|
||||
SIGILL : constant := 4; -- illegal instruction (not reset)
|
||||
SIGTRAP : constant := 5; -- trace trap (not reset)
|
||||
SIGBRK : constant := 6; -- break
|
||||
SIGIOT : constant := 6; -- IOT instruction
|
||||
SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future
|
||||
SIGCORE : constant := 7; -- kill with core dump
|
||||
SIGEMT : constant := 7; -- EMT instruction
|
||||
SIGFPE : constant := 8; -- floating point exception
|
||||
SIGKILL : constant := 9; -- kill (cannot be caught or ignored)
|
||||
SIGBUS : constant := 10; -- bus error
|
||||
SIGSEGV : constant := 11; -- segmentation violation
|
||||
SIGSYS : constant := 12; -- bad argument to system call
|
||||
SIGPIPE : constant := 13; -- write on a pipe with no one to read it
|
||||
SIGALRM : constant := 14; -- alarm clock
|
||||
SIGTERM : constant := 15; -- software termination signal from kill
|
||||
SIGURG : constant := 16; -- urgent condition on IO channel
|
||||
SIGSTOP : constant := 17; -- stop (cannot be caught or ignored)
|
||||
SIGTSTP : constant := 18; -- user stop requested from tty
|
||||
SIGCONT : constant := 19; -- stopped process has been continued
|
||||
SIGCLD : constant := 20; -- alias for SIGCHLD
|
||||
SIGCHLD : constant := 20; -- child status change
|
||||
SIGTTIN : constant := 21; -- background tty read attempted
|
||||
SIGTTOU : constant := 22; -- background tty write attempted
|
||||
SIGIO : constant := 23; -- I/O possible (Solaris SIGPOLL alias)
|
||||
SIGPOLL : constant := 23; -- pollable event occurred
|
||||
SIGXCPU : constant := 24; -- CPU time limit exceeded
|
||||
SIGXFSZ : constant := 25; -- filesize limit exceeded
|
||||
SIGVTALRM : constant := 26; -- virtual timer expired
|
||||
SIGPROF : constant := 27; -- profiling timer expired
|
||||
SIGWINCH : constant := 28; -- window size change
|
||||
SIGLOST : constant := 29; -- SUN 4.1 compatibility
|
||||
SIGUSR1 : constant := 30; -- user defined signal 1
|
||||
SIGUSR2 : constant := 31; -- user defined signal 2
|
||||
SIGPRIO : constant := 32; -- sent to a process with its priority or
|
||||
-- group is changed
|
||||
|
||||
SIGADAABORT : constant := SIGABRT;
|
||||
-- Change this if you want to use another signal for task abort.
|
||||
-- SIGTERM might be a good one.
|
||||
|
||||
type Signal_Set is array (Natural range <>) of Signal;
|
||||
|
||||
Unmasked : constant Signal_Set :=
|
||||
(SIGTRAP, SIGTTIN, SIGTTOU, SIGTSTP, SIGPROF);
|
||||
Reserved : constant Signal_Set := (SIGABRT, SIGKILL, SIGSTOP, SIGPRIO);
|
||||
|
||||
type sigset_t is private;
|
||||
|
||||
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 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_SIGINFO : constant := 16#80#;
|
||||
|
||||
SIG_BLOCK : constant := 0;
|
||||
SIG_UNBLOCK : constant := 1;
|
||||
SIG_SETMASK : constant := 2;
|
||||
|
||||
SIG_DFL : constant := 0;
|
||||
SIG_IGN : constant := 1;
|
||||
|
||||
function sigaction
|
||||
(sig : Signal;
|
||||
act : struct_sigaction_ptr;
|
||||
oact : struct_sigaction_ptr) return int;
|
||||
pragma Import (C, sigaction, "sigaction");
|
||||
|
||||
----------
|
||||
-- Time --
|
||||
----------
|
||||
|
||||
Time_Slice_Supported : constant Boolean := True;
|
||||
-- Indicates whether time slicing is supported
|
||||
|
||||
type timespec is private;
|
||||
|
||||
type clockid_t is new int;
|
||||
|
||||
function clock_gettime
|
||||
(clock_id : clockid_t;
|
||||
tp : access timespec) return int;
|
||||
pragma Inline (clock_gettime);
|
||||
-- LynxOS has non standard 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_timezone is record
|
||||
tz_minuteswest : int;
|
||||
tz_dsttime : int;
|
||||
end record;
|
||||
pragma Convention (C, struct_timezone);
|
||||
type struct_timezone_ptr is access all struct_timezone;
|
||||
|
||||
-------------------------
|
||||
-- Priority Scheduling --
|
||||
-------------------------
|
||||
|
||||
SCHED_FIFO : constant := 16#00200000#;
|
||||
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 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");
|
||||
|
||||
---------
|
||||
-- LWP --
|
||||
---------
|
||||
|
||||
function lwp_self return System.Address;
|
||||
-- lwp_self does not exist on this thread library, revert to pthread_self
|
||||
-- which is the closest approximation (with getpid). This function is
|
||||
-- needed to share 7staprop.adb across POSIX-like targets.
|
||||
pragma Import (C, lwp_self, "pthread_self");
|
||||
|
||||
-------------
|
||||
-- Threads --
|
||||
-------------
|
||||
|
||||
type Thread_Body is access
|
||||
function (arg : System.Address) return System.Address;
|
||||
pragma Convention (C, Thread_Body);
|
||||
|
||||
function Thread_Body_Access is new
|
||||
Ada.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 st_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;
|
||||
|
||||
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 whether the stack base is available on this target
|
||||
|
||||
function Get_Stack_Base (thread : pthread_t) return Address;
|
||||
pragma Inline (Get_Stack_Base);
|
||||
-- returns the stack base of the specified thread.
|
||||
-- Only call this function when Stack_Base_Available is True.
|
||||
|
||||
function Get_Page_Size return size_t;
|
||||
function Get_Page_Size return Address;
|
||||
pragma Import (C, Get_Page_Size, "getpagesize");
|
||||
-- returns the size of a page, or 0 if this is not relevant on this
|
||||
-- target
|
||||
|
||||
PROT_NONE : constant := 0;
|
||||
PROT_READ : constant := 1;
|
||||
PROT_WRITE : constant := 2;
|
||||
PROT_EXEC : constant := 4;
|
||||
PROT_USER : constant := 8;
|
||||
PROT_ALL : constant := PROT_READ + PROT_WRITE + PROT_EXEC + PROT_USER;
|
||||
|
||||
PROT_ON : constant := PROT_READ;
|
||||
PROT_OFF : constant := PROT_ALL;
|
||||
|
||||
function mprotect (addr : Address; len : size_t; prot : int) return int;
|
||||
pragma Import (C, mprotect);
|
||||
|
||||
-------------------------
|
||||
-- POSIX.1c Section 3 --
|
||||
-------------------------
|
||||
|
||||
function sigwait
|
||||
(set : access sigset_t;
|
||||
sig : access Signal) return int;
|
||||
pragma Inline (sigwait);
|
||||
-- LynxOS has non standard sigwait
|
||||
|
||||
function pthread_kill (thread : pthread_t; sig : Signal) return int;
|
||||
pragma Import (C, pthread_kill, "pthread_kill");
|
||||
|
||||
function pthread_sigmask
|
||||
(how : int;
|
||||
set : access sigset_t;
|
||||
oset : access sigset_t) return int;
|
||||
pragma Import (C, pthread_sigmask, "sigprocmask");
|
||||
|
||||
--------------------------
|
||||
-- POSIX.1c Section 11 --
|
||||
--------------------------
|
||||
|
||||
function pthread_mutexattr_init
|
||||
(attr : access pthread_mutexattr_t) return int;
|
||||
pragma Inline (pthread_mutexattr_init);
|
||||
-- LynxOS has a nonstandard pthread_mutexattr_init
|
||||
|
||||
function pthread_mutexattr_destroy
|
||||
(attr : access pthread_mutexattr_t) return int;
|
||||
pragma Inline (pthread_mutexattr_destroy);
|
||||
-- Lynxos has a nonstandard pthread_mutexattr_destroy
|
||||
|
||||
function pthread_mutex_init
|
||||
(mutex : access pthread_mutex_t;
|
||||
attr : access pthread_mutexattr_t) return int;
|
||||
pragma Inline (pthread_mutex_init);
|
||||
-- LynxOS has a nonstandard pthread_mutex_init
|
||||
|
||||
function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int;
|
||||
pragma Inline (pthread_mutex_destroy);
|
||||
-- LynxOS has a nonstandard pthread_mutex_destroy
|
||||
|
||||
function pthread_mutex_lock (mutex : access pthread_mutex_t) return int;
|
||||
pragma Inline (pthread_mutex_lock);
|
||||
-- LynxOS has a nonstandard pthread_mutex_lock
|
||||
|
||||
function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int;
|
||||
pragma Inline (pthread_mutex_unlock);
|
||||
-- LynxOS has a nonstandard pthread_mutex_unlock
|
||||
|
||||
function pthread_condattr_init
|
||||
(attr : access pthread_condattr_t) return int;
|
||||
pragma Inline (pthread_condattr_init);
|
||||
-- LynxOS has a nonstandard pthread_condattr_init
|
||||
|
||||
function pthread_condattr_destroy
|
||||
(attr : access pthread_condattr_t) return int;
|
||||
pragma Inline (pthread_condattr_destroy);
|
||||
-- LynxOS has a nonstandard pthread_condattr_destroy
|
||||
|
||||
function pthread_cond_init
|
||||
(cond : access pthread_cond_t;
|
||||
attr : access pthread_condattr_t) return int;
|
||||
pragma Inline (pthread_cond_init);
|
||||
-- LynxOS has a non standard pthread_cond_init
|
||||
|
||||
function pthread_cond_destroy (cond : access pthread_cond_t) return int;
|
||||
pragma Inline (pthread_cond_destroy);
|
||||
-- LynxOS has a nonstandard pthread_cond_destroy
|
||||
|
||||
function pthread_cond_signal (cond : access pthread_cond_t) return int;
|
||||
pragma Inline (pthread_cond_signal);
|
||||
-- LynxOS has a nonstandard pthread_cond_signal
|
||||
|
||||
function pthread_cond_wait
|
||||
(cond : access pthread_cond_t;
|
||||
mutex : access pthread_mutex_t) return int;
|
||||
pragma Inline (pthread_cond_wait);
|
||||
-- LynxOS has a nonstandard pthread_cond_wait
|
||||
|
||||
function pthread_cond_timedwait
|
||||
(cond : access pthread_cond_t;
|
||||
mutex : access pthread_mutex_t;
|
||||
reltime : access timespec) return int;
|
||||
pragma Inline (pthread_cond_timedwait);
|
||||
-- LynxOS has a nonstandard pthread_cond_timedwait
|
||||
|
||||
Relative_Timed_Wait : constant Boolean := True;
|
||||
-- pthread_cond_timedwait requires a relative delay time
|
||||
|
||||
--------------------------
|
||||
-- POSIX.1c Section 13 --
|
||||
--------------------------
|
||||
|
||||
PTHREAD_PRIO_NONE : constant := 0;
|
||||
PTHREAD_PRIO_INHERIT : constant := 0;
|
||||
PTHREAD_PRIO_PROTECT : constant := 0;
|
||||
|
||||
type struct_sched_param is record
|
||||
sched_priority : int; -- scheduling priority
|
||||
end record;
|
||||
|
||||
function pthread_setschedparam
|
||||
(thread : pthread_t;
|
||||
policy : int;
|
||||
param : access struct_sched_param) return int;
|
||||
pragma Inline (pthread_setschedparam);
|
||||
-- LynxOS doesn't have pthread_setschedparam.
|
||||
-- Instead, use pthread_setscheduler
|
||||
|
||||
function pthread_mutexattr_setprotocol
|
||||
(attr : access pthread_mutexattr_t;
|
||||
protocol : int) return int;
|
||||
pragma Inline (pthread_mutexattr_setprotocol);
|
||||
-- LynxOS doesn't have pthread_mutexattr_setprotocol
|
||||
|
||||
function pthread_mutexattr_setprioceiling
|
||||
(attr : access pthread_mutexattr_t;
|
||||
prioceiling : int) return int;
|
||||
pragma Inline (pthread_mutexattr_setprioceiling);
|
||||
-- LynxOS doesn't have pthread_mutexattr_setprioceiling
|
||||
|
||||
function pthread_attr_setscope
|
||||
(attr : access pthread_attr_t;
|
||||
contentionscope : int) return int;
|
||||
-- LynxOS doesn't have pthread_attr_setscope: all threads have system scope
|
||||
pragma Inline (pthread_attr_setscope);
|
||||
|
||||
function pthread_attr_setschedpolicy
|
||||
(attr : access pthread_attr_t;
|
||||
policy : int) return int;
|
||||
pragma Import (C, pthread_attr_setschedpolicy, "pthread_attr_setsched");
|
||||
|
||||
function sched_yield return int;
|
||||
-- pragma Import (C, sched_yield, "sched_yield");
|
||||
pragma Inline (sched_yield);
|
||||
|
||||
---------------------------
|
||||
-- P1003.1c - Section 16 --
|
||||
---------------------------
|
||||
|
||||
function pthread_attr_init (attributes : access pthread_attr_t) return int;
|
||||
pragma Import (C, pthread_attr_init, "pthread_attr_create");
|
||||
|
||||
function pthread_attr_destroy
|
||||
(attributes : access pthread_attr_t) return int;
|
||||
pragma Import (C, pthread_attr_destroy, "pthread_attr_delete");
|
||||
|
||||
function pthread_attr_setdetachstate
|
||||
(attr : access pthread_attr_t;
|
||||
detachstate : int) return int;
|
||||
pragma Inline (pthread_attr_setdetachstate);
|
||||
-- LynxOS doesn't have pthread_attr_setdetachstate
|
||||
|
||||
function pthread_attr_setstacksize
|
||||
(attr : access pthread_attr_t;
|
||||
stacksize : size_t) return int;
|
||||
pragma Import (C, pthread_attr_setstacksize, "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);
|
||||
-- LynxOS has a non standard pthread_create
|
||||
|
||||
function pthread_detach (thread : pthread_t) return int;
|
||||
pragma Inline (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");
|
||||
|
||||
--------------------------
|
||||
-- POSIX.1c Section 17 --
|
||||
--------------------------
|
||||
|
||||
function pthread_setspecific
|
||||
(key : pthread_key_t;
|
||||
value : System.Address) return int;
|
||||
pragma Inline (pthread_setspecific);
|
||||
-- LynxOS has a non standard pthread_setspecific
|
||||
|
||||
function pthread_getspecific (key : pthread_key_t) return System.Address;
|
||||
pragma Inline (pthread_getspecific);
|
||||
-- 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;
|
||||
destructor : destructor_pointer) return int;
|
||||
pragma Inline (pthread_key_create);
|
||||
-- LynxOS has a non standard pthread_keycreate
|
||||
|
||||
procedure pthread_init;
|
||||
-- This is a dummy procedure to share some GNULLI files
|
||||
|
||||
private
|
||||
|
||||
type sigbit_array is array (1 .. 2) of long;
|
||||
type sigset_t is record
|
||||
sa_sigbits : sigbit_array;
|
||||
end record;
|
||||
pragma Convention (C_Pass_By_Copy, sigset_t);
|
||||
|
||||
type pid_t is new long;
|
||||
|
||||
type time_t is new long;
|
||||
|
||||
type timespec is record
|
||||
tv_sec : time_t;
|
||||
tv_nsec : long;
|
||||
end record;
|
||||
pragma Convention (C, timespec);
|
||||
|
||||
type st_t is record
|
||||
stksize : int;
|
||||
prio : int;
|
||||
inheritsched : int;
|
||||
state : int;
|
||||
sched : int;
|
||||
end record;
|
||||
pragma Convention (C, st_t);
|
||||
|
||||
type pthread_attr_t is record
|
||||
st : st_t;
|
||||
pthread_attr_scope : int; -- ignored
|
||||
end record;
|
||||
pragma Convention (C, pthread_attr_t);
|
||||
|
||||
type pthread_condattr_t is new int;
|
||||
|
||||
type pthread_mutexattr_t is new int;
|
||||
|
||||
type tid_t is new short;
|
||||
type pthread_t is new tid_t;
|
||||
|
||||
type synch_ptr is access all pthread_mutex_t;
|
||||
type pthread_mutex_t is record
|
||||
w_count : int;
|
||||
mut_owner : int;
|
||||
id : unsigned;
|
||||
next : synch_ptr;
|
||||
end record;
|
||||
pragma Convention (C, pthread_mutex_t);
|
||||
|
||||
type pthread_cond_t is new pthread_mutex_t;
|
||||
|
||||
type pthread_key_t is new int;
|
||||
|
||||
end System.OS_Interface;
|
@ -1,119 +0,0 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- --
|
||||
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
|
||||
-- --
|
||||
-- S Y S T E M . O S _ I N T E R F A C E --
|
||||
-- --
|
||||
-- B o d y --
|
||||
-- --
|
||||
-- Copyright (C) 2001-2010, AdaCore --
|
||||
-- --
|
||||
-- GNAT 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- --
|
||||
-- ware Foundation; either version 3, or (at your option) any later ver- --
|
||||
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
||||
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
||||
-- or FITNESS FOR A PARTICULAR PURPOSE. --
|
||||
-- --
|
||||
-- As a special exception under Section 7 of GPL version 3, you are granted --
|
||||
-- additional permissions described in the GCC Runtime Library Exception, --
|
||||
-- version 3.1, as published by the Free Software Foundation. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License and --
|
||||
-- a copy of the GCC Runtime Library Exception along with this program; --
|
||||
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
|
||||
-- <http://www.gnu.org/licenses/>. --
|
||||
-- --
|
||||
-- GNARL was developed by the GNARL team at Florida State University. --
|
||||
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
|
||||
-- --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
-- This is a LynxOS (POSIX Threads) version of this package
|
||||
|
||||
pragma Polling (Off);
|
||||
-- Turn off polling, we do not want ATC polling to take place during
|
||||
-- tasking operations. It causes infinite loops and other problems.
|
||||
|
||||
package body System.OS_Interface is
|
||||
|
||||
use Interfaces.C;
|
||||
|
||||
-----------------
|
||||
-- To_Duration --
|
||||
-----------------
|
||||
|
||||
function To_Duration (TS : timespec) return Duration is
|
||||
begin
|
||||
return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9;
|
||||
end To_Duration;
|
||||
|
||||
-----------------
|
||||
-- To_Timespec --
|
||||
-----------------
|
||||
|
||||
function To_Timespec (D : Duration) return timespec is
|
||||
S : time_t;
|
||||
F : Duration;
|
||||
|
||||
begin
|
||||
S := time_t (Long_Long_Integer (D));
|
||||
F := D - Duration (S);
|
||||
|
||||
-- If F has negative value due to a round-up, adjust for positive F
|
||||
-- value.
|
||||
|
||||
if F < 0.0 then
|
||||
S := S - 1;
|
||||
F := F + 1.0;
|
||||
end if;
|
||||
|
||||
return timespec'(tv_sec => S,
|
||||
tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
|
||||
end To_Timespec;
|
||||
|
||||
-------------
|
||||
-- sigwait --
|
||||
-------------
|
||||
|
||||
function sigwait
|
||||
(set : access sigset_t;
|
||||
sig : access Signal)
|
||||
return int
|
||||
is
|
||||
function sigwaitinfo
|
||||
(set : access sigset_t;
|
||||
info : System.Address) return Signal;
|
||||
pragma Import (C, sigwaitinfo, "sigwaitinfo");
|
||||
|
||||
begin
|
||||
sig.all := sigwaitinfo (set, Null_Address);
|
||||
|
||||
if sig.all = -1 then
|
||||
return errno;
|
||||
end if;
|
||||
|
||||
return 0;
|
||||
end sigwait;
|
||||
|
||||
--------------------
|
||||
-- Get_Stack_Base --
|
||||
--------------------
|
||||
|
||||
function Get_Stack_Base (thread : pthread_t) return Address is
|
||||
pragma Warnings (Off, thread);
|
||||
|
||||
begin
|
||||
return Null_Address;
|
||||
end Get_Stack_Base;
|
||||
|
||||
------------------
|
||||
-- pthread_init --
|
||||
------------------
|
||||
|
||||
procedure pthread_init is
|
||||
begin
|
||||
null;
|
||||
end pthread_init;
|
||||
|
||||
end System.OS_Interface;
|
@ -1,578 +0,0 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- --
|
||||
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
|
||||
-- --
|
||||
-- S Y S T E M . O S _ I N T E R F A C E --
|
||||
-- --
|
||||
-- S p e c --
|
||||
-- --
|
||||
-- Copyright (C) 1991-1994, Florida State University --
|
||||
-- Copyright (C) 1995-2011, Free Software Foundation, Inc. --
|
||||
-- --
|
||||
-- GNAT 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- --
|
||||
-- ware Foundation; either version 3, or (at your option) any later ver- --
|
||||
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
||||
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
||||
-- or FITNESS FOR A PARTICULAR PURPOSE. --
|
||||
-- --
|
||||
-- As a special exception under Section 7 of GPL version 3, you are granted --
|
||||
-- additional permissions described in the GCC Runtime Library Exception, --
|
||||
-- version 3.1, as published by the Free Software Foundation. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License and --
|
||||
-- a copy of the GCC Runtime Library Exception along with this program; --
|
||||
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
|
||||
-- <http://www.gnu.org/licenses/>. --
|
||||
-- --
|
||||
-- GNARL was developed by the GNARL team at Florida State University. --
|
||||
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
|
||||
-- --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
-- This is a LynxOS (POSIX Threads) version of this package
|
||||
|
||||
-- This package encapsulates all direct interfaces to OS services
|
||||
-- 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;
|
||||
|
||||
package System.OS_Interface is
|
||||
pragma Preelaborate;
|
||||
|
||||
pragma Linker_Options ("-mthreads");
|
||||
-- Selects the POSIX 1.c runtime, rather than the non-threading runtime
|
||||
-- or the deprecated legacy threads library. The -mthreads flag is
|
||||
-- defined in patch.LynxOS and matches the definition for Lynx's gcc.
|
||||
|
||||
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;
|
||||
|
||||
-----------
|
||||
-- Errno --
|
||||
-----------
|
||||
|
||||
function errno return int;
|
||||
pragma Import (C, errno, "__get_errno");
|
||||
|
||||
EAGAIN : constant := 11;
|
||||
EINTR : constant := 4;
|
||||
EINVAL : constant := 22;
|
||||
ENOMEM : constant := 12;
|
||||
ETIMEDOUT : constant := 60;
|
||||
|
||||
-------------
|
||||
-- Signals --
|
||||
-------------
|
||||
|
||||
Max_Interrupt : constant := 63;
|
||||
|
||||
-- Max_Interrupt is the number of OS signals, as defined in:
|
||||
--
|
||||
-- /usr/include/sys/signal.h
|
||||
--
|
||||
--
|
||||
-- The lowest numbered signal is 1, but 0 is a valid argument to some
|
||||
-- library functions, e.g. kill(2). However, 0 is not just another
|
||||
-- signal: For instance 'I in Signal' and similar should be used with
|
||||
-- caution.
|
||||
|
||||
type Signal is new int range 0 .. Max_Interrupt;
|
||||
for Signal'Size use int'Size;
|
||||
|
||||
SIGHUP : constant := 1; -- hangup
|
||||
SIGINT : constant := 2; -- interrupt (rubout)
|
||||
SIGQUIT : constant := 3; -- quit (ASCD FS)
|
||||
SIGILL : constant := 4; -- illegal instruction (not reset)
|
||||
SIGTRAP : constant := 5; -- trace trap (not reset)
|
||||
SIGBRK : constant := 6; -- break
|
||||
SIGIOT : constant := 6; -- IOT instruction
|
||||
SIGABRT : constant := 6; -- used by abort, replace SIGIOT in future
|
||||
SIGCORE : constant := 7; -- kill with core dump
|
||||
SIGEMT : constant := 7; -- EMT instruction
|
||||
SIGFPE : constant := 8; -- floating point exception
|
||||
SIGKILL : constant := 9; -- kill (cannot be caught or ignored)
|
||||
SIGBUS : constant := 10; -- bus error
|
||||
SIGSEGV : constant := 11; -- segmentation violation
|
||||
SIGSYS : constant := 12; -- bad argument to system call
|
||||
SIGPIPE : constant := 13; -- write on a pipe with no one to read it
|
||||
SIGALRM : constant := 14; -- alarm clock
|
||||
SIGTERM : constant := 15; -- software termination signal from kill
|
||||
SIGURG : constant := 16; -- urgent condition on IO channel
|
||||
SIGSTOP : constant := 17; -- stop (cannot be caught or ignored)
|
||||
SIGTSTP : constant := 18; -- user stop requested from tty
|
||||
SIGCONT : constant := 19; -- stopped process has been continued
|
||||
SIGCLD : constant := 20; -- alias for SIGCHLD
|
||||
SIGCHLD : constant := 20; -- child status change
|
||||
SIGTTIN : constant := 21; -- background tty read attempted
|
||||
SIGTTOU : constant := 22; -- background tty write attempted
|
||||
SIGIO : constant := 23; -- I/O possible (Solaris SIGPOLL alias)
|
||||
SIGPOLL : constant := 23; -- pollable event occurred
|
||||
SIGTHREADKILL : constant := 24; -- Reserved by LynxOS runtime
|
||||
SIGXCPU : constant := 24; -- CPU time limit exceeded
|
||||
SIGXFSZ : constant := 25; -- filesize limit exceeded
|
||||
SIGVTALRM : constant := 26; -- virtual timer expired
|
||||
SIGPROF : constant := 27; -- profiling timer expired
|
||||
SIGWINCH : constant := 28; -- window size change
|
||||
SIGLOST : constant := 29; -- SUN 4.1 compatibility
|
||||
SIGUSR1 : constant := 30; -- user defined signal 1
|
||||
SIGUSR2 : constant := 31; -- user defined signal 2
|
||||
|
||||
SIGPRIO : constant := 32;
|
||||
-- sent to a process with its priority or group is changed
|
||||
|
||||
SIGADAABORT : constant := SIGABRT;
|
||||
-- Change this if you want to use another signal for task abort.
|
||||
-- SIGTERM might be a good one.
|
||||
|
||||
type Signal_Set is array (Natural range <>) of Signal;
|
||||
|
||||
Unmasked : constant Signal_Set :=
|
||||
(SIGTRAP, SIGTTIN, SIGTTOU, SIGTSTP, SIGPROF, SIGTHREADKILL);
|
||||
Reserved : constant Signal_Set := (SIGABRT, SIGKILL, SIGSTOP, SIGPRIO);
|
||||
|
||||
type sigset_t is private;
|
||||
|
||||
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 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_SIGINFO : constant := 16#80#;
|
||||
|
||||
SA_ONSTACK : constant := 16#00#;
|
||||
-- SA_ONSTACK is not defined on LynxOS, but it is referred to in the POSIX
|
||||
-- implementation of System.Interrupt_Management. Therefore we define a
|
||||
-- dummy value of zero here so that setting this flag is a nop.
|
||||
|
||||
SIG_BLOCK : constant := 0;
|
||||
SIG_UNBLOCK : constant := 1;
|
||||
SIG_SETMASK : constant := 2;
|
||||
|
||||
SIG_DFL : constant := 0;
|
||||
SIG_IGN : constant := 1;
|
||||
|
||||
function sigaction
|
||||
(sig : Signal;
|
||||
act : struct_sigaction_ptr;
|
||||
oact : struct_sigaction_ptr) return int;
|
||||
pragma Import (C, sigaction, "sigaction");
|
||||
|
||||
----------
|
||||
-- Time --
|
||||
----------
|
||||
|
||||
Time_Slice_Supported : constant Boolean := True;
|
||||
-- Indicates whether time slicing is supported
|
||||
|
||||
type timespec is private;
|
||||
|
||||
type clockid_t is new int;
|
||||
|
||||
function clock_gettime
|
||||
(clock_id : clockid_t;
|
||||
tp : access timespec) return int;
|
||||
pragma Import (C, clock_gettime, "clock_gettime");
|
||||
|
||||
function clock_getres
|
||||
(clock_id : clockid_t;
|
||||
res : access timespec) return int;
|
||||
pragma Import (C, clock_getres, "clock_getres");
|
||||
|
||||
function To_Duration (TS : timespec) return Duration;
|
||||
pragma Inline (To_Duration);
|
||||
|
||||
function To_Timespec (D : Duration) return timespec;
|
||||
pragma Inline (To_Timespec);
|
||||
|
||||
type struct_timezone is record
|
||||
tz_minuteswest : int;
|
||||
tz_dsttime : int;
|
||||
end record;
|
||||
pragma Convention (C, struct_timezone);
|
||||
type struct_timezone_ptr is access all struct_timezone;
|
||||
|
||||
-------------------------
|
||||
-- Priority Scheduling --
|
||||
-------------------------
|
||||
|
||||
SCHED_FIFO : constant := 16#200000#;
|
||||
SCHED_RR : constant := 16#100000#;
|
||||
SCHED_OTHER : constant := 16#400000#;
|
||||
|
||||
-------------
|
||||
-- Process --
|
||||
-------------
|
||||
|
||||
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");
|
||||
|
||||
---------
|
||||
-- LWP --
|
||||
---------
|
||||
|
||||
function lwp_self return System.Address;
|
||||
pragma Import (C, lwp_self, "pthread_self");
|
||||
|
||||
-------------
|
||||
-- Threads --
|
||||
-------------
|
||||
|
||||
type Thread_Body is access
|
||||
function (arg : System.Address) return System.Address;
|
||||
pragma Convention (C, Thread_Body);
|
||||
|
||||
function Thread_Body_Access is new
|
||||
Ada.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;
|
||||
|
||||
PTHREAD_CREATE_DETACHED : constant := 1;
|
||||
PTHREAD_CREATE_JOINABLE : constant := 0;
|
||||
|
||||
-----------
|
||||
-- Stack --
|
||||
-----------
|
||||
|
||||
Alternate_Stack_Size : constant := 0;
|
||||
-- No alternate signal stack is used on this platform
|
||||
|
||||
Stack_Base_Available : constant Boolean := False;
|
||||
-- Indicates whether the stack base is available on this target
|
||||
|
||||
function Get_Stack_Base (thread : pthread_t) return Address;
|
||||
pragma Inline (Get_Stack_Base);
|
||||
-- Returns the stack base of the specified thread.
|
||||
-- Only call this function when Stack_Base_Available is True.
|
||||
|
||||
function Get_Page_Size return size_t;
|
||||
function Get_Page_Size return Address;
|
||||
pragma Import (C, Get_Page_Size, "getpagesize");
|
||||
-- Returns the size of a page, or 0 if this is not relevant on this
|
||||
-- target
|
||||
|
||||
PROT_NONE : constant := 1;
|
||||
PROT_READ : constant := 2;
|
||||
PROT_WRITE : constant := 4;
|
||||
PROT_EXEC : constant := 8;
|
||||
PROT_ALL : constant := PROT_READ + PROT_WRITE + PROT_EXEC;
|
||||
|
||||
PROT_ON : constant := PROT_READ;
|
||||
PROT_OFF : constant := PROT_ALL;
|
||||
|
||||
function mprotect (addr : Address; len : size_t; prot : int) return int;
|
||||
pragma Import (C, mprotect);
|
||||
|
||||
---------------------------------------
|
||||
-- Nonstandard Thread Initialization --
|
||||
---------------------------------------
|
||||
|
||||
procedure pthread_init;
|
||||
-- This is a dummy procedure to share some GNULLI files
|
||||
|
||||
-------------------------
|
||||
-- POSIX.1c Section 3 --
|
||||
-------------------------
|
||||
|
||||
function sigwait
|
||||
(set : access sigset_t;
|
||||
sig : access Signal) return int;
|
||||
pragma Inline (sigwait);
|
||||
-- LynxOS has non standard sigwait
|
||||
|
||||
function pthread_kill
|
||||
(thread : pthread_t;
|
||||
sig : Signal) return int;
|
||||
pragma Import (C, pthread_kill, "pthread_kill");
|
||||
|
||||
function pthread_sigmask
|
||||
(how : int;
|
||||
set : access sigset_t;
|
||||
oset : access sigset_t) return int;
|
||||
pragma Import (C, pthread_sigmask, "pthread_sigmask");
|
||||
-- The behavior of pthread_sigmask on LynxOS requires
|
||||
-- further investigation.
|
||||
|
||||
----------------------------
|
||||
-- POSIX.1c Section 11 --
|
||||
----------------------------
|
||||
|
||||
function pthread_mutexattr_init
|
||||
(attr : access pthread_mutexattr_t) return int;
|
||||
pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init");
|
||||
|
||||
function pthread_mutexattr_destroy
|
||||
(attr : access pthread_mutexattr_t) return int;
|
||||
pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy");
|
||||
|
||||
function pthread_mutex_init
|
||||
(mutex : access pthread_mutex_t;
|
||||
attr : access pthread_mutexattr_t) return int;
|
||||
pragma Import (C, pthread_mutex_init, "pthread_mutex_init");
|
||||
|
||||
function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int;
|
||||
pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy");
|
||||
|
||||
function pthread_mutex_lock (mutex : access pthread_mutex_t) return int;
|
||||
pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock");
|
||||
|
||||
function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int;
|
||||
pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock");
|
||||
|
||||
function pthread_condattr_init
|
||||
(attr : access pthread_condattr_t) return int;
|
||||
pragma Import (C, pthread_condattr_init, "pthread_condattr_init");
|
||||
|
||||
function pthread_condattr_destroy
|
||||
(attr : access pthread_condattr_t) return int;
|
||||
pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy");
|
||||
|
||||
function pthread_cond_init
|
||||
(cond : access pthread_cond_t;
|
||||
attr : access pthread_condattr_t) return int;
|
||||
pragma Import (C, pthread_cond_init, "pthread_cond_init");
|
||||
|
||||
function pthread_cond_destroy (cond : access pthread_cond_t) return int;
|
||||
pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy");
|
||||
|
||||
function pthread_cond_signal (cond : access pthread_cond_t) return int;
|
||||
pragma Import (C, pthread_cond_signal, "pthread_cond_signal");
|
||||
|
||||
function pthread_cond_wait
|
||||
(cond : access pthread_cond_t;
|
||||
mutex : access pthread_mutex_t) return int;
|
||||
pragma Import (C, pthread_cond_wait, "pthread_cond_wait");
|
||||
|
||||
function pthread_cond_timedwait
|
||||
(cond : access pthread_cond_t;
|
||||
mutex : access pthread_mutex_t;
|
||||
abstime : access timespec) return int;
|
||||
pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait");
|
||||
|
||||
Relative_Timed_Wait : constant Boolean := False;
|
||||
-- pthread_cond_timedwait requires an absolute delay time
|
||||
|
||||
--------------------------
|
||||
-- POSIX.1c Section 13 --
|
||||
--------------------------
|
||||
|
||||
PTHREAD_PRIO_NONE : constant := 0;
|
||||
PTHREAD_PRIO_INHERIT : constant := 1;
|
||||
PTHREAD_PRIO_PROTECT : constant := 2;
|
||||
|
||||
function pthread_mutexattr_setprotocol
|
||||
(attr : access pthread_mutexattr_t;
|
||||
protocol : int) return int;
|
||||
pragma Import (C, pthread_mutexattr_setprotocol);
|
||||
|
||||
function pthread_mutexattr_setprioceiling
|
||||
(attr : access pthread_mutexattr_t;
|
||||
prioceiling : int) return int;
|
||||
pragma Import (C, pthread_mutexattr_setprioceiling);
|
||||
|
||||
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 Import (C, pthread_setschedparam, "pthread_setschedparam");
|
||||
|
||||
function pthread_attr_setscope
|
||||
(attr : access pthread_attr_t;
|
||||
contentionscope : int) return int;
|
||||
pragma Import (C, pthread_attr_setscope, "pthread_attr_setscope");
|
||||
|
||||
function pthread_attr_setinheritsched
|
||||
(attr : access pthread_attr_t;
|
||||
inheritsched : int) return int;
|
||||
pragma Import (C, pthread_attr_setinheritsched);
|
||||
|
||||
function pthread_attr_setschedpolicy
|
||||
(attr : access pthread_attr_t;
|
||||
policy : int) return int;
|
||||
pragma Import (C, pthread_attr_setschedpolicy);
|
||||
|
||||
function sched_yield return int;
|
||||
pragma Import (C, sched_yield, "sched_yield");
|
||||
|
||||
--------------------------
|
||||
-- P1003.1c Section 16 --
|
||||
--------------------------
|
||||
|
||||
function pthread_attr_init (attributes : access pthread_attr_t) return int;
|
||||
pragma Import (C, pthread_attr_init, "pthread_attr_init");
|
||||
|
||||
function pthread_attr_destroy
|
||||
(attributes : access pthread_attr_t) return int;
|
||||
pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy");
|
||||
|
||||
function pthread_attr_setdetachstate
|
||||
(attr : access pthread_attr_t;
|
||||
detachstate : int) return int;
|
||||
pragma Import (C, pthread_attr_setdetachstate);
|
||||
|
||||
function pthread_attr_setstacksize
|
||||
(attr : access pthread_attr_t;
|
||||
stacksize : size_t) return int;
|
||||
pragma Import (C, 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 Import (C, pthread_create, "pthread_create");
|
||||
|
||||
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");
|
||||
|
||||
--------------------------
|
||||
-- POSIX.1c Section 17 --
|
||||
--------------------------
|
||||
|
||||
function st_setspecific
|
||||
(key : pthread_key_t;
|
||||
value : System.Address) return int;
|
||||
pragma Import (C, st_setspecific, "st_setspecific");
|
||||
|
||||
function st_getspecific
|
||||
(key : pthread_key_t;
|
||||
retval : System.Address) return int;
|
||||
pragma Import (C, st_getspecific, "st_getspecific");
|
||||
|
||||
type destructor_pointer is access procedure (arg : System.Address);
|
||||
pragma Convention (C, destructor_pointer);
|
||||
|
||||
function st_keycreate
|
||||
(destructor : destructor_pointer;
|
||||
key : access pthread_key_t) return int;
|
||||
pragma Import (C, st_keycreate, "st_keycreate");
|
||||
|
||||
private
|
||||
|
||||
type sigset_t is record
|
||||
X1, X2 : long;
|
||||
end record;
|
||||
pragma Convention (C, sigset_t);
|
||||
|
||||
type pid_t is new long;
|
||||
|
||||
type time_t is new long;
|
||||
|
||||
type timespec is record
|
||||
tv_sec : time_t;
|
||||
tv_nsec : long;
|
||||
end record;
|
||||
pragma Convention (C, timespec);
|
||||
|
||||
type st_attr_t is record
|
||||
stksize : int;
|
||||
prio : int;
|
||||
inheritsched : int;
|
||||
state : int;
|
||||
sched : int;
|
||||
detachstate : int;
|
||||
guardsize : int;
|
||||
end record;
|
||||
pragma Convention (C, st_attr_t);
|
||||
|
||||
type pthread_attr_t is record
|
||||
pthread_attr_magic : unsigned;
|
||||
st : st_attr_t;
|
||||
pthread_attr_scope : int;
|
||||
end record;
|
||||
pragma Convention (C, pthread_attr_t);
|
||||
|
||||
type pthread_condattr_t is record
|
||||
cv_magic : unsigned;
|
||||
cv_pshared : unsigned;
|
||||
end record;
|
||||
pragma Convention (C, pthread_condattr_t);
|
||||
|
||||
type pthread_mutexattr_t is record
|
||||
m_flags : unsigned;
|
||||
m_prio_c : int;
|
||||
m_pshared : int;
|
||||
end record;
|
||||
pragma Convention (C, pthread_mutexattr_t);
|
||||
|
||||
type tid_t is new short;
|
||||
type pthread_t is new tid_t;
|
||||
|
||||
type block_obj_t is new System.Address;
|
||||
-- typedef struct _block_obj_s {
|
||||
-- struct st_entry *b_head;
|
||||
-- } block_obj_t;
|
||||
|
||||
type pthread_mutex_t is record
|
||||
m_flags : unsigned;
|
||||
m_owner : tid_t;
|
||||
m_wait : block_obj_t;
|
||||
m_prio_c : int;
|
||||
m_oldprio : int;
|
||||
m_count : int;
|
||||
m_referenced : int;
|
||||
end record;
|
||||
pragma Convention (C, pthread_mutex_t);
|
||||
type pthread_mutex_t_ptr is access all pthread_mutex_t;
|
||||
|
||||
type pthread_cond_t is record
|
||||
cv_magic : unsigned;
|
||||
cv_wait : block_obj_t;
|
||||
cv_mutex : pthread_mutex_t_ptr;
|
||||
cv_refcnt : int;
|
||||
end record;
|
||||
pragma Convention (C, pthread_cond_t);
|
||||
|
||||
type pthread_key_t is new int;
|
||||
|
||||
end System.OS_Interface;
|
File diff suppressed because it is too large
Load Diff
@ -1,111 +0,0 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- --
|
||||
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
|
||||
-- --
|
||||
-- SYSTEM.TASK_PRIMITIVES.OPERATIONS.SPECIFIC --
|
||||
-- --
|
||||
-- B o d y --
|
||||
-- --
|
||||
-- Copyright (C) 1992-2009, 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- --
|
||||
-- ware Foundation; either version 3, or (at your option) any later ver- --
|
||||
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
||||
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
||||
-- or FITNESS FOR A PARTICULAR PURPOSE. --
|
||||
-- --
|
||||
-- As a special exception under Section 7 of GPL version 3, you are granted --
|
||||
-- additional permissions described in the GCC Runtime Library Exception, --
|
||||
-- version 3.1, as published by the Free Software Foundation. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License and --
|
||||
-- a copy of the GCC Runtime Library Exception along with this program; --
|
||||
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
|
||||
-- <http://www.gnu.org/licenses/>. --
|
||||
-- --
|
||||
-- GNARL was developed by the GNARL team at Florida State University. --
|
||||
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
|
||||
-- --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
-- This is a LynxOS version of this package.
|
||||
|
||||
separate (System.Task_Primitives.Operations)
|
||||
package body Specific is
|
||||
|
||||
----------------
|
||||
-- Initialize --
|
||||
----------------
|
||||
|
||||
procedure Initialize (Environment_Task : Task_Id) is
|
||||
pragma Warnings (Off, Environment_Task);
|
||||
Result : Interfaces.C.int;
|
||||
|
||||
begin
|
||||
Result := st_keycreate (null, ATCB_Key'Access);
|
||||
pragma Assert (Result = 0);
|
||||
end Initialize;
|
||||
|
||||
-------------------
|
||||
-- Is_Valid_Task --
|
||||
-------------------
|
||||
|
||||
function Is_Valid_Task return Boolean is
|
||||
Result : Interfaces.C.int;
|
||||
Value : aliased System.Address;
|
||||
begin
|
||||
Result := st_getspecific (ATCB_Key, Value'Address);
|
||||
pragma Assert (Result = 0);
|
||||
return (Value /= System.Null_Address);
|
||||
end Is_Valid_Task;
|
||||
|
||||
---------
|
||||
-- Set --
|
||||
---------
|
||||
|
||||
procedure Set (Self_Id : Task_Id) is
|
||||
Result : Interfaces.C.int;
|
||||
|
||||
begin
|
||||
Result := st_setspecific (ATCB_Key, To_Address (Self_Id));
|
||||
pragma Assert (Result = 0);
|
||||
end Set;
|
||||
|
||||
----------
|
||||
-- Self --
|
||||
----------
|
||||
|
||||
-- To make Ada tasks and C threads interoperate better, we have added some
|
||||
-- functionality to Self. Suppose a C main program (with threads) calls an
|
||||
-- Ada procedure and the Ada procedure calls the tasking runtime system.
|
||||
-- Eventually, a call will be made to self. Since the call is not coming
|
||||
-- from an Ada task, there will be no corresponding ATCB.
|
||||
|
||||
-- What we do in Self is to catch references that do not come from
|
||||
-- recognized Ada tasks, and create an ATCB for the calling thread.
|
||||
|
||||
-- The new ATCB will be "detached" from the normal Ada task master
|
||||
-- hierarchy, much like the existing implicitly created signal-server
|
||||
-- tasks.
|
||||
|
||||
function Self return Task_Id is
|
||||
Value : aliased System.Address;
|
||||
|
||||
Result : Interfaces.C.int;
|
||||
pragma Unreferenced (Result);
|
||||
|
||||
begin
|
||||
Result := st_getspecific (ATCB_Key, Value'Address);
|
||||
-- Is it OK not to check this result???
|
||||
|
||||
-- If the key value is Null, then it is a non-Ada task.
|
||||
|
||||
if Value /= System.Null_Address then
|
||||
return To_Task_Id (Value);
|
||||
else
|
||||
return Register_Foreign_Thread;
|
||||
end if;
|
||||
end Self;
|
||||
|
||||
end Specific;
|
@ -1,157 +0,0 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- --
|
||||
-- GNAT RUN-TIME COMPONENTS --
|
||||
-- --
|
||||
-- S Y S T E M --
|
||||
-- --
|
||||
-- S p e c --
|
||||
-- (LynxOS PPC Version) --
|
||||
-- --
|
||||
-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
|
||||
-- --
|
||||
-- This specification is derived from the Ada Reference Manual for use with --
|
||||
-- GNAT. The copyright notice above, and the license provisions that follow --
|
||||
-- apply solely to the contents of the part following the private keyword. --
|
||||
-- --
|
||||
-- GNAT 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- --
|
||||
-- ware Foundation; either version 3, or (at your option) any later ver- --
|
||||
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
||||
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
||||
-- or FITNESS FOR A PARTICULAR PURPOSE. --
|
||||
-- --
|
||||
-- As a special exception under Section 7 of GPL version 3, you are granted --
|
||||
-- additional permissions described in the GCC Runtime Library Exception, --
|
||||
-- version 3.1, as published by the Free Software Foundation. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License and --
|
||||
-- a copy of the GCC Runtime Library Exception along with this program; --
|
||||
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
|
||||
-- <http://www.gnu.org/licenses/>. --
|
||||
-- --
|
||||
-- GNAT was originally developed by the GNAT team at New York University. --
|
||||
-- Extensive contributions were provided by Ada Core Technologies Inc. --
|
||||
-- --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
package System is
|
||||
pragma Pure;
|
||||
-- Note that we take advantage of the implementation permission to make
|
||||
-- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada
|
||||
-- 2005, this is Pure in any case (AI-362).
|
||||
|
||||
type Name is (SYSTEM_NAME_GNAT);
|
||||
System_Name : constant Name := SYSTEM_NAME_GNAT;
|
||||
|
||||
-- System-Dependent Named Numbers
|
||||
|
||||
Min_Int : constant := Long_Long_Integer'First;
|
||||
Max_Int : constant := Long_Long_Integer'Last;
|
||||
|
||||
Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
|
||||
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
|
||||
|
||||
Max_Base_Digits : constant := Long_Long_Float'Digits;
|
||||
Max_Digits : constant := Long_Long_Float'Digits;
|
||||
|
||||
Max_Mantissa : constant := 63;
|
||||
Fine_Delta : constant := 2.0 ** (-Max_Mantissa);
|
||||
|
||||
Tick : constant := 0.01;
|
||||
|
||||
-- Storage-related Declarations
|
||||
|
||||
type Address is private;
|
||||
pragma Preelaborable_Initialization (Address);
|
||||
Null_Address : constant Address;
|
||||
|
||||
Storage_Unit : constant := 8;
|
||||
Word_Size : constant := 32;
|
||||
Memory_Size : constant := 2 ** 32;
|
||||
|
||||
-- Address comparison
|
||||
|
||||
function "<" (Left, Right : Address) return Boolean;
|
||||
function "<=" (Left, Right : Address) return Boolean;
|
||||
function ">" (Left, Right : Address) return Boolean;
|
||||
function ">=" (Left, Right : Address) return Boolean;
|
||||
function "=" (Left, Right : Address) return Boolean;
|
||||
|
||||
pragma Import (Intrinsic, "<");
|
||||
pragma Import (Intrinsic, "<=");
|
||||
pragma Import (Intrinsic, ">");
|
||||
pragma Import (Intrinsic, ">=");
|
||||
pragma Import (Intrinsic, "=");
|
||||
|
||||
-- Other System-Dependent Declarations
|
||||
|
||||
type Bit_Order is (High_Order_First, Low_Order_First);
|
||||
Default_Bit_Order : constant Bit_Order := High_Order_First;
|
||||
pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning
|
||||
|
||||
-- Priority-related Declarations (RM D.1)
|
||||
|
||||
-- 17 is the system determined default priority for user applications
|
||||
-- running on LynxOS.
|
||||
|
||||
-- The standard (Rm 13.7) requires that Default_Priority has the value:
|
||||
|
||||
-- (Priority'First + Priority'Last) / 2
|
||||
|
||||
-- To allow an appropriate value for Default_Priority and expose a useful
|
||||
-- range of priorities to the user, we use a range of 0 .. 34 for subtype
|
||||
-- Priority.
|
||||
|
||||
-- The rest of the range allowed by the system from 35 to 255 is made
|
||||
-- available here in Interrupt_Priority.
|
||||
|
||||
Max_Priority : constant Positive := 34;
|
||||
Max_Interrupt_Priority : constant Positive := 255;
|
||||
|
||||
subtype Any_Priority is Integer range 0 .. 255;
|
||||
subtype Priority is Any_Priority range 0 .. 34;
|
||||
subtype Interrupt_Priority is Any_Priority range 35 .. 255;
|
||||
|
||||
Default_Priority : constant Priority := 17;
|
||||
|
||||
private
|
||||
|
||||
type Address is mod Memory_Size;
|
||||
Null_Address : constant Address := 0;
|
||||
|
||||
--------------------------------------
|
||||
-- System Implementation Parameters --
|
||||
--------------------------------------
|
||||
|
||||
-- These parameters provide information about the target that is used
|
||||
-- by the compiler. They are in the private part of System, where they
|
||||
-- can be accessed using the special circuitry in the Targparm unit
|
||||
-- whose source should be consulted for more detailed descriptions
|
||||
-- of the individual switch values.
|
||||
|
||||
Backend_Divide_Checks : constant Boolean := False;
|
||||
Backend_Overflow_Checks : constant Boolean := False;
|
||||
Command_Line_Args : constant Boolean := True;
|
||||
Configurable_Run_Time : constant Boolean := False;
|
||||
Denorm : constant Boolean := True;
|
||||
Duration_32_Bits : constant Boolean := False;
|
||||
Exit_Status_Supported : constant Boolean := True;
|
||||
Fractional_Fixed_Ops : constant Boolean := False;
|
||||
Frontend_Layout : constant Boolean := False;
|
||||
Machine_Overflows : constant Boolean := False;
|
||||
Machine_Rounds : constant Boolean := True;
|
||||
Preallocated_Stacks : constant Boolean := False;
|
||||
Signed_Zeros : constant Boolean := True;
|
||||
Stack_Check_Default : constant Boolean := False;
|
||||
Stack_Check_Probes : constant Boolean := True;
|
||||
Stack_Check_Limits : constant Boolean := False;
|
||||
Support_Aggregates : constant Boolean := True;
|
||||
Support_Composite_Assign : constant Boolean := True;
|
||||
Support_Composite_Compare : constant Boolean := True;
|
||||
Support_Long_Shifts : constant Boolean := True;
|
||||
Always_Compatible_Rep : constant Boolean := False;
|
||||
Suppress_Standard_Library : constant Boolean := False;
|
||||
Use_Ada_Main_Program_Name : constant Boolean := False;
|
||||
ZCX_By_Default : constant Boolean := False;
|
||||
|
||||
end System;
|
@ -1,158 +0,0 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- --
|
||||
-- GNAT RUN-TIME COMPONENTS --
|
||||
-- --
|
||||
-- S Y S T E M --
|
||||
-- --
|
||||
-- S p e c --
|
||||
-- (LynxOS x86 Version) --
|
||||
-- --
|
||||
-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
|
||||
-- --
|
||||
-- This specification is derived from the Ada Reference Manual for use with --
|
||||
-- GNAT. The copyright notice above, and the license provisions that follow --
|
||||
-- apply solely to the contents of the part following the private keyword. --
|
||||
-- --
|
||||
-- GNAT 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- --
|
||||
-- ware Foundation; either version 3, or (at your option) any later ver- --
|
||||
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
||||
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
||||
-- or FITNESS FOR A PARTICULAR PURPOSE. --
|
||||
-- --
|
||||
-- As a special exception under Section 7 of GPL version 3, you are granted --
|
||||
-- additional permissions described in the GCC Runtime Library Exception, --
|
||||
-- version 3.1, as published by the Free Software Foundation. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License and --
|
||||
-- a copy of the GCC Runtime Library Exception along with this program; --
|
||||
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
|
||||
-- <http://www.gnu.org/licenses/>. --
|
||||
-- --
|
||||
-- GNAT was originally developed by the GNAT team at New York University. --
|
||||
-- Extensive contributions were provided by Ada Core Technologies Inc. --
|
||||
-- --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
package System is
|
||||
pragma Pure;
|
||||
-- Note that we take advantage of the implementation permission to make
|
||||
-- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada
|
||||
-- 2005, this is Pure in any case (AI-362).
|
||||
|
||||
type Name is (SYSTEM_NAME_GNAT);
|
||||
System_Name : constant Name := SYSTEM_NAME_GNAT;
|
||||
|
||||
-- System-Dependent Named Numbers
|
||||
|
||||
Min_Int : constant := Long_Long_Integer'First;
|
||||
Max_Int : constant := Long_Long_Integer'Last;
|
||||
|
||||
Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
|
||||
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
|
||||
|
||||
Max_Base_Digits : constant := Long_Long_Float'Digits;
|
||||
Max_Digits : constant := Long_Long_Float'Digits;
|
||||
|
||||
Max_Mantissa : constant := 63;
|
||||
Fine_Delta : constant := 2.0 ** (-Max_Mantissa);
|
||||
|
||||
Tick : constant := 0.01;
|
||||
|
||||
-- Storage-related Declarations
|
||||
|
||||
type Address is private;
|
||||
pragma Preelaborable_Initialization (Address);
|
||||
Null_Address : constant Address;
|
||||
|
||||
Storage_Unit : constant := 8;
|
||||
Word_Size : constant := 32;
|
||||
Memory_Size : constant := 2 ** 32;
|
||||
|
||||
-- Address comparison
|
||||
|
||||
function "<" (Left, Right : Address) return Boolean;
|
||||
function "<=" (Left, Right : Address) return Boolean;
|
||||
function ">" (Left, Right : Address) return Boolean;
|
||||
function ">=" (Left, Right : Address) return Boolean;
|
||||
function "=" (Left, Right : Address) return Boolean;
|
||||
|
||||
pragma Import (Intrinsic, "<");
|
||||
pragma Import (Intrinsic, "<=");
|
||||
pragma Import (Intrinsic, ">");
|
||||
pragma Import (Intrinsic, ">=");
|
||||
pragma Import (Intrinsic, "=");
|
||||
|
||||
-- Other System-Dependent Declarations
|
||||
|
||||
type Bit_Order is (High_Order_First, Low_Order_First);
|
||||
Default_Bit_Order : constant Bit_Order := Low_Order_First;
|
||||
pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning
|
||||
|
||||
-- Priority-related Declarations (RM D.1)
|
||||
|
||||
-- 17 is the system determined default priority for user applications
|
||||
-- running on LynxOS.
|
||||
|
||||
-- The standard (Rm 13.7) requires that Default_Priority has the value:
|
||||
|
||||
-- (Priority'First + Priority'Last) / 2
|
||||
|
||||
-- To allow an appropriate value for Default_Priority and expose a useful
|
||||
-- range of priorities to the user, we use a range of 0 .. 34 for subtype
|
||||
-- Priority.
|
||||
|
||||
-- The rest of the range allowed by the system from 35 to 255 is made
|
||||
-- available here in Interrupt_Priority.
|
||||
|
||||
Max_Priority : constant Positive := 34;
|
||||
Max_Interrupt_Priority : constant Positive := 255;
|
||||
|
||||
subtype Any_Priority is Integer range 0 .. 255;
|
||||
subtype Priority is Any_Priority range 0 .. 34;
|
||||
subtype Interrupt_Priority is Any_Priority range 35 .. 255;
|
||||
|
||||
Default_Priority : constant Priority := 17;
|
||||
|
||||
private
|
||||
|
||||
type Address is mod Memory_Size;
|
||||
Null_Address : constant Address := 0;
|
||||
|
||||
--------------------------------------
|
||||
-- System Implementation Parameters --
|
||||
--------------------------------------
|
||||
|
||||
-- These parameters provide information about the target that is used
|
||||
-- by the compiler. They are in the private part of System, where they
|
||||
-- can be accessed using the special circuitry in the Targparm unit
|
||||
-- whose source should be consulted for more detailed descriptions
|
||||
-- of the individual switch values.
|
||||
|
||||
Backend_Divide_Checks : constant Boolean := False;
|
||||
Backend_Overflow_Checks : constant Boolean := False;
|
||||
Command_Line_Args : constant Boolean := True;
|
||||
Configurable_Run_Time : constant Boolean := False;
|
||||
Denorm : constant Boolean := True;
|
||||
Duration_32_Bits : constant Boolean := False;
|
||||
Exit_Status_Supported : constant Boolean := True;
|
||||
Fractional_Fixed_Ops : constant Boolean := False;
|
||||
Frontend_Layout : constant Boolean := False;
|
||||
Machine_Overflows : constant Boolean := False;
|
||||
Machine_Rounds : constant Boolean := True;
|
||||
Preallocated_Stacks : constant Boolean := False;
|
||||
Signed_Zeros : constant Boolean := True;
|
||||
Stack_Check_Default : constant Boolean := False;
|
||||
Stack_Check_Probes : constant Boolean := True;
|
||||
Stack_Check_Limits : constant Boolean := False;
|
||||
Support_Aggregates : constant Boolean := True;
|
||||
Support_Atomic_Primitives : constant Boolean := True;
|
||||
Support_Composite_Assign : constant Boolean := True;
|
||||
Support_Composite_Compare : constant Boolean := True;
|
||||
Support_Long_Shifts : constant Boolean := True;
|
||||
Always_Compatible_Rep : constant Boolean := False;
|
||||
Suppress_Standard_Library : constant Boolean := False;
|
||||
Use_Ada_Main_Program_Name : constant Boolean := False;
|
||||
ZCX_By_Default : constant Boolean := False;
|
||||
|
||||
end System;
|
Loading…
Reference in New Issue
Block a user