From 36fcd411239334591936dd484560585d8e9ae07e Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 6 Feb 2008 18:07:52 +0000 Subject: 2008-02-06 Joel Sherrill * gen-soccon.c, gsocket.h: Update to GCC SVN trunk. --- gen-soconn/ChangeLog | 4 ++++ gen-soconn/gen-soccon.c | 54 ++++++++++++++++++++++++++++++++++++++++++++----- gen-soconn/gsocket.h | 32 ++++++++++++++++++++++++++++- 3 files changed, 84 insertions(+), 6 deletions(-) diff --git a/gen-soconn/ChangeLog b/gen-soconn/ChangeLog index e0ed653..4a18117 100644 --- a/gen-soconn/ChangeLog +++ b/gen-soconn/ChangeLog @@ -1,3 +1,7 @@ +2008-02-06 Joel Sherrill + + * gen-soccon.c, gsocket.h: Update to GCC SVN trunk. + 2007-09-28 Joel Sherrill * gen-soccon.c: Update copyright. diff --git a/gen-soconn/gen-soccon.c b/gen-soconn/gen-soccon.c index 62fb248..79701bb 100644 --- a/gen-soconn/gen-soccon.c +++ b/gen-soconn/gen-soccon.c @@ -24,11 +24,17 @@ /* This program generates g-soccon.ads */ -/* To build using DEC C: - CC/DEFINE="TARGET=""OpenVMS""" gen-soccon - LINK gen-soccon - RUN gen-soccon -*/ +/* + * To build using DEC C: + * + * CC/DEFINE="TARGET=""OpenVMS""" gen-soccon + * LINK gen-soccon + * RUN gen-soccon + * + * Note: OpenVMS versions older than 8.3 provide an incorrect value in + * the DEC C header files for MSG_WAITALL. To generate the VMS version + * of g-soccon.ads, gen-soccon should be run on an 8.3 or later machine. + */ #ifndef TARGET # error Please define TARGET @@ -497,6 +503,11 @@ CND(TCP_NODELAY, "Do not coalesce packets") #endif CND(SO_REUSEADDR, "Bind reuse local address") +#ifndef SO_REUSEPORT +#define SO_REUSEPORT -1 +#endif +CND(SO_REUSEPORT, "Bind reuse port number") + #ifndef SO_KEEPALIVE #define SO_KEEPALIVE -1 #endif @@ -589,6 +600,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 +622,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;") diff --git a/gen-soconn/gsocket.h b/gen-soconn/gsocket.h index 01c7e28..ff175dd 100644 --- a/gen-soconn/gsocket.h +++ b/gen-soconn/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- * @@ -154,3 +154,33 @@ #include #include #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 -- cgit v1.2.3