------------------------------------------------------------------------ -- These package specifications were extracted from IEEE Std 1003.5-1992, -- IEEE Standard for Information Technology--POSIX Ada Language -- Interfaces--Part 1: Binding System Application Program Interface, -- copyright (c)1992 by the Institute of Electrical and Electronics -- Engineers, Inc. These package specifications represent only a portion -- of the document and are not to be interpreteted as the approved -- consensus standard. The IEEE Std 1003.5-1992 must be used in -- conjunction with these package specifications in order to claim -- conformance. The IEEE takes no responsibility for and will assume no -- liability for damages resulting from the reader's misinpretation of -- said information resulting from its out of context nature. To order -- copies of the IEEE Std 1003.5-1992, 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. ------------------------------------------------------------------------ with POSIX; with POSIX_Permissions, POSIX_Process_Identification; package POSIX_IO is -- common type declarations type File_Descriptor is range 0..POSIX.Open_Files - 1; Standard_Input : constant File_Descriptor := 0; Standard_Output : constant File_Descriptor := 1; Standard_Error : constant File_Descriptor := 2; type IO_Offset is range @P; subtype IO_Count is IO_Offset range 0 .. IO_Offset'Last; subtype Positive_IO_Count is IO_Count range 1 .. IO_Offset'Last; type File_Mode is (Read_Only, Write_Only, Read_Write, Blocking, Append, Close_On_Exec, Truncate, Exclusive, Control_TTY); subtype Open_Mode is File_Mode range Read_Only .. Read_Write; subtype File_Control_Mode is File_Mode range Read_Only .. Close_On_Exec; subtype Settable_File_Control_Mode is File_Mode range Blocking .. Close_On_Exec; type File_Mode_Set is array (File_Mode range <>) of Boolean; subtype File_Control_Mode_Set is File_Mode_Set (File_Control_Mode); subtype Settable_File_Control_Mode_Set is File_Mode_Set (Settable_File_Control_Mode); type Position is (From_Beginning, From_Current_Position, From_End_Of_File); -- File open, open_or_create, create, close, duplicate and Create_pipe function Open (Name : POSIX.POSIX_String; Mode : Open_Mode; Blocking : Boolean := True; Append : Boolean := False; Truncate : Boolean := False; Control_TTY : Boolean := True) return File_Descriptor; function Open_or_Create (Name : POSIX.POSIX_String; Mode : Open_Mode; Permissions : POSIX_Permissions.Permission_Set; Blocking : Boolean := True; Append : Boolean := False; Truncate : Boolean := False; Exclusive : Boolean := False; Control_TTY : Boolean := True) return File_Descriptor; procedure Close (File : in File_Descriptor); function Duplicate (File : File_Descriptor) return File_Descriptor; function Duplicate (File1 : File_Descriptor; File2 : File_Descriptor) return File_Descriptor; procedure Create_Pipe (Read_End : out File_Descriptor; Write_End : out File_Descriptor); -- Read and Write Pipe_Buffer_Size : constant POSIX.Pipe_Limit_Range := POSIX.Pipe_Limit_Range'First; -- minimum implementation guaranteed pipe buffer size type IO_Unit is range @P; type IO_Buffer is array (Positive_IO_Count range <>) of IO_Unit; procedure Read (File : in File_Descriptor; Buffer : out IO_Buffer; Last : out IO_Count); procedure Write (File : in File_Descriptor; Buffer : in IO_Buffer; Last : out IO_Count); generic type T is private; procedure Generic_Read (File : in File_Descriptor; Item : out T); generic type T is private; procedure Generic_Write (File : in File_Descriptor; Item : in T); -- Seek, File_size, File_Position procedure Seek (File : in File_Descriptor; Offset : in IO_Offset; Whence : in Position := From_Beginning); function File_Size (File : File_Descriptor) return IO_Count; function File_Position (File : File_Descriptor) return IO_Count; -- Terminal device operations function Is_A_Terminal_Device (File : File_Descriptor) return Boolean; function Get_Terminal_Device_Name (File : File_Descriptor) return POSIX.POSIX_String; -- File Control operations function Get_File_Control (File : File_Descriptor) return File_Control_Mode_Set; procedure Set_File_Control (File : in File_Descriptor; Modes : in Settable_File_Control_Mode_Set); end POSIX_IO;