aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gsocket.h
diff options
context:
space:
mode:
authorThomas Quinot <quinot@adacore.com>2007-06-06 12:48:51 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2007-06-06 12:48:51 +0200
commit4ce7ff881ab27cda15543985de467fd6c9611676 (patch)
tree21c8578817abfa775cbe5d7fee601745c1d48134 /gcc/ada/gsocket.h
parent37000abae45e881eaeaf0ca40f043a7f5f55e924 (diff)
downloadgcc-4ce7ff881ab27cda15543985de467fd6c9611676.zip
gcc-4ce7ff881ab27cda15543985de467fd6c9611676.tar.gz
gcc-4ce7ff881ab27cda15543985de467fd6c9611676.tar.bz2
g-soccon-darwin.ads, [...]: Add new constant Thread_Blocking_IO...
2007-04-20 Thomas Quinot <quinot@adacore.com> * g-soccon-darwin.ads, gen-soccon.c: Add new constant Thread_Blocking_IO, always True by default, set False on a per-runtime basis. Add Windows-specific constants Add new constant Need_Netdb_Buffer. Add new macros to indicate whether getXXXbyYYY is thread safe and, if not, whether to use getXXXbyYYY_r. * gsocket.h: Add new constant Need_Netdb_Buffer. Add new macros to indicate whether getXXXbyYYY is thread safe and, if not, whether to use getXXXbyYYY_r. From-SVN: r125466
Diffstat (limited to 'gcc/ada/gsocket.h')
-rw-r--r--gcc/ada/gsocket.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/gcc/ada/gsocket.h b/gcc/ada/gsocket.h
index a380788..7df7ea0 100644
--- a/gcc/ada/gsocket.h
+++ b/gcc/ada/gsocket.h
@@ -6,7 +6,7 @@
* *
* C Header File *
* *
- * Copyright (C) 2004-2005, Free Software Foundation, Inc. *
+ * Copyright (C) 2004-2006, Free Software Foundation, Inc. *
* *
* 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- *
@@ -146,3 +146,33 @@
#include <sys/ioctl.h>
#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__)
+# define HAVE_THREAD_SAFE_GETxxxBYyyy 1
+#elif defined (sgi) || defined (linux) || (defined (sun) && defined (__SVR4) && !defined (__vxworks))
+# define HAVE_GETxxxBYyyy_R 1
+#endif
+
+#if defined (HAVE_GETxxxBYyyy_R) || !defined (HAVE_THREAD_SAFE_GETxxxBYyyy)
+# define Need_Netdb_Buffer 1
+#else
+# define Need_Netdb_Buffer 0
+#endif