-- -- -------------------------------------------------------------------------------- -- -- OSI_Error_Handler -- -- This package is an internal OSI package. The package exports -- a routine which raises an exception which corresponds to the -- last error occurred during execution of an OSI routine. -- -- -- -- -- Gerardo A. Colon -- 24 July 1990 -- -- Science Applications International Corporation --
311 Park Place Boulevard, Suite 360 --
Clearwater, Florida 34619 -- -- Developed for the STARS program under task S40. -- -- -- -- -- Dependencies => -- ( Operating_System => None , -- Compiler => None , -- Device => None ) ; -- -- -------------------------------------------------------------------------------- with OSI_Exceptions ; pragma Page ; -------------------------------------------------------------------------------- -- package OSI_Error_Handler (body). -------------------------------------------------------------------------------- package body OSI_Error_Handler is -- -- The following are the error codes for AIX. -- ENOENT : constant := 2 ; ENOEXEC : constant := 8 ; EBADF : constant := 9 ; EAGAIN : constant := 11 ; ENOMEM : constant := 12 ; EACCESS : constant := 13 ; EEXIST : constant := 17 ; ENOTDIR : constant := 20 ; EISDIR : constant := 21 ; EINVAL : constant := 22 ; ENFILE : constant := 23 ; EMFILE : constant := 24 ; ENOSPC : constant := 28 ; EROFS : constant := 30 ; EMLINK : constant := 31 ; ENAMETOOLONG : constant := 86 ; ENOTEMPTY : constant := 87 ; -------------------------------------------------------------------------------- -- Local Subprograms. -------------------------------------------------------------------------------- function Errorno return Integer ; -------------------------------------------------------------------------------- -- -- Errorno -- -- This function returns the last error code raised by an -- unsuccessful system dependent AIX operation. -- -- None. -- -- -------------------------------------------------------------------------------- pragma Interface ( C , Errorno ) ; -------------------------------------------------------------------------------- -- External Subprograms. -------------------------------------------------------------------------------- procedure Map_Last_Error is -------------------------------------------------------------------------------- -- -- Map_Last_Error -- -- For a complete description of this subprogram see the -- specification of this package. -- -- For a complete description of the exceptions raised by this -- subprogram see the specification of this package. -- -- -------------------------------------------------------------------------------- begin -- Map_Last_Error case Errorno is when ENOENT => raise OSI_Exceptions.No_Such_File_Or_Directory ; when ENOEXEC => raise OSI_Exceptions.Exec_Format_Error ; when EBADF => raise OSI_Exceptions.Bad_File_Descriptor ; when EAGAIN => raise OSI_Exceptions.Resource_Temporarily_Unavailable ; when ENOMEM => raise OSI_Exceptions.Not_Enough_Space ; when EACCESS => raise OSI_Exceptions.Permission_Denied ; when EEXIST => raise OSI_Exceptions.File_Exists ; when ENOTDIR => raise OSI_Exceptions.Not_A_Directory ; when EISDIR => raise OSI_Exceptions.Is_A_Directory ; when EINVAL => raise OSI_Exceptions.Invalid_Argument ; when ENFILE => raise OSI_Exceptions.Too_Many_Open_Files_In_System ; when EMFILE => raise OSI_Exceptions.Too_Many_Open_Files ; when ENOSPC => raise OSI_Exceptions.No_Space_Left_On_Device ; when EROFS => raise OSI_Exceptions.Read_Only_File_System ; when EMLINK => raise OSI_Exceptions.Too_Many_Links ; when ENAMETOOLONG => raise OSI_Exceptions.Filename_Too_Long ; when ENOTEMPTY => raise OSI_Exceptions.Directory_Not_Empty ; when others => raise OSI_Exceptions.Host_Error ; end case ; end Map_Last_Error ; end OSI_Error_Handler ; --