------------------------------------------------------------------------------
-- --
--- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
+-- 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-2004, Free Software Foundation, Inc. --
+-- Copyright (C) 1995-2010, Free Software Foundation, Inc. --
-- --
--- GNARL is free software; you can redistribute it and/or modify it under --
+-- 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 2, or (at your option) any later ver- --
--- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
+-- 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 GNARL; see file COPYING. If not, write --
--- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
--- MA 02111-1307, USA. --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
+-- 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 OpenVMS/Alpha version of this package
-- This package encapsulates all direct interfaces to OS services
--- that are needed by children of System.
+-- that are needed by the tasking run-time (libgnarl).
-- PLEASE DO NOT add any with-clauses to this package or remove the pragma
-- Preelaborate. This package is designed to be a bottom-level (leaf) package.
with Interfaces.C;
-with Unchecked_Conversion;
+
+with Ada.Unchecked_Conversion;
+
+with System.Aux_DEC;
package System.OS_Interface is
pragma Preelaborate;
pragma Linker_Options ("--for-linker=sys$library:pthread$rtl.exe");
- -- Link in the DEC threads library.
+ -- Link in the DEC threads library
-- pragma Linker_Options ("--for-linker=/threads_enable");
-- Enable upcalls and multiple kernel threads.
subtype Interrupt_Number_Type is unsigned_long;
- -- OpenVMS system services return values of type Cond_Value_Type.
+ -- OpenVMS system services return values of type Cond_Value_Type
subtype Cond_Value_Type is unsigned_long;
subtype Short_Cond_Value_Type is unsigned_short;
end record;
type AST_Handler is access procedure (Param : Address);
+ pragma Convention (C, AST_Handler);
No_AST_Handler : constant AST_Handler := null;
CMB_M_READONLY : constant := 16#00000001#;
procedure Sys_Assign
(Status : out Cond_Value_Type;
- Devnam : in String;
+ Devnam : String;
Chan : out unsigned_short;
- Acmode : in unsigned_short := 0;
- Mbxnam : in String := String'Null_Parameter;
- Flags : in unsigned_long := 0);
+ Acmode : unsigned_short := 0;
+ Mbxnam : String := String'Null_Parameter;
+ Flags : unsigned_long := 0);
pragma Interface (External, Sys_Assign);
pragma Import_Valued_Procedure
(Sys_Assign, "SYS$ASSIGN",
--
procedure Sys_Cantim
(Status : out Cond_Value_Type;
- Reqidt : in Address;
- Acmode : in unsigned);
+ Reqidt : Address;
+ Acmode : unsigned);
pragma Interface (External, Sys_Cantim);
pragma Import_Valued_Procedure
(Sys_Cantim, "SYS$CANTIM",
--
procedure Sys_Crembx
(Status : out Cond_Value_Type;
- Prmflg : in Boolean;
+ Prmflg : unsigned_char;
Chan : out unsigned_short;
- Maxmsg : in unsigned_long := 0;
- Bufquo : in unsigned_long := 0;
- Promsk : in unsigned_short := 0;
- Acmode : in unsigned_short := 0;
- Lognam : in String;
- Flags : in unsigned_long := 0);
+ Maxmsg : unsigned_long := 0;
+ Bufquo : unsigned_long := 0;
+ Promsk : unsigned_short := 0;
+ Acmode : unsigned_short := 0;
+ Lognam : String;
+ Flags : unsigned_long := 0);
pragma Interface (External, Sys_Crembx);
pragma Import_Valued_Procedure
(Sys_Crembx, "SYS$CREMBX",
- (Cond_Value_Type, Boolean, unsigned_short,
+ (Cond_Value_Type, unsigned_char, unsigned_short,
unsigned_long, unsigned_long, unsigned_short,
unsigned_short, String, unsigned_long),
(Value, Value, Reference,
procedure Sys_QIO
(Status : out Cond_Value_Type;
- EFN : in unsigned_long := 0;
- Chan : in unsigned_short;
- Func : in unsigned_long := 0;
+ EFN : unsigned_long := 0;
+ Chan : unsigned_short;
+ Func : unsigned_long := 0;
Iosb : out IO_Status_Block_Type;
- Astadr : in AST_Handler := No_AST_Handler;
- Astprm : in Address := Null_Address;
- P1 : in unsigned_long := 0;
- P2 : in unsigned_long := 0;
- P3 : in unsigned_long := 0;
- P4 : in unsigned_long := 0;
- P5 : in unsigned_long := 0;
- P6 : in unsigned_long := 0);
+ Astadr : AST_Handler := No_AST_Handler;
+ Astprm : Address := Null_Address;
+ P1 : unsigned_long := 0;
+ P2 : unsigned_long := 0;
+ P3 : unsigned_long := 0;
+ P4 : unsigned_long := 0;
+ P5 : unsigned_long := 0;
+ P6 : unsigned_long := 0);
procedure Sys_QIO
(Status : out Cond_Value_Type;
- EFN : in unsigned_long := 0;
- Chan : in unsigned_short;
- Func : in unsigned_long := 0;
- Iosb : in Address := Null_Address;
- Astadr : in AST_Handler := No_AST_Handler;
- Astprm : in Address := Null_Address;
- P1 : in unsigned_long := 0;
- P2 : in unsigned_long := 0;
- P3 : in unsigned_long := 0;
- P4 : in unsigned_long := 0;
- P5 : in unsigned_long := 0;
- P6 : in unsigned_long := 0);
+ EFN : unsigned_long := 0;
+ Chan : unsigned_short;
+ Func : unsigned_long := 0;
+ Iosb : Address := Null_Address;
+ Astadr : AST_Handler := No_AST_Handler;
+ Astprm : Address := Null_Address;
+ P1 : unsigned_long := 0;
+ P2 : unsigned_long := 0;
+ P3 : unsigned_long := 0;
+ P4 : unsigned_long := 0;
+ P5 : unsigned_long := 0;
+ P6 : unsigned_long := 0);
pragma Interface (External, Sys_QIO);
pragma Import_Valued_Procedure
--
procedure Sys_Setimr
(Status : out Cond_Value_Type;
- EFN : in unsigned_long;
- Tim : in Long_Integer;
- AST : in AST_Handler;
- Reqidt : in Address;
- Flags : in unsigned_long);
+ EFN : unsigned_long;
+ Tim : Long_Integer;
+ AST : AST_Handler;
+ Reqidt : Address;
+ Flags : unsigned_long);
pragma Interface (External, Sys_Setimr);
pragma Import_Valued_Procedure
(Sys_Setimr, "SYS$SETIMR",
type Thread_Body is access
function (arg : System.Address) return System.Address;
+ pragma Convention (C, Thread_Body);
function Thread_Body_Access is new
- Unchecked_Conversion (System.Address, Thread_Body);
+ Ada.Unchecked_Conversion (System.Aux_DEC.Short_Address, Thread_Body);
type pthread_t is private;
subtype Thread_Id is pthread_t;
(newtype : int; oldtype : access int) return int;
pragma Import (C, pthread_setcanceltype, "PTHREAD_SETCANCELTYPE");
- ---------------------------
- -- POSIX.1c Section 3 --
- ---------------------------
+ -------------------------
+ -- POSIX.1c Section 3 --
+ -------------------------
function pthread_lock_global_np return int;
pragma Import (C, pthread_lock_global_np, "PTHREAD_LOCK_GLOBAL_NP");
function pthread_unlock_global_np return int;
pragma Import (C, pthread_unlock_global_np, "PTHREAD_UNLOCK_GLOBAL_NP");
- ----------------------------
- -- POSIX.1c Section 11 --
- ----------------------------
+ --------------------------
+ -- POSIX.1c Section 11 --
+ --------------------------
function pthread_mutexattr_init
(attr : access pthread_mutexattr_t) return int;
function sched_yield return int;
- -----------------------------
- -- P1003.1c - Section 16 --
- -----------------------------
+ --------------------------
+ -- P1003.1c Section 16 --
+ --------------------------
function pthread_attr_init (attributes : access pthread_attr_t) return int;
pragma Import (C, pthread_attr_init, "PTHREAD_ATTR_INIT");
pragma Import (C, pthread_getspecific, "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;