public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <derodat@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Patrick Bernardi <bernardi@adacore.com>
Subject: [Ada] Enable use of GNAT.Sockets for VxWorks RTP
Date: Mon, 19 Aug 2019 10:28:00 -0000	[thread overview]
Message-ID: <20190819083900.GA33437@adacore.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1228 bytes --]

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)
   is
      Addresses : Address_Info_Array :=
        Get_Address_Info
          (Host, Serv, Family,
           Passive      => False,
           Numeric_Host => False);
   begin
      Sort (Addresses, IPv6_TCP_Preferred'Access);
   end Print_Address_Info;

begin
   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>

gcc/ada/

	* 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
	directly.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 382 bytes --]

--- 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
-#endif
-
 int __gnat_getaddrinfo(
   const char *node,
   const char *service,


                 reply	other threads:[~2019-08-19  8:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190819083900.GA33437@adacore.com \
    --to=derodat@adacore.com \
    --cc=bernardi@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).