summaryrefslogtreecommitdiff
path: root/gcc/ada/gsocket.h
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-14 12:39:55 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-14 12:39:55 +0000
commit43708347a65411b3b9632daf540c2e23834620c2 (patch)
treea0154a432838c9ab26b6f1434eabfeddc95a92d8 /gcc/ada/gsocket.h
parent59805910dc260c5cdfca5ae9524a6bced9246d72 (diff)
downloadgcc-43708347a65411b3b9632daf540c2e23834620c2.tar.gz
2010-06-14 Ed Schonberg <schonberg@adacore.com>
* sem_ch8.adb (End_Use_Type): Before indicating that an operator is not use-visible, check whether it is a primitive for more than one type. 2010-06-14 Robert Dewar <dewar@adacore.com> * sem_ch3.adb (Copy_And_Swap): Copy Has_Pragma_Unmodified flag. * sem_ch7.adb (Preserve_Full_Attributes): Preserve Has_Pragma_Unmodified flag. 2010-06-14 Thomas Quinot <quinot@adacore.com> * g-sttsne-locking.adb, g-sttsne-locking.ads, g-sttsne.ads, g-sttsne-vxworks.adb, g-sttsne-dummy.ads: Removed. Mutual exclusion is now done in GNAT.Sockets if necessary. * gsocket.h, g-socket.adb, g-sothco.ads (GNAT.Sockets.Get_XXX_By_YYY): Ensure mutual exclusion for netdb operations if the target platform requires it. (GNAT.Sockets.Thin_Common): New binding for getXXXbyYYY, treating struct hostent as an opaque type to improve portability. * s-oscons-tmplt.c, socket.c: For the case of Vxworks, emulate gethostbyYYY using proprietary VxWorks API so that a uniform interface is available for the Ada side. * gcc-interface/Makefile.in: Remove g-sttsne-* * gcc-interface/Make-lang.in: Update dependencies. 2010-06-14 Vincent Celier <celier@adacore.com> * gnatcmd.adb (Mapping_File): New function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160731 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/gsocket.h')
-rw-r--r--gcc/ada/gsocket.h45
1 files changed, 24 insertions, 21 deletions
diff --git a/gcc/ada/gsocket.h b/gcc/ada/gsocket.h
index a8e6faa2467..7763b1801de 100644
--- a/gcc/ada/gsocket.h
+++ b/gcc/ada/gsocket.h
@@ -194,34 +194,37 @@
#include <netdb.h>
#endif
-/*
- * Handling of gethostbyname, gethostbyaddr, getservbyname and getservbyport
- * =========================================================================
- *
- * The default implementation of GNAT.Sockets.Thin requires that these
- * operations be either thread safe, or that a reentrant version getXXXbyYYY_r
- * be provided. In both cases, socket.c provides a __gnat_safe_getXXXbyYYY
- * function with the same signature as getXXXbyYYY_r. If the operating
- * system version of getXXXbyYYY is thread safe, the provided auxiliary
- * buffer argument is unused and ignored.
- *
- * Target specific versions of GNAT.Sockets.Thin for platforms that can't
- * fulfill these requirements must provide their own protection mechanism
- * in Safe_GetXXXbyYYY, and if they require GNAT.Sockets to provide a buffer
- * to this effect, then we need to set Need_Netdb_Buffer here (case of
- * VxWorks and VMS).
- */
-
-#if defined (_AIX) || defined (__FreeBSD__) || defined (__hpux__) || defined (__osf__) || defined (_WIN32) || defined (__APPLE__)
+#if defined (_AIX) || defined (__FreeBSD__) || defined (__hpux__) || \
+ defined (__osf__) || defined (_WIN32) || defined (__APPLE__)
# define HAVE_THREAD_SAFE_GETxxxBYyyy 1
-#elif defined (sgi) || defined (linux) || defined (__GLIBC__) || (defined (sun) && defined (__SVR4) && !defined (__vxworks)) || defined(__rtems__)
+
+#elif defined (sgi) || defined (linux) || defined (__GLIBC__) || \
+ (defined (sun) && defined (__SVR4) && !defined (__vxworks)) || \
+ defined(__rtems__)
# define HAVE_GETxxxBYyyy_R 1
#endif
-#if defined (HAVE_GETxxxBYyyy_R) || !defined (HAVE_THREAD_SAFE_GETxxxBYyyy)
+/*
+ * Properties of the unerlying NetDB library:
+ * Need_Netdb_Buffer __gnat_getXXXbyYYY expects a caller-supplied buffer
+ * Need_Netdb_Lock __gnat_getXXXbyYYY expects the caller to ensure
+ * mutual exclusion
+ *
+ * See "Handling of gethostbyname, gethostbyaddr, getservbyname and
+ * getservbyport" in socket.c for details.
+ */
+
+#if defined (HAVE_GETxxxBYyyy_R)
# define Need_Netdb_Buffer 1
+# define Need_Netdb_Lock 0
+
#else
# define Need_Netdb_Buffer 0
+# if !defined (HAVE_THREAD_SAFE_GETxxxBYyyy)
+# define Need_Netdb_Lock 1
+# else
+# define Need_Netdb_Lock 0
+# endif
#endif
#if defined (__FreeBSD__) || defined (__vxworks) || defined(__rtems__)