From: Thomas Quinot Date: Wed, 26 Mar 2008 07:34:57 +0000 (+0100) Subject: re PR ada/33688 (Ada package Gnat.Sockets missing constant for IP_PKTINFO (patch)) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4e0ede3df752962d473249716152e00d779eec66;p=gcc.git re PR ada/33688 (Ada package Gnat.Sockets missing constant for IP_PKTINFO (patch)) 2008-03-26 Thomas Quinot PR ada/33688 * g-socket.ads, g-socket.adb (Options, Set_Socket_Option, Get_Socket_Option): Add support for Receive_Packet_Info. * g-soccon.ads, g-soccon-tru64.ads, g-soccon-aix.ads, g-soccon-irix.ads, g-soccon-hpux.ads, g-soccon-solaris.ads, g-soccon-vms.ads, g-soccon-mingw.ads, g-soccon-freebsd.ads, g-soccon-hpux-ia64.ads, g-soccon-solaris-64.ads, g-soccon-darwin.ads, g-soccon-lynxos.ads, g-soccon-linux-64.ads, g-soccon-linux-x86.ads: Add new constants SO_REUSEPORT and IP_PKTINFO From-SVN: r133545 --- diff --git a/gcc/ada/g-soccon-aix.ads b/gcc/ada/g-soccon-aix.ads index f96cad40896..b1f6376082d 100644 --- a/gcc/ada/g-soccon-aix.ads +++ b/gcc/ada/g-soccon-aix.ads @@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is TCP_NODELAY : constant := 1; -- Do not coalesce packets SO_REUSEADDR : constant := 4; -- Bind reuse local address + SO_REUSEPORT : constant := 512; -- Bind reuse port number SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs SO_LINGER : constant := 128; -- Defer close to flush data SO_BROADCAST : constant := 32; -- Can send broadcast msgs @@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group + IP_PKTINFO : constant := -1; -- Get datagram info ------------------- -- System limits -- diff --git a/gcc/ada/g-soccon-darwin.ads b/gcc/ada/g-soccon-darwin.ads index 7d82375763f..b48c4df65ed 100644 --- a/gcc/ada/g-soccon-darwin.ads +++ b/gcc/ada/g-soccon-darwin.ads @@ -35,7 +35,7 @@ -- by the GNAT.Sockets package (g-socket.ads). This package should not be -- directly with'ed by an applications program. --- This is the version for powerpc-apple-darwin8.8.0 +-- This is the version for powerpc-apple-darwin8.9.0 -- This file is generated automatically, do not modify it by hand! Instead, -- make changes to gen-soccon.c and re-run it on each target. @@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is TCP_NODELAY : constant := 1; -- Do not coalesce packets SO_REUSEADDR : constant := 4; -- Bind reuse local address + SO_REUSEPORT : constant := 512; -- Bind reuse port number SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs SO_LINGER : constant := 128; -- Defer close to flush data SO_BROADCAST : constant := 32; -- Can send broadcast msgs @@ -182,7 +183,7 @@ package GNAT.Sockets.Constants is -- Properties of supported interfaces -- ---------------------------------------- - Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops + Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops ---------------------- -- Additional flags -- diff --git a/gcc/ada/g-soccon-freebsd.ads b/gcc/ada/g-soccon-freebsd.ads index 045c8a095cf..c07fc1852d6 100644 --- a/gcc/ada/g-soccon-freebsd.ads +++ b/gcc/ada/g-soccon-freebsd.ads @@ -35,7 +35,7 @@ -- by the GNAT.Sockets package (g-socket.ads). This package should not be -- directly with'ed by an applications program. --- This is the version for i386-unknown-freebsd6.1 +-- This is the version for i386-unknown-freebsd6.2 -- This file is generated automatically, do not modify it by hand! Instead, -- make changes to gen-soccon.c and re-run it on each target. @@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is TCP_NODELAY : constant := 1; -- Do not coalesce packets SO_REUSEADDR : constant := 4; -- Bind reuse local address + SO_REUSEPORT : constant := 512; -- Bind reuse port number SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs SO_LINGER : constant := 128; -- Defer close to flush data SO_BROADCAST : constant := 32; -- Can send broadcast msgs @@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group + IP_PKTINFO : constant := -1; -- Get datagram info ------------------- -- System limits -- diff --git a/gcc/ada/g-soccon-hpux-ia64.ads b/gcc/ada/g-soccon-hpux-ia64.ads index 04cfc15a231..3caa99cc0ad 100644 --- a/gcc/ada/g-soccon-hpux-ia64.ads +++ b/gcc/ada/g-soccon-hpux-ia64.ads @@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is TCP_NODELAY : constant := 1; -- Do not coalesce packets SO_REUSEADDR : constant := 4; -- Bind reuse local address + SO_REUSEPORT : constant := 512; -- Bind reuse port number SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs SO_LINGER : constant := 128; -- Defer close to flush data SO_BROADCAST : constant := 32; -- Can send broadcast msgs @@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is IP_MULTICAST_LOOP : constant := 4; -- Set/get mcast loopback IP_ADD_MEMBERSHIP : constant := 5; -- Join a multicast group IP_DROP_MEMBERSHIP : constant := 6; -- Leave a multicast group + IP_PKTINFO : constant := -1; -- Get datagram info ------------------- -- System limits -- diff --git a/gcc/ada/g-soccon-hpux.ads b/gcc/ada/g-soccon-hpux.ads index d2262176a52..9be66ad4f08 100644 --- a/gcc/ada/g-soccon-hpux.ads +++ b/gcc/ada/g-soccon-hpux.ads @@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is TCP_NODELAY : constant := 1; -- Do not coalesce packets SO_REUSEADDR : constant := 4; -- Bind reuse local address + SO_REUSEPORT : constant := 512; -- Bind reuse port number SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs SO_LINGER : constant := 128; -- Defer close to flush data SO_BROADCAST : constant := 32; -- Can send broadcast msgs @@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is IP_MULTICAST_LOOP : constant := 4; -- Set/get mcast loopback IP_ADD_MEMBERSHIP : constant := 5; -- Join a multicast group IP_DROP_MEMBERSHIP : constant := 6; -- Leave a multicast group + IP_PKTINFO : constant := -1; -- Get datagram info ------------------- -- System limits -- diff --git a/gcc/ada/g-soccon-irix.ads b/gcc/ada/g-soccon-irix.ads index 7beb802a3ed..1f367548705 100644 --- a/gcc/ada/g-soccon-irix.ads +++ b/gcc/ada/g-soccon-irix.ads @@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is TCP_NODELAY : constant := 1; -- Do not coalesce packets SO_REUSEADDR : constant := 4; -- Bind reuse local address + SO_REUSEPORT : constant := 512; -- Bind reuse port number SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs SO_LINGER : constant := 128; -- Defer close to flush data SO_BROADCAST : constant := 32; -- Can send broadcast msgs @@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is IP_MULTICAST_LOOP : constant := 22; -- Set/get mcast loopback IP_ADD_MEMBERSHIP : constant := 23; -- Join a multicast group IP_DROP_MEMBERSHIP : constant := 24; -- Leave a multicast group + IP_PKTINFO : constant := -1; -- Get datagram info ------------------- -- System limits -- diff --git a/gcc/ada/g-soccon-linux-64.ads b/gcc/ada/g-soccon-linux-64.ads index 5c2946b4b34..0cbafed9fe0 100644 --- a/gcc/ada/g-soccon-linux-64.ads +++ b/gcc/ada/g-soccon-linux-64.ads @@ -35,7 +35,7 @@ -- by the GNAT.Sockets package (g-socket.ads). This package should not be -- directly with'ed by an applications program. --- This is the version for ia64-hp-linux-gnu +-- This is the version for x86_64-pc-linux-gnu -- This file is generated automatically, do not modify it by hand! Instead, -- make changes to gen-soccon.c and re-run it on each target. @@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is TCP_NODELAY : constant := 1; -- Do not coalesce packets SO_REUSEADDR : constant := 2; -- Bind reuse local address + SO_REUSEPORT : constant := -1; -- Bind reuse port number SO_KEEPALIVE : constant := 9; -- Enable keep-alive msgs SO_LINGER : constant := 13; -- Defer close to flush data SO_BROADCAST : constant := 6; -- Can send broadcast msgs @@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group + IP_PKTINFO : constant := 8; -- Get datagram info ------------------- -- System limits -- diff --git a/gcc/ada/g-soccon-linux-x86.ads b/gcc/ada/g-soccon-linux-x86.ads index cb42441a57c..ca1418f3fca 100644 --- a/gcc/ada/g-soccon-linux-x86.ads +++ b/gcc/ada/g-soccon-linux-x86.ads @@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is TCP_NODELAY : constant := 1; -- Do not coalesce packets SO_REUSEADDR : constant := 2; -- Bind reuse local address + SO_REUSEPORT : constant := -1; -- Bind reuse port number SO_KEEPALIVE : constant := 9; -- Enable keep-alive msgs SO_LINGER : constant := 13; -- Defer close to flush data SO_BROADCAST : constant := 6; -- Can send broadcast msgs @@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group + IP_PKTINFO : constant := 8; -- Get datagram info ------------------- -- System limits -- diff --git a/gcc/ada/g-soccon-lynxos.ads b/gcc/ada/g-soccon-lynxos.ads index 851bfbe7cc3..f93e88e53ff 100644 --- a/gcc/ada/g-soccon-lynxos.ads +++ b/gcc/ada/g-soccon-lynxos.ads @@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is TCP_NODELAY : constant := 1; -- Do not coalesce packets SO_REUSEADDR : constant := 4; -- Bind reuse local address + SO_REUSEPORT : constant := 512; -- Bind reuse port number SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs SO_LINGER : constant := 128; -- Defer close to flush data SO_BROADCAST : constant := 32; -- Can send broadcast msgs @@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group + IP_PKTINFO : constant := -1; -- Get datagram info ------------------- -- System limits -- diff --git a/gcc/ada/g-soccon-mingw.ads b/gcc/ada/g-soccon-mingw.ads index 3e612a1a18c..dc39f810e2f 100644 --- a/gcc/ada/g-soccon-mingw.ads +++ b/gcc/ada/g-soccon-mingw.ads @@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is TCP_NODELAY : constant := 1; -- Do not coalesce packets SO_REUSEADDR : constant := 4; -- Bind reuse local address + SO_REUSEPORT : constant := -1; -- Bind reuse port number SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs SO_LINGER : constant := 128; -- Defer close to flush data SO_BROADCAST : constant := 32; -- Can send broadcast msgs @@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group + IP_PKTINFO : constant := 19; -- Get datagram info ------------------- -- System limits -- @@ -184,13 +186,6 @@ package GNAT.Sockets.Constants is Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops - ---------------------- - -- Additional flags -- - ---------------------- - - Thread_Blocking_IO : constant Boolean := True; - -- Set False for contexts where socket i/o are process blocking - ------------------------------ -- MinGW-specific constants -- ------------------------------ @@ -203,4 +198,11 @@ package GNAT.Sockets.Constants is WSANOTINITIALISED : constant := 10093; -- Winsock not intialized WSAEDISCON : constant := 10101; -- Disconnected + ---------------------- + -- Additional flags -- + ---------------------- + + Thread_Blocking_IO : constant Boolean := True; + -- Set False for contexts where socket i/o are process blocking + end GNAT.Sockets.Constants; diff --git a/gcc/ada/g-soccon-solaris-64.ads b/gcc/ada/g-soccon-solaris-64.ads index 46300e061e1..5f57e176cb3 100644 --- a/gcc/ada/g-soccon-solaris-64.ads +++ b/gcc/ada/g-soccon-solaris-64.ads @@ -35,7 +35,7 @@ -- by the GNAT.Sockets package (g-socket.ads). This package should not be -- directly with'ed by an applications program. --- This is the version for sparc-sun-solaris2.8/64 +-- This is the version for sparc64-sun-solaris2.8 -- This file is generated automatically, do not modify it by hand! Instead, -- make changes to gen-soccon.c and re-run it on each target. @@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is TCP_NODELAY : constant := 1; -- Do not coalesce packets SO_REUSEADDR : constant := 4; -- Bind reuse local address + SO_REUSEPORT : constant := -1; -- Bind reuse port number SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs SO_LINGER : constant := 128; -- Defer close to flush data SO_BROADCAST : constant := 32; -- Can send broadcast msgs @@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is IP_MULTICAST_LOOP : constant := 18; -- Set/get mcast loopback IP_ADD_MEMBERSHIP : constant := 19; -- Join a multicast group IP_DROP_MEMBERSHIP : constant := 20; -- Leave a multicast group + IP_PKTINFO : constant := -1; -- Get datagram info ------------------- -- System limits -- diff --git a/gcc/ada/g-soccon-solaris.ads b/gcc/ada/g-soccon-solaris.ads index 26638a9b783..4b433bf5792 100644 --- a/gcc/ada/g-soccon-solaris.ads +++ b/gcc/ada/g-soccon-solaris.ads @@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is TCP_NODELAY : constant := 1; -- Do not coalesce packets SO_REUSEADDR : constant := 4; -- Bind reuse local address + SO_REUSEPORT : constant := -1; -- Bind reuse port number SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs SO_LINGER : constant := 128; -- Defer close to flush data SO_BROADCAST : constant := 32; -- Can send broadcast msgs @@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is IP_MULTICAST_LOOP : constant := 18; -- Set/get mcast loopback IP_ADD_MEMBERSHIP : constant := 19; -- Join a multicast group IP_DROP_MEMBERSHIP : constant := 20; -- Leave a multicast group + IP_PKTINFO : constant := -1; -- Get datagram info ------------------- -- System limits -- diff --git a/gcc/ada/g-soccon-tru64.ads b/gcc/ada/g-soccon-tru64.ads index 5537151ac4f..8e16fbe7e39 100644 --- a/gcc/ada/g-soccon-tru64.ads +++ b/gcc/ada/g-soccon-tru64.ads @@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is TCP_NODELAY : constant := 1; -- Do not coalesce packets SO_REUSEADDR : constant := 4; -- Bind reuse local address + SO_REUSEPORT : constant := 512; -- Bind reuse port number SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs SO_LINGER : constant := 128; -- Defer close to flush data SO_BROADCAST : constant := 32; -- Can send broadcast msgs @@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group + IP_PKTINFO : constant := -1; -- Get datagram info ------------------- -- System limits -- diff --git a/gcc/ada/g-soccon-vms.ads b/gcc/ada/g-soccon-vms.ads index a8aff61fc74..44b8523a36a 100644 --- a/gcc/ada/g-soccon-vms.ads +++ b/gcc/ada/g-soccon-vms.ads @@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is TCP_NODELAY : constant := 1; -- Do not coalesce packets SO_REUSEADDR : constant := 4; -- Bind reuse local address + SO_REUSEPORT : constant := 512; -- Bind reuse port number SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs SO_LINGER : constant := 128; -- Defer close to flush data SO_BROADCAST : constant := 32; -- Can send broadcast msgs @@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group + IP_PKTINFO : constant := -1; -- Get datagram info ------------------- -- System limits -- diff --git a/gcc/ada/g-soccon.ads b/gcc/ada/g-soccon.ads index 6890c65fc2d..b57711d976e 100644 --- a/gcc/ada/g-soccon.ads +++ b/gcc/ada/g-soccon.ads @@ -156,6 +156,7 @@ package GNAT.Sockets.Constants is TCP_NODELAY : constant := 1; -- Do not coalesce packets SO_REUSEADDR : constant := 2; -- Bind reuse local address + SO_REUSEPORT : constant := -1; -- Bind reuse port number SO_KEEPALIVE : constant := 9; -- Enable keep-alive msgs SO_LINGER : constant := 13; -- Defer close to flush data SO_BROADCAST : constant := 6; -- Can send broadcast msgs @@ -169,6 +170,7 @@ package GNAT.Sockets.Constants is IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group + IP_PKTINFO : constant := 8; -- Get datagram info ------------------- -- System limits -- diff --git a/gcc/ada/g-socket.adb b/gcc/ada/g-socket.adb index 04cfdd74d01..e491eed89ac 100644 --- a/gcc/ada/g-socket.adb +++ b/gcc/ada/g-socket.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2007, AdaCore -- +-- Copyright (C) 2001-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -87,21 +87,24 @@ package body GNAT.Sockets is N_Bytes_To_Read => Constants.FIONREAD); Options : constant array (Option_Name) of C.int := - (Keep_Alive => Constants.SO_KEEPALIVE, - Reuse_Address => Constants.SO_REUSEADDR, - Broadcast => Constants.SO_BROADCAST, - Send_Buffer => Constants.SO_SNDBUF, - Receive_Buffer => Constants.SO_RCVBUF, - Linger => Constants.SO_LINGER, - Error => Constants.SO_ERROR, - No_Delay => Constants.TCP_NODELAY, - Add_Membership => Constants.IP_ADD_MEMBERSHIP, - Drop_Membership => Constants.IP_DROP_MEMBERSHIP, - Multicast_If => Constants.IP_MULTICAST_IF, - Multicast_TTL => Constants.IP_MULTICAST_TTL, - Multicast_Loop => Constants.IP_MULTICAST_LOOP, - Send_Timeout => Constants.SO_SNDTIMEO, - Receive_Timeout => Constants.SO_RCVTIMEO); + (Keep_Alive => Constants.SO_KEEPALIVE, + Reuse_Address => Constants.SO_REUSEADDR, + Broadcast => Constants.SO_BROADCAST, + Send_Buffer => Constants.SO_SNDBUF, + Receive_Buffer => Constants.SO_RCVBUF, + Linger => Constants.SO_LINGER, + Error => Constants.SO_ERROR, + No_Delay => Constants.TCP_NODELAY, + Add_Membership => Constants.IP_ADD_MEMBERSHIP, + Drop_Membership => Constants.IP_DROP_MEMBERSHIP, + Multicast_If => Constants.IP_MULTICAST_IF, + Multicast_TTL => Constants.IP_MULTICAST_TTL, + Multicast_Loop => Constants.IP_MULTICAST_LOOP, + Receive_Packet_Info => Constants.IP_PKTINFO, + Send_Timeout => Constants.SO_SNDTIMEO, + Receive_Timeout => Constants.SO_RCVTIMEO); + -- ??? Note: for OpenSolaris, Receive_Packet_Info should be IP_RECVPKTINFO, + -- but for Linux compatibility this constant is the same as IP_PKTINFO. Flags : constant array (0 .. 3) of C.int := (0 => Constants.MSG_OOB, -- Process_Out_Of_Band_Data @@ -865,8 +868,7 @@ package body GNAT.Sockets is begin if Safe_Getservbyname (SN, SP, Res'Access, Buf'Address, Buflen) /= 0 then - Ada.Exceptions.Raise_Exception - (Service_Error'Identity, "Service not found"); + raise Service_Error with "Service not found"; end if; -- Translate from the C format to the API format @@ -892,8 +894,7 @@ package body GNAT.Sockets is (C.int (Short_To_Network (C.unsigned_short (Port))), SP, Res'Access, Buf'Address, Buflen) /= 0 then - Ada.Exceptions.Raise_Exception - (Service_Error'Identity, "Service not found"); + raise Service_Error with "Service not found"; end if; -- Translate from the C format to the API format @@ -946,8 +947,9 @@ package body GNAT.Sockets is begin case Name is - when Multicast_Loop | - Multicast_TTL => + when Multicast_Loop | + Multicast_TTL | + Receive_Packet_Info => Len := V1'Size / 8; Add := V1'Address; @@ -1015,7 +1017,8 @@ package body GNAT.Sockets is when Multicast_TTL => Opt.Time_To_Live := Integer (V1); - when Multicast_Loop => + when Multicast_Loop | + Receive_Packet_Info => Opt.Enabled := (V1 /= 0); when Send_Timeout | @@ -1320,9 +1323,9 @@ package body GNAT.Sockets is procedure Raise_Host_Error (H_Error : Integer) is begin - Ada.Exceptions.Raise_Exception (Host_Error'Identity, + raise Host_Error with Err_Code_Image (H_Error) - & C.Strings.Value (Host_Error_Messages.Host_Error_Message (H_Error))); + & C.Strings.Value (Host_Error_Messages.Host_Error_Message (H_Error)); end Raise_Host_Error; ------------------------ @@ -1332,9 +1335,9 @@ package body GNAT.Sockets is procedure Raise_Socket_Error (Error : Integer) is use type C.Strings.chars_ptr; begin - Ada.Exceptions.Raise_Exception (Socket_Error'Identity, + raise Socket_Error with Err_Code_Image (Error) - & C.Strings.Value (Socket_Error_Message (Error))); + & C.Strings.Value (Socket_Error_Message (Error)); end Raise_Socket_Error; ---------- @@ -1795,7 +1798,8 @@ package body GNAT.Sockets is Len := V1'Size / 8; Add := V1'Address; - when Multicast_Loop => + when Multicast_Loop | + Receive_Packet_Info => V1 := C.unsigned_char (Boolean'Pos (Option.Enabled)); Len := V1'Size / 8; Add := V1'Address; diff --git a/gcc/ada/g-socket.ads b/gcc/ada/g-socket.ads index cbbb1331af0..105f285a8b4 100644 --- a/gcc/ada/g-socket.ads +++ b/gcc/ada/g-socket.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2001-2007, AdaCore -- +-- Copyright (C) 2001-2008, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -623,30 +623,32 @@ package GNAT.Sockets is -- a boolean to enable or disable this option. type Option_Name is ( - Keep_Alive, -- Enable sending of keep-alive messages - Reuse_Address, -- Allow bind to reuse local address - Broadcast, -- Enable datagram sockets to recv/send broadcasts - Send_Buffer, -- Set/get the maximum socket send buffer in bytes - Receive_Buffer, -- Set/get the maximum socket recv buffer in bytes - Linger, -- Shutdown wait for msg to be sent or timeout occur - Error, -- Get and clear the pending socket error - No_Delay, -- Do not delay send to coalesce packets (TCP_NODELAY) - Add_Membership, -- Join a multicast group - Drop_Membership, -- Leave a multicast group - Multicast_If, -- Set default outgoing interface for multicast packets - Multicast_TTL, -- Indicate the time-to-live of sent multicast packets - Multicast_Loop, -- Sent multicast packets are looped to local socket - Send_Timeout, -- Set timeout value for output - Receive_Timeout); -- Set timeout value for input + Keep_Alive, -- Enable sending of keep-alive messages + Reuse_Address, -- Allow bind to reuse local address + Broadcast, -- Enable datagram sockets to recv/send broadcasts + Send_Buffer, -- Set/get the maximum socket send buffer in bytes + Receive_Buffer, -- Set/get the maximum socket recv buffer in bytes + Linger, -- Shutdown wait for msg to be sent or timeout occur + Error, -- Get and clear the pending socket error + No_Delay, -- Do not delay send to coalesce data (TCP_NODELAY) + Add_Membership, -- Join a multicast group + Drop_Membership, -- Leave a multicast group + Multicast_If, -- Set default out interface for multicast packets + Multicast_TTL, -- Set the time-to-live of sent multicast packets + Multicast_Loop, -- Sent multicast packets are looped to local socket + Receive_Packet_Info, -- Receive low level packet info as ancillary data + Send_Timeout, -- Set timeout value for output + Receive_Timeout); -- Set timeout value for input type Option_Type (Name : Option_Name := Keep_Alive) is record case Name is - when Keep_Alive | - Reuse_Address | - Broadcast | - Linger | - No_Delay | - Multicast_Loop => + when Keep_Alive | + Reuse_Address | + Broadcast | + Linger | + No_Delay | + Receive_Packet_Info | + Multicast_Loop => Enabled : Boolean; case Name is