------------------------------------------------------------------------------ -- -- -- POSIX ADA LANGUAGE INTERFACES COMPONENTS -- -- -- -- P O S I X -- -- -- -- S p e c -- -- -- -- $Revision: 1.8 $ -- -- -- -- -- -- 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 Ada_Streams; with Interfaces.C; with Interfaces.C.Strings; with Implementation_Limits; with Implementation_Options; with Implementation_Constants; with Ada.Real_Time; package POSIX is -- Symbolic constants -- Optional Facilities subtype Job_Control_Support is Boolean range Implementation_Options.Job_Control_Support_Range'Range; subtype Saved_IDs_Support is Boolean range Implementation_Options.Saved_IDs_Support_Range'Range; subtype Change_Owner_Restriction is Boolean range Implementation_Options.Change_Owner_Restriction_Range'Range; subtype Filename_Truncation is Boolean range Implementation_Options.Filename_Truncation_Range'Range; POSIX_Version : constant := 1995_00; POSIX_Ada_Version : constant := 1995_00; Byte_Size : constant := 8; -- I/O Count -- ???????????? type IO_Count is new integer range 0 .. integer'Last; subtype IO_Count_Maxima is IO_Count range 32767 .. IO_Count'Last; -- System Limits Portable_Groups_Maximum : constant Natural := 0; subtype Groups_Maxima is Natural range Implementation_Limits.Groups_Maxima_Range'Range; Portable_Argument_List_Maximum : constant Natural := 4096; subtype Argument_List_Maxima is Natural range Implementation_Limits.Argument_List_Maxima_Range'Range; Portable_Child_Processes_Maximum : constant Natural := 6; subtype Child_Processes_Maxima is Natural range Implementation_Limits.Child_Processes_Maxima_Range'Range; Portable_Open_Files_Maximum : constant Natural := 16; subtype Open_Files_Maxima is Natural range Implementation_Limits.Open_Files_Maxima_Range'Range; Portable_Stream_Maximum : constant Natural := 8; subtype Stream_Maxima is Natural range Implementation_Limits.Stream_Maxima_Range'Range; Portable_Time_Zone_String_Maximum : constant Natural := 3; subtype Time_Zone_String_Maxima is Natural range Implementation_Limits.Time_Zone_String_Maxima_Range'Range; -- Pathname Variable Values Portable_Link_Limit_Maximum : constant Natural := 8; subtype Link_Limit_Maxima is Natural range Implementation_Limits.Link_Limit_Maxima_Range'Range; Portable_Input_Line_Limit_Maximum : constant IO_Count := 255; subtype Input_Line_Limit_Maxima is IO_Count range IO_Count (Implementation_Limits. Input_Line_Limit_Maxima_Range'First) .. IO_Count (Implementation_Limits. Input_Line_Limit_Maxima_Range'Last); Portable_Input_Queue_Limit_Maximum : constant IO_Count := 255; subtype Input_Queue_Limit_Maxima is IO_Count range IO_Count (Implementation_Limits. Input_Queue_Limit_Maxima_Range'First) .. IO_Count (Implementation_Limits. Input_Queue_Limit_Maxima_Range'Last); Portable_Filename_Limit_Maximum : constant Natural := 14; subtype Filename_Limit_Maxima is Natural range Implementation_Limits.Filename_Limit_Maxima_Range'Range; Portable_Pathname_Limit_Maximum : constant Natural := 255; subtype Pathname_Limit_Maxima is Natural range Implementation_Limits.Pathname_Limit_Maxima_Range'Range; Portable_Pipe_Limit_Maximum : constant IO_Count := 512; subtype Pipe_Limit_Maxima is IO_Count range IO_Count (Implementation_Limits. Pipe_Limit_Maxima_Range'First) .. IO_Count (Implementation_Limits. Pipe_Limit_Maxima_Range'Last); -- Blocking Behavior Values type Blocking_Behavior is (Tasks, Program, Special); -- ???????????? subtype Realtime_Blocking_Behavior is Blocking_Behavior range Tasks .. Program; subtype Text_IO_Blocking_Behavior is Blocking_Behavior range Tasks .. Tasks; IO_Blocking_Behavior : constant Blocking_Behavior := Tasks; File_Lock_Blocking_Behavior : constant Blocking_Behavior := Tasks; Wait_For_Child_Blocking_Behavior : constant Blocking_Behavior := Tasks; -- Signal Masking type Signal_Masking is (No_Signals, RTS_Signals, All_Signals); -- Characters and Strings type POSIX_Character is new Standard.Character; -- ( -- ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', -- 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', -- 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', -- 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', -- 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', -- '.', '_', '-', '/', '"', '#', '&', ''', '(', ')', -- '*', '+', ',', ':', ';', '<', '=', '>', '|'); type POSIX_String is array (Positive range <>) of POSIX_Character; function To_POSIX_String (Str : string) return POSIX_String; function To_POSIX_String (Str : Wide_String) return POSIX_String; function To_String (Str : POSIX_String) return string; function To_Wide_String (Str : POSIX_String) return Wide_String; function To_Stream_Element_Array (Buffer : POSIX_String) return Ada_Streams.Stream_Element_Array; function To_POSIX_String (Buffer : Ada_Streams.Stream_Element_Array) return POSIX_String; subtype Filename is POSIX_String; function Is_Filename (Str : POSIX_String) return Boolean; function Is_Pathname (Str : POSIX_String) return Boolean; function Is_Portable_Filename (Str : POSIX_String) return Boolean; function Is_Portable_Pathname (Str : POSIX_String) return Boolean; subtype Pathname is POSIX_String; -- String Lists type POSIX_String_List is limited private; Empty_String_List : constant POSIX_String_List; procedure Make_Empty (List : in out POSIX_String_List); procedure Append (List : in out POSIX_String_List; In_Str : in POSIX_String); generic with procedure Action (Item : in POSIX_String; Quit : in out Boolean); procedure For_Every_Item (List : in POSIX_String_List); function Length (List : POSIX_String_List) return Natural; function Value (List : POSIX_String_List; Index : Positive) return POSIX_String; -- option sets type Option_Set is private; function Empty_Set return Option_Set; function "+" (L, R : Option_Set) return Option_Set; function "-" (L, R : Option_Set) return Option_Set; Option_1 : constant Option_Set; Option_2 : constant Option_Set; Option_3 : constant Option_Set; Option_4 : constant Option_Set; Option_5 : constant Option_Set; Option_6 : constant Option_Set; Option_7 : constant Option_Set; Option_8 : constant Option_Set; Option_9 : constant Option_Set; Option_10 : constant Option_Set; Option_11 : constant Option_Set; Option_12 : constant Option_Set; Option_13 : constant Option_Set; Option_14 : constant Option_Set; Option_15 : constant Option_Set; Option_16 : constant Option_Set; Option_17 : constant Option_Set; Option_18 : constant Option_Set; Option_19 : constant Option_Set; Option_20 : constant Option_Set; Option_21 : constant Option_Set; Option_22 : constant Option_Set; Option_23 : constant Option_Set; Option_24 : constant Option_Set; Option_25 : constant Option_Set; Option_26 : constant Option_Set; Option_27 : constant Option_Set; Option_28 : constant Option_Set; Option_29 : constant Option_Set; Option_30 : constant Option_Set; Option_31 : constant Option_Set; function "<" (Left, Right : Option_Set) return Boolean; function "<=" (Left, Right : Option_Set) return Boolean; function ">" (Left, Right : Option_Set) return Boolean; function ">=" (Left, Right : Option_Set) return Boolean; -- Exceptions and error codes POSIX_Error : exception; type Error_Code is new Interfaces.C.int; function Get_Error_Code return Error_Code; procedure Set_Error_Code (Error : in Error_Code); function Is_POSIX_Error (Error : Error_Code) return Boolean; function Image (Error : Error_Code) return String; No_Error : constant Error_Code := 0; -- *** NEGATIVE ERROR CONSTANT MEANS THE UNDERLYING SYSTEM DOES NOT -- *** SUPPORT. E2BIG, Argument_List_Too_Long : constant Error_Code := Implementation_Constants.E2BIG; EFAULT, Bad_Address : constant Error_Code := Implementation_Constants.EFAULT; EBADF, Bad_File_Descriptor : constant Error_Code := Implementation_Constants.EBADF; EBADMSG, Bad_Message : constant Error_Code := Implementation_Constants.EBADMSG; EPIPE, Broken_Pipe : constant Error_Code := Implementation_Constants.EPIPE; ENOTEMPTY, Directory_Not_Empty : constant Error_Code := Implementation_Constants.ENOTEMPTY; ENOEXEC, Exec_Format_Error : constant Error_Code := Implementation_Constants.ENOEXEC; EEXIST, File_Exists : constant Error_Code := Implementation_Constants.EEXIST; EFBIG, File_Too_Large : constant Error_Code := Implementation_Constants.EFBIG; ENAMETOOLONG, Filename_Too_Long : constant Error_Code := Implementation_Constants.ENAMETOOLONG; EXDEV, Improper_Link : constant Error_Code := Implementation_Constants.EXDEV; ENOTTY, Inappropriate_IO_Control_Operation : constant Error_Code := Implementation_Constants.ENOTTY; EIO, Input_Output_Error : constant Error_Code := Implementation_Constants.EIO; EINTR, Interrupted_Operation : constant Error_Code := Implementation_Constants.EINTR; EINVAL, Invalid_Argument : constant Error_Code := Implementation_Constants.EINVAL; ESPIPE, Invalid_Seek : constant Error_Code := Implementation_Constants.ESPIPE; EISDIR, Is_A_Directory : constant Error_Code := Implementation_Constants.EISDIR; EMSGSIZE, Message_Too_Long : constant Error_Code := Implementation_Constants.EMSGSIZE; ECHILD, No_Child_Process : constant Error_Code := Implementation_Constants.ECHILD; ENOLCK, No_Locks_Available : constant Error_Code := Implementation_Constants.ENOLCK; ENOSPC, No_Space_Left_On_Device : constant Error_Code := Implementation_Constants.ENOSPC; ENODEV, No_Such_Operation_On_Device : constant Error_Code := Implementation_Constants.ENODEV; ENXIO, No_Such_Device_Or_Address : constant Error_Code := Implementation_Constants.ENXIO; ENOENT, No_Such_File_Or_Directory : constant Error_Code := Implementation_Constants.ENOENT; ESRCH, No_Such_Process : constant Error_Code := Implementation_Constants.ESRCH; ENOTDIR, Not_A_Directory : constant Error_Code := Implementation_Constants.ENOTDIR; ENOMEM, Not_Enough_Space : constant Error_Code := Implementation_Constants.ENOMEM; ECANCELED, Operation_Canceled : constant Error_Code := Implementation_Constants.ECANCELED; EINPROGRESS, Operation_In_Progress : constant Error_Code := Implementation_Constants.EINPROGRESS; ENOSYS, Operation_Not_Implemented : constant Error_Code := Implementation_Constants.ENOSYS; EPERM, Operation_Not_Permitted : constant Error_Code := Implementation_Constants.EPERM; ENOTSUP, Operation_Not_Supported : constant Error_Code := Implementation_Constants.ENOTSUP; EACCES, Permission_Denied : constant Error_Code := Implementation_Constants.EACCES; EROFS, Read_Only_File_System : constant Error_Code := Implementation_Constants.EROFS; EBUSY, Resource_Busy : constant Error_Code := Implementation_Constants.EBUSY; EDEADLK, Resource_Deadlock_Avoided : constant Error_Code := Implementation_Constants.EDEADLK; EAGAIN, Resource_Temporarily_Unavailable : constant Error_Code := Implementation_Constants.EAGAIN; ETIMEDOUT, Timed_Out : constant Error_Code := Implementation_Constants.ETIMEDOUT; EMLINK, Too_Many_Links : constant Error_Code := Implementation_Constants.EMLINK; EMFILE, Too_Many_Open_Files : constant Error_Code := Implementation_Constants.EMFILE; ENFILE, Too_Many_Open_Files_In_System : constant Error_Code := Implementation_Constants.ENFILE; -- System Identification function System_Name return POSIX_String; function Node_Name return POSIX_String; function Release return POSIX_String; function Version return POSIX_String; function Machine return POSIX_String; type Seconds is new Integer range -Integer'Last .. Integer'Last; type Nanoseconds_Base is range -2**31 .. 2**31 - 1; subtype Nanoseconds is Nanoseconds_Base range 0 .. (10**9) - 1; type Timespec is private; function Get_Seconds (Time : Timespec) return Seconds; procedure Set_Seconds (Time : in out Timespec; S : in Seconds); function Get_Nanoseconds (Time : Timespec) return Nanoseconds; procedure Set_Nanoseconds (Time : in out Timespec; NS : in Nanoseconds); procedure Split (Time : in Timespec; S : out Seconds; NS : out Nanoseconds); function To_Timespec (S : Seconds; NS : Nanoseconds) return Timespec; function "+" (Left, Right : Timespec) return Timespec; function "+" (Left : Timespec; Right : Nanoseconds) return Timespec; function "-" (Right : Timespec) return Timespec; function "-" (Left, Right : Timespec) return Timespec; function "-" (Left : Timespec; Right : Nanoseconds) return Timespec; function "*" (Left : Timespec; Right : Integer) return Timespec; function "*" (Left : Integer; Right : Timespec) return Timespec; function "/" (Left : Timespec; Right : Integer) return Timespec; function "/" (Left, Right : Timespec) return Integer; function "<" (Left, Right : Timespec) return Boolean; function "<=" (Left, Right : Timespec) return Boolean; function ">" (Left, Right : Timespec) return Boolean; function ">=" (Left, Right : Timespec) return Boolean; function To_Duration (Time : Timespec) return Duration; function To_Timespec (D : Duration) return Timespec; private type List_Node (Size : Positive); type POSIX_String_List is access List_Node; type List_Node (Size : Positive) is record Str : POSIX_String (Positive'First .. Size); Next : POSIX_String_List; end record; Empty_String_List : constant POSIX_String_List := null; subtype Time_Base is Long_Long_Integer range -Long_Long_Integer'Last .. Long_Long_Integer'Last; type Timespec is record Val : Time_Base := Time_Base (0); end record; Timespec_Sec_Unit : constant Timespec := Timespec' (Val => 10#1#E9); type Option_Set is record Option : Interfaces.C.Int := 0; end record; Option_1 : constant Option_Set := (Option => 1); Option_2 : constant Option_Set := (Option => 2); Option_3 : constant Option_Set := (Option => 3); Option_4 : constant Option_Set := (Option => 4); Option_5 : constant Option_Set := (Option => 5); Option_6 : constant Option_Set := (Option => 6); Option_7 : constant Option_Set := (Option => 7); Option_8 : constant Option_Set := (Option => 8); Option_9 : constant Option_Set := (Option => 9); Option_10 : constant Option_Set := (Option => 10); Option_11 : constant Option_Set := (Option => 11); Option_12 : constant Option_Set := (Option => 12); Option_13 : constant Option_Set := (Option => 13); Option_14 : constant Option_Set := (Option => 14); Option_15 : constant Option_Set := (Option => 15); Option_16 : constant Option_Set := (Option => 16); Option_17 : constant Option_Set := (Option => 17); Option_18 : constant Option_Set := (Option => 18); Option_19 : constant Option_Set := (Option => 19); Option_20 : constant Option_Set := (Option => 20); Option_21 : constant Option_Set := (Option => 21); Option_22 : constant Option_Set := (Option => 22); Option_23 : constant Option_Set := (Option => 23); Option_24 : constant Option_Set := (Option => 24); Option_25 : constant Option_Set := (Option => 25); Option_26 : constant Option_Set := (Option => 26); Option_27 : constant Option_Set := (Option => 27); Option_28 : constant Option_Set := (Option => 28); Option_29 : constant Option_Set := (Option => 29); Option_30 : constant Option_Set := (Option => 30); Option_31 : constant Option_Set := (Option => 31); end POSIX;