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
This commit is contained in:
Thomas Quinot 2007-06-06 12:48:51 +02:00 committed by Arnaud Charlet
parent 37000abae4
commit 4ce7ff881a
3 changed files with 82 additions and 6 deletions

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- Copyright (C) 2000-2007, 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- --
@ -35,7 +35,7 @@
-- by the GNAT.Sockets package (g-socket.ads). This package should not be
-- directly with'ed by an applications program.
-- This is the version for powerpc-apple-darwin7.4.1
-- This is the version for powerpc-apple-darwin8.8.0
-- This file is generated automatically, do not modify it by hand! Instead,
-- make changes to gen-soccon.c and re-run it on each target.
@ -167,7 +167,7 @@ package GNAT.Sockets.Constants is
-- System limits --
-------------------
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
IOV_MAX : constant := 1024; -- Maximum writev iovcnt
----------------------
-- Type definitions --
@ -178,4 +178,17 @@ package GNAT.Sockets.Constants is
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
----------------------------------------
-- Properties of supported interfaces --
----------------------------------------
Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
----------------------
-- Additional flags --
----------------------
Thread_Blocking_IO : constant Boolean := True;
-- Set False for contexts where socket i/o are process blocking
end GNAT.Sockets.Constants;

View File

@ -4,7 +4,7 @@
* *
* G E N - S O C C O N *
* *
* Copyright (C) 2004-2005, Free Software Foundation, Inc. *
* Copyright (C) 2004-2007, 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- *
@ -98,7 +98,7 @@ TXT("-- G N A T . S O C K E T S . C O N S T A N T S
TXT("-- --")
TXT("-- S p e c --")
TXT("-- --")
TXT("-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --")
TXT("-- Copyright (C) 2000-2007, Free Software Foundation, Inc. --")
TXT("-- --")
TXT("-- GNAT is free software; you can redistribute it and/or modify it under --")
TXT("-- terms of the GNU General Public License as published by the Free Soft- --")
@ -589,6 +589,14 @@ CND(SIZEOF_tv_sec, "tv_sec")
CND(SIZEOF_tv_usec, "tv_usec")
}
_NL
TXT(" ----------------------------------------")
TXT(" -- Properties of supported interfaces --")
TXT(" ----------------------------------------")
_NL
CND(Need_Netdb_Buffer, "Need buffer for Netdb ops")
#ifdef __vxworks
_NL
TXT(" --------------------------------")
@ -603,6 +611,31 @@ CND(OK, "VxWorks generic success")
CND(ERROR, "VxWorks generic error")
#endif
#ifdef __MINGW32__
_NL
TXT(" ------------------------------")
TXT(" -- MinGW-specific constants --")
TXT(" ------------------------------")
_NL
TXT(" -- These constants may be used only within the MinGW version of")
TXT(" -- GNAT.Sockets.Thin.")
_NL
CND(WSASYSNOTREADY, "System not ready")
CND(WSAVERNOTSUPPORTED, "Version not supported")
CND(WSANOTINITIALISED, "Winsock not intialized")
CND(WSAEDISCON, "Disconnected")
#endif
_NL
TXT(" ----------------------")
TXT(" -- Additional flags --")
TXT(" ----------------------")
_NL
TXT(" Thread_Blocking_IO : constant Boolean := True;")
TXT(" -- Set False for contexts where socket i/o are process blocking")
_NL
TXT("end GNAT.Sockets.Constants;")

View File

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