summaryrefslogtreecommitdiff
path: root/gcc/ada/gsocket.h
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-06-06 10:48:51 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-06-06 10:48:51 +0000
commit29aacb7d48e75b7d6f131bd00a0ead0a362a300d (patch)
tree21c8578817abfa775cbe5d7fee601745c1d48134 /gcc/ada/gsocket.h
parent7362288fbe1690541abd4e0b713294c332b976ad (diff)
downloadgcc-29aacb7d48e75b7d6f131bd00a0ead0a362a300d.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125466 138bc75d-0d04-0410-961f-82ee72b054a4
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 a380788995a..7df7ea089cb 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