[Ada] Enable use of GNAT.Sockets for VxWorks RTP
diff mbox series

Message ID 20190819083900.GA33437@adacore.com
State New
Headers show
  • [Ada] Enable use of GNAT.Sockets for VxWorks RTP
Related show

Commit Message

Pierre-Marie de Rodat Aug. 19, 2019, 8:39 a.m. UTC
The recent introduction of GNAT.Sockets IPv6 support broke support for
VxWorks RTPs due to the use of internal VxWorks kernel calls. This patch
rectifies this by using the VxWorks public API for these routines.

The following RTP should compile successfully on a Development profile
VxWorks kernel that includes the INCLUDE_GETNAMEINFO component:

with GNAT.Sockets;      use GNAT.Sockets;

procedure IPvX is
   procedure Print_Address_Info
     (Host, Serv   : String;
      Family       : Family_Type := Family_Unspec)
      Addresses : Address_Info_Array :=
          (Host, Serv, Family,
           Passive      => False,
           Numeric_Host => False);
      Sort (Addresses, IPv6_TCP_Preferred'Access);
   end Print_Address_Info;

   Print_Address_Info ("localhost", "ssh");
end IPvX;

Tested on x86_64-pc-linux-gnu, committed on trunk

2019-08-19  Patrick Bernardi  <bernardi@adacore.com>


	* socket.c: Removed the redefinition of getaddrinfo, getnameinfo
	and freeaddrinfo to internal VxWorks kernel calls because they
	are, well, internal kernel calls and cannot be called from RTPs.
	VxWorks provides the necessary components to call these routines

diff mbox series

--- gcc/ada/socket.c
+++ gcc/ada/socket.c
@@ -704,12 +704,6 @@  __gnat_servent_s_proto (struct servent * s)
 #if defined(AF_INET6) && !defined(__rtems__)
-#if defined (__vxworks)
-#define getaddrinfo ipcom_getaddrinfo
-#define getnameinfo ipcom_getnameinfo
-#define freeaddrinfo ipcom_freeaddrinfo
 int __gnat_getaddrinfo(
   const char *node,
   const char *service,