From 58ff82dab202fd7e1037c79afb5b54688ac9b3df Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 8 Jul 2008 15:33:39 +0000 Subject: 2008-07-08 Joel Sherrill * gen-soccon.c, gsocket.h, init.c: Update. --- gen-soconn/ChangeLog | 4 +++ gen-soconn/gen-soccon.c | 90 +++++++++++++++++++++++++++++++++++-------------- gen-soconn/gsocket.h | 10 ++++-- gen-soconn/init.c | 3 ++ 4 files changed, 79 insertions(+), 28 deletions(-) diff --git a/gen-soconn/ChangeLog b/gen-soconn/ChangeLog index 4a18117..74cd072 100644 --- a/gen-soconn/ChangeLog +++ b/gen-soconn/ChangeLog @@ -1,3 +1,7 @@ +2008-07-08 Joel Sherrill + + * gen-soccon.c, gsocket.h, init.c: Update. + 2008-02-06 Joel Sherrill * gen-soccon.c, gsocket.h: Update to GCC SVN trunk. diff --git a/gen-soconn/gen-soccon.c b/gen-soconn/gen-soccon.c index 79701bb..2991985 100644 --- a/gen-soconn/gen-soccon.c +++ b/gen-soconn/gen-soccon.c @@ -4,7 +4,7 @@ * * * G E N - S O C C O N * * * - * Copyright (C) 2004-2007, Free Software Foundation, Inc. * + * Copyright (C) 2004-2008, 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- * @@ -51,16 +51,19 @@ #include "gsocket.h" +typedef enum { NUM, TXT } kind_t; + struct line { char *text; char *value; char *comment; + kind_t kind; struct line *next; }; struct line *first = NULL, *last = NULL; -#define TXT(_text) add_line(_text, NULL, NULL); +#define TXT(_text) add_line(_text, NULL, NULL, TXT); /* Plain text */ #define _NL TXT("") @@ -69,13 +72,13 @@ struct line *first = NULL, *last = NULL; #define itoad(n) f_itoa ("%d", (n)) #define itoax(n) f_itoa ("16#%08x#", (n)) -#define CND(name,comment) add_line(#name, itoad (name), comment); +#define CND(name,comment) add_line(#name, itoad (name), comment, NUM); /* Constant (decimal) */ -#define CNX(name,comment) add_line(#name, itoax (name), comment); +#define CNX(name,comment) add_line(#name, itoax (name), comment, NUM); /* Constant (hexadecimal) */ -#define CN_(name,comment) add_line(#name, name, comment); +#define CN_(name,comment) add_line(#name, name, comment, TXT); /* Constant (generic) */ #define STR(p) STR1(p) @@ -87,7 +90,7 @@ void output (void); char *f_itoa (char *, int); /* int to string */ -void add_line (char *, char*, char*); +void add_line (char *, char*, char*, kind_t); #ifdef __MINGW32__ unsigned int _CRT_fmode = _O_BINARY; @@ -104,7 +107,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-2007, Free Software Foundation, Inc. --") +TXT("-- Copyright (C) 2000-2008, 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- --") @@ -137,6 +140,7 @@ TXT("-- This is the version for " TARGET) TXT("-- This file is generated automatically, do not modify it by hand! Instead,") TXT("-- make changes to gen-soccon.c and re-run it on each target.") _NL +TXT("with Interfaces.C;") TXT("package GNAT.Sockets.Constants is") _NL TXT(" --------------") @@ -145,12 +149,16 @@ TXT(" --------------") _NL #ifndef AF_INET -#define AF_INET -1 +# define AF_INET -1 #endif CND(AF_INET, "IPv4 address family") #ifndef AF_INET6 -#define AF_INET6 -1 +# define AF_INET6 -1 +#else +#ifndef __rtems__ +# define HAVE_AF_INET6 1 +#endif #endif CND(AF_INET6, "IPv6 address family") _NL @@ -267,7 +275,7 @@ CND(EISCONN, "Socket already connected") #ifndef ELOOP #define ELOOP -1 #endif -CND(ELOOP, "Too many symbolic lynks") +CND(ELOOP, "Too many symbolic links") #ifndef EMFILE #define EMFILE -1 @@ -573,6 +581,11 @@ CND(IP_ADD_MEMBERSHIP, "Join a multicast group") #endif CND(IP_DROP_MEMBERSHIP, "Leave a multicast group") +#ifndef IP_PKTINFO +#define IP_PKTINFO -1 +#endif +CND(IP_PKTINFO, "Get datagram info") + _NL TXT(" -------------------") TXT(" -- System limits --") @@ -599,7 +612,34 @@ CND(SIZEOF_tv_sec, "tv_sec") #define SIZEOF_tv_usec (sizeof tv.tv_usec) CND(SIZEOF_tv_usec, "tv_usec") } - +_NL +TXT(" -- Sizes of protocol specific address types (for sockaddr.sa_len)") +_NL +#define SIZEOF_sockaddr_in (sizeof (struct sockaddr_in)) +CND(SIZEOF_sockaddr_in, "struct sockaddr_in") +#ifdef HAVE_AF_INET6 +# define SIZEOF_sockaddr_in6 (sizeof (struct sockaddr_in6)) +#else +# define SIZEOF_sockaddr_in6 0 +#endif +CND(SIZEOF_sockaddr_in6, "struct sockaddr_in6") +_NL +TXT(" -- Size of file descriptor sets") +_NL +#define SIZEOF_fd_set (sizeof (fd_set)) +CND(SIZEOF_fd_set, "fd_set"); +_NL +TXT(" -- Fields of struct hostent") +_NL +#ifdef __MINGW32__ +# define h_addrtype_t "short" +# define h_length_t "short" +#else +# define h_addrtype_t "int" +# define h_length_t "int" +#endif +TXT(" subtype H_Addrtype_T is Interfaces.C." h_addrtype_t ";") +TXT(" subtype H_Length_T is Interfaces.C." h_length_t ";") _NL TXT(" ----------------------------------------") TXT(" -- Properties of supported interfaces --") @@ -607,6 +647,10 @@ TXT(" ----------------------------------------") _NL CND(Need_Netdb_Buffer, "Need buffer for Netdb ops") +CND(Has_Sockaddr_Len, "Sockaddr has sa_len field") +_NL +TXT(" Thread_Blocking_IO : constant Boolean := True;") +TXT(" -- Set False for contexts where socket i/o are process blocking") #ifdef __vxworks _NL @@ -634,19 +678,10 @@ _NL CND(WSASYSNOTREADY, "System not ready") CND(WSAVERNOTSUPPORTED, "Version not supported") -CND(WSANOTINITIALISED, "Winsock not intialized") +CND(WSANOTINITIALISED, "Winsock not initialized") 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;") @@ -667,7 +702,8 @@ output (void) { for (p = first; p != NULL; p = p->next) { if (p->value != NULL) { UPD_MAX(text); - UPD_MAX(value); + if (p->kind == NUM) + UPD_MAX(value); } } sprintf (fmt, " %%-%ds : constant := %%%ds;%%s%%s\n", @@ -695,13 +731,15 @@ f_itoa (char *fmt, int n) { } void -add_line (char *_text, char *_value, char *_comment) { +add_line (char *_text, char *_value, char *_comment, kind_t _kind) { struct line *l = (struct line *) malloc (sizeof (struct line)); - l->text = _text; - l->value = _value; + l->text = _text; + l->value = _value; l->comment = _comment; - l->next = NULL; + l->kind = _kind; + l->next = NULL; + if (last == NULL) first = last = l; else { diff --git a/gen-soconn/gsocket.h b/gen-soconn/gsocket.h index ff175dd..c08ca79 100644 --- a/gen-soconn/gsocket.h +++ b/gen-soconn/gsocket.h @@ -6,7 +6,7 @@ * * * C Header File * * * - * Copyright (C) 2004-2006, Free Software Foundation, Inc. * + * Copyright (C) 2004-2008, 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- * @@ -175,7 +175,7 @@ #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)) +#elif defined (sgi) || defined (linux) || defined (__GLIBC__) || (defined (sun) && defined (__SVR4) && !defined (__vxworks)) # define HAVE_GETxxxBYyyy_R 1 #endif @@ -184,3 +184,9 @@ #else # define Need_Netdb_Buffer 0 #endif + +#if defined (__FreeBSD__) || defined (__vxworks) || defined (__rtems__) +# define Has_Sockaddr_Len 1 +#else +# define Has_Sockaddr_Len 0 +#endif diff --git a/gen-soconn/init.c b/gen-soconn/init.c index 5bed9dc..5bb3cf2 100644 --- a/gen-soconn/init.c +++ b/gen-soconn/init.c @@ -17,6 +17,9 @@ rtems_task Init( /* configuration information */ +/* NOTICE: the clock driver is explicitly disabled */ +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER + #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -- cgit v1.2.3