------------------------------------------------------------------------------ -- -- -- POSIX ADA LANGUAGE INTERFACES COMPONENTS -- -- -- -- P O S I X . I O -- -- -- -- S p e c -- -- -- -- $Revision: 1.3 $ -- -- -- -- -- -- This package specification is part of the Florida State -- -- University (FSU) prototype implementation of IEEE Draft Std -- -- 1003.5b, for use with the Gnu NYU Ada Translator (GNAT) and the -- -- FSU Gnu Ada Runtime Library (GNARL). -- -- -- -- This package specification contains some text extracted from IEEE -- -- Draft Std 1003.5b/D5 (August 1995), IEEE Draft Standard for -- -- Information Technology -- POSIX Ada Language Interfaces -- Part 1: -- -- Binding for System Application Program Interface, Amendment 1: -- -- Realtime Extensions, copyright 1995 by the Institute of Electrical -- -- and Electronics Engineers, Inc. -- -- -- -- This package specification differs from the package specifications -- -- in IEEE Draft Std 1003.5/D5 in several respects. For example, it -- -- includes additional with-clause dependences, comments, and -- -- complete definitions for certain types, ranges, and constants that -- -- are left implementation-defined in the draft standard. These -- -- differences appear to be within the scope of variation which the -- -- draft standard permits for implementations, but no warranty is -- -- made to that effect. -- -- -- -- These package specifications are distributed in the hope that they -- -- will be useful, but WITHOUT ANY WARRANTY; without even the implied -- -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- The package specifications in IEEE Draft Std 1003.5b/D5 represent -- -- only a portion of the document and are not to be interpreteted -- -- outside the context of the document, nor is the draft document to -- -- be interpreted as an approved consensus standard. -- -- -- -- When IEEE Std 1003.5b is approved, it must be used in conjunction -- -- with the final version of the package specifications contained in -- -- that document in order to claim conformance. The IEEE takes no -- -- responsibility for and will assume no liability for damages -- -- resulting from the reader's misinterpretation of said information -- -- resulting from its out-of-context nature. To order copies of the -- -- IEEE Draft Std 1003.5/D5, please contact the IEEE Service Center -- -- at 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331; via -- -- phone at 1-800-678-IEEE, 908-981-1393; or via fax at 908-981-9667. -- -- -- -- For bodies to these packages, and other free products of the FSU -- -- POSIX/Ada Real-Time project, see the ftp site "ftp.cs.fsu.edu", -- -- subdirectory "pub/PART", or send e-mail to "part@ada.cs.fsu.edu". -- -- -- ------------------------------------------------------------------------------ with POSIX, Low_Levels, POSIX.Signals, POSIX.Permissions, Unchecked_Conversion, POSIX.Convert_A_To_C, Implementation_Constants; package POSIX.IO is package LL renames Low_Levels; type File_Descriptor is range 0 .. POSIX.Open_Files_Maxima'Last - 1; Standard_Input : constant File_Descriptor := 0; Standard_Output : constant File_Descriptor := 1; Standard_Error : constant File_Descriptor := 2; type IO_Offset is new LL.off_t; -- File Modes and Options type File_Mode is (Read_Only, Write_Only, Read_Write); type Open_Option_Set is new POSIX.Option_Set; -- Empty_Set, "+" and unary and binary "-" are derived operations -- to convert an Integer to an Open_Option_Set function Integer_To_Open_Option_Set is new Unchecked_Conversion (source => Integer, target => Open_Option_Set); Non_Blocking : constant Open_Option_Set := Integer_To_Open_Option_Set (Implementation_Constants.Non_Blocking); Append : constant Open_Option_Set := Integer_To_Open_Option_Set (Implementation_Constants.Append); Truncate : constant Open_Option_Set := Integer_To_Open_Option_Set (Implementation_Constants.Truncate); Exclusive : constant Open_Option_Set := Integer_To_Open_Option_Set (Implementation_Constants.Exclusive); Not_Controlling_Terminal : constant Open_Option_Set := Integer_To_Open_Option_Set (Implementation_Constants.Not_Controlling_Terminal); -- Operations to open or close file descriptors function Open (Name : POSIX.Pathname; Mode : File_Mode; Options : Open_Option_Set := Empty_Set; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) return File_Descriptor; function Open_Or_Create (Name : POSIX.Pathname; Mode : File_Mode; Permissions : POSIX.Permissions.Permission_Set; Options : Open_Option_Set := Empty_Set; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) return File_Descriptor; function Is_Open (File : File_Descriptor) return Boolean; procedure Close (File : in File_Descriptor; Masked_Signals : in POSIX.Signal_Masking := POSIX.RTS_Signals); function Duplicate (File : File_Descriptor; Target : File_Descriptor := 0) return File_Descriptor; function Duplicate_and_Close (File : File_Descriptor; Target : File_Descriptor := 0; Masked_Signals : POSIX.Signal_Masking := POSIX.RTS_Signals) return File_Descriptor; procedure Create_Pipe (Read_End : out File_Descriptor; Write_End : out File_Descriptor); -- File Input/Output operations subtype IO_Buffer is POSIX.POSIX_String; procedure Read (File : in File_Descriptor; Buffer : out IO_Buffer; Last : out POSIX.IO_Count; Masked_Signals : in POSIX.Signal_Masking := POSIX.RTS_Signals); procedure Read (File : in File_Descriptor; Buffer : out Ada_Streams.Stream_Element_Array; Last : out POSIX.IO_Count; Masked_Signals : in POSIX.Signal_Masking := POSIX.RTS_Signals); procedure Write (File : in File_Descriptor; Buffer : in IO_Buffer; Last : out POSIX.IO_Count; Masked_Signals : in POSIX.Signal_Masking := POSIX.RTS_Signals); procedure Write (File : in File_Descriptor; Buffer : out Ada_Streams.Stream_Element_Array; Last : out POSIX.IO_Count; Masked_Signals : in POSIX.Signal_Masking := POSIX.RTS_Signals); generic type T is private; procedure Generic_Read (File : in File_Descriptor; Item : out T; Masked_Signals : in POSIX.Signal_Masking := POSIX.RTS_Signals); generic type T is private; procedure Generic_Write (File : in File_Descriptor; Item : in T; Masked_Signals : in POSIX.Signal_Masking := POSIX.RTS_Signals); -- File position operations type Position is (From_Beginning, From_Current_Position, From_End_Of_File); procedure Seek (File : in File_Descriptor; Offset : in IO_Offset; Result : out IO_Offset; Starting_Point : in Position := From_Beginning); function File_Size (File : File_Descriptor) return POSIX.IO_Count; function File_Position (File : File_Descriptor) return IO_Offset; -- Terminal operations function Is_A_Terminal (File : File_Descriptor) return Boolean; function Get_Terminal_Name (File : File_Descriptor) return POSIX.Pathname; -- File Control operations procedure Get_File_Control (File : in File_Descriptor; Mode : out File_Mode; Options : out Open_Option_Set); procedure Set_File_Control (File : in File_Descriptor; Options : in Open_Option_Set); function Get_Close_On_Exec (File : File_Descriptor) return Boolean; procedure Set_Close_On_Exec (File : in File_Descriptor; To : in Boolean := True); -- begin extension -- File modes and options File_Synchronized : constant POSIX.IO.Open_Option_Set := Integer_To_Open_Option_Set (Implementation_Constants.File_Synchronized); Data_Synchronized : constant POSIX.IO.Open_Option_Set := Integer_To_Open_Option_Set (Implementation_Constants.Data_Synchronized); Read_Synchronized : constant POSIX.IO.Open_Option_Set := Integer_To_Open_Option_Set (Implementation_Constants.Read_Synchronized); procedure Change_Permissions (File : in POSIX.IO.File_Descriptor; Permission : in POSIX.Permissions.Permission_Set); procedure Truncate_File (File : in POSIX.IO.File_Descriptor; Length : in POSIX.IO_Count); procedure Synchronize_File (File : in POSIX.IO.File_Descriptor); procedure Synchronize_Data (File : in POSIX.IO.File_Descriptor); -- end extension end POSIX.IO;