This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 2/2] gcc/ada/socket.c, gsocket.h: Add conditionals for RTEMS
- From: Joel Sherrill <joel dot sherrill at oarcorp dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Joel Sherrill <joel dot sherrill at oarcorp dot com>
- Date: Tue, 12 Aug 2014 09:31:21 -0500
- Subject: [PATCH 2/2] gcc/ada/socket.c, gsocket.h: Add conditionals for RTEMS
- Authentication-results: sourceware.org; auth=none
- References: <1407853881-11152-1-git-send-email-joel dot sherrill at oarcorp dot com>
Hopefully this addresses the comments.
OK to comment?
2014-08-12 Joel Sherrill <joel.sherrill@oarcorp.com>
* socket.c: For RTEMS, use correct prototype of gethostbyname_r().
* gsocket.h Add include of <unistd.h> on RTEMS.
---
gcc/ada/gsocket.h | 5 +++++
gcc/ada/socket.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/gcc/ada/gsocket.h b/gcc/ada/gsocket.h
index f139d72..2034137 100644
--- a/gcc/ada/gsocket.h
+++ b/gcc/ada/gsocket.h
@@ -184,6 +184,11 @@
#include <sys/time.h>
#endif
+#if defined(__rtems__)
+#include <unistd.h>
+/* Required, for read(), write(), and close() */
+#endif
+
/*
* RTEMS has these .h files but not until you have built and installed RTEMS.
* When building a C/C++ toolset, you also build the newlib C library, so the
diff --git a/gcc/ada/socket.c b/gcc/ada/socket.c
index 4a9e6ad..ad88268 100644
--- a/gcc/ada/socket.c
+++ b/gcc/ada/socket.c
@@ -184,7 +184,7 @@ __gnat_gethostbyname (const char *name,
struct hostent *rh;
int ri;
-#if defined(__linux__) || defined(__GLIBC__)
+#if defined(__linux__) || defined(__GLIBC__) || defined(__rtems__)
(void) gethostbyname_r (name, ret, buf, buflen, &rh, h_errnop);
#else
rh = gethostbyname_r (name, ret, buf, buflen, h_errnop);
--
1.9.3