Commit 8c709695 by Joel Sherrill Committed by Joel Sherrill

g-socket.adb: A target can have multiple missing errno's.

2010-04-15  Joel Sherrill <joel.sherrill@oarcorp.com>

	* g-socket.adb: A target can have multiple missing errno's.  This
	will result in multiple errno's being defined as -1.  Because of this
	we can not use a case but must use a series of if's to avoid 
	a duplicate case error in GNAT.Sockets.Resolve_Error.

From-SVN: r158382
parent d8a653c5
2010-04-15 Joel Sherrill <joel.sherrill@oarcorp.com>
* g-socket.adb: A target can have multiple missing errno's. This
will result in multiple errno's being defined as -1. Because of this
we can not use a case but must use a series of if's to avoid
a duplicate case error in GNAT.Sockets.Resolve_Error.
2010-04-15 Eric Botcazou <ebotcazou@adacore.com> 2010-04-15 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (call_to_gnu): Open a nesting level if this is * gcc-interface/trans.c (call_to_gnu): Open a nesting level if this is
......
...@@ -1750,53 +1750,93 @@ package body GNAT.Sockets is ...@@ -1750,53 +1750,93 @@ package body GNAT.Sockets is
pragma Warnings (On); pragma Warnings (On);
case Error_Value is -- This is not a case statement because if a particular error
when ENOERROR => return Success; -- number constant is not defined, s-oscons-tmplt.c defines
when EACCES => return Permission_Denied; -- it to -1. If multiple constants are not defined, they
when EADDRINUSE => return Address_Already_In_Use; -- would each be -1 and result in a "duplicate value in case" error.
when EADDRNOTAVAIL => return Cannot_Assign_Requested_Address; if Error_Value = ENOERROR then
when EAFNOSUPPORT => return return Success;
Address_Family_Not_Supported_By_Protocol; elsif Error_Value = EACCES then
when EALREADY => return Operation_Already_In_Progress; return Permission_Denied;
when EBADF => return Bad_File_Descriptor; elsif Error_Value = EADDRINUSE then
when ECONNABORTED => return Software_Caused_Connection_Abort; return Address_Already_In_Use;
when ECONNREFUSED => return Connection_Refused; elsif Error_Value = EADDRNOTAVAIL then
when ECONNRESET => return Connection_Reset_By_Peer; return Cannot_Assign_Requested_Address;
when EDESTADDRREQ => return Destination_Address_Required; elsif Error_Value = EAFNOSUPPORT then
when EFAULT => return Bad_Address; return Address_Family_Not_Supported_By_Protocol;
when EHOSTDOWN => return Host_Is_Down; elsif Error_Value = EALREADY then
when EHOSTUNREACH => return No_Route_To_Host; return Operation_Already_In_Progress;
when EINPROGRESS => return Operation_Now_In_Progress; elsif Error_Value = EBADF then
when EINTR => return Interrupted_System_Call; return Bad_File_Descriptor;
when EINVAL => return Invalid_Argument; elsif Error_Value = ECONNABORTED then
when EIO => return Input_Output_Error; return Software_Caused_Connection_Abort;
when EISCONN => return Transport_Endpoint_Already_Connected; elsif Error_Value = ECONNREFUSED then
when ELOOP => return Too_Many_Symbolic_Links; return Connection_Refused;
when EMFILE => return Too_Many_Open_Files; elsif Error_Value = ECONNRESET then
when EMSGSIZE => return Message_Too_Long; return Connection_Reset_By_Peer;
when ENAMETOOLONG => return File_Name_Too_Long; elsif Error_Value = EDESTADDRREQ then
when ENETDOWN => return Network_Is_Down; return Destination_Address_Required;
when ENETRESET => return elsif Error_Value = EFAULT then
Network_Dropped_Connection_Because_Of_Reset; return Bad_Address;
when ENETUNREACH => return Network_Is_Unreachable; elsif Error_Value = EHOSTDOWN then
when ENOBUFS => return No_Buffer_Space_Available; return Host_Is_Down;
when ENOPROTOOPT => return Protocol_Not_Available; elsif Error_Value = EHOSTUNREACH then
when ENOTCONN => return Transport_Endpoint_Not_Connected; return No_Route_To_Host;
when ENOTSOCK => return Socket_Operation_On_Non_Socket; elsif Error_Value = EINPROGRESS then
when EOPNOTSUPP => return Operation_Not_Supported; return Operation_Now_In_Progress;
when EPFNOSUPPORT => return Protocol_Family_Not_Supported; elsif Error_Value = EINTR then
when EPIPE => return Broken_Pipe; return Interrupted_System_Call;
when EPROTONOSUPPORT => return Protocol_Not_Supported; elsif Error_Value = EINVAL then
when EPROTOTYPE => return Protocol_Wrong_Type_For_Socket; return Invalid_Argument;
when ESHUTDOWN => return elsif Error_Value = EIO then
Cannot_Send_After_Transport_Endpoint_Shutdown; return Input_Output_Error;
when ESOCKTNOSUPPORT => return Socket_Type_Not_Supported; elsif Error_Value = EISCONN then
when ETIMEDOUT => return Connection_Timed_Out; return Transport_Endpoint_Already_Connected;
when ETOOMANYREFS => return Too_Many_References; elsif Error_Value = ELOOP then
when EWOULDBLOCK => return Resource_Temporarily_Unavailable; return Too_Many_Symbolic_Links;
elsif Error_Value = EMFILE then
when others => return Cannot_Resolve_Error; return Too_Many_Open_Files;
end case; elsif Error_Value = EMSGSIZE then
return Message_Too_Long;
elsif Error_Value = ENAMETOOLONG then
return File_Name_Too_Long;
elsif Error_Value = ENETDOWN then
return Network_Is_Down;
elsif Error_Value = ENETRESET then
return Network_Dropped_Connection_Because_Of_Reset;
elsif Error_Value = ENETUNREACH then
return Network_Is_Unreachable;
elsif Error_Value = ENOBUFS then
return No_Buffer_Space_Available;
elsif Error_Value = ENOPROTOOPT then
return Protocol_Not_Available;
elsif Error_Value = ENOTCONN then
return Transport_Endpoint_Not_Connected;
elsif Error_Value = ENOTSOCK then
return Socket_Operation_On_Non_Socket;
elsif Error_Value = EOPNOTSUPP then
return Operation_Not_Supported;
elsif Error_Value = EPFNOSUPPORT then
return Protocol_Family_Not_Supported;
elsif Error_Value = EPIPE then
return Broken_Pipe;
elsif Error_Value = EPROTONOSUPPORT then
return Protocol_Not_Supported;
elsif Error_Value = EPROTOTYPE then
return Protocol_Wrong_Type_For_Socket;
elsif Error_Value = ESHUTDOWN then
return Cannot_Send_After_Transport_Endpoint_Shutdown;
elsif Error_Value = ESOCKTNOSUPPORT then
return Socket_Type_Not_Supported;
elsif Error_Value = ETIMEDOUT then
return Connection_Timed_Out;
elsif Error_Value = ETOOMANYREFS then
return Too_Many_References;
elsif Error_Value = EWOULDBLOCK then
return Resource_Temporarily_Unavailable;
else
return Cannot_Resolve_Error;
end if;
end Resolve_Error; end Resolve_Error;
----------------------- -----------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment