aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gen-soccon.c
diff options
context:
space:
mode:
authorThomas Quinot <quinot@adacore.com>2005-09-05 09:50:26 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2005-09-05 09:50:26 +0200
commit826757551170eec3ec794d961b5b6dc24d1244cd (patch)
treeae1698c6bf9c081f3fb4cdc10113b63b9801baf6 /gcc/ada/gen-soccon.c
parentb9260c3d60418dd0e549bbdb69c8f696a76d5106 (diff)
downloadgcc-826757551170eec3ec794d961b5b6dc24d1244cd.zip
gcc-826757551170eec3ec794d961b5b6dc24d1244cd.tar.gz
gcc-826757551170eec3ec794d961b5b6dc24d1244cd.tar.bz2
g-soccon-vms.adb: Renamed to g-soccon-vms.ads
2005-09-01 Thomas Quinot <quinot@adacore.com> * g-soccon-vms.adb: Renamed to g-soccon-vms.ads * g-soccon-vms.ads: Renamed from g-soccon-vms.adb * g-soccon.ads, g-soccon-tru64.ads, g-soccon-aix.ads, g-soccon-darwin.ads, g-soccon-irix.ads, g-soccon-hpux.ads, g-soccon-solaris.ads, g-soccon-mingw.ads, g-soccon-vxworks.ads, g-soccon-freebsd.ads: Add new constants: IP_MULTICAST_IF SO_RCVTIMEO/SO_SNDTIMEO IOV_MAX * gen-soccon.c: Move all target-specific file inclusions and macro definitions to gsocket.h, in order to ensure that any C code in socket.c will see a set of constants that is consistent with the contents of g-soccon.ads. * gsocket.h: Code imported from gen-soccon.c: Move all target-specific file inclusions and macro definitions to gsocket.h, in order to ensure that any C code in socket.c will see a set of constants that is consistent with the contents of g-soccon.ads. This change also makes gen-soccon self-contained (removing dependencies upon GCC internal headers). * g-socket.adb (Send_Vector): Make calls to Writev at most IOV_MAX iovecs at a time. (To_Inet_Addr): Now a procedure instead of a function, more efficient. * socket.c: Minor reformatting. From-SVN: r103853
Diffstat (limited to 'gcc/ada/gen-soccon.c')
-rw-r--r--gcc/ada/gen-soccon.c47
1 files changed, 33 insertions, 14 deletions
diff --git a/gcc/ada/gen-soccon.c b/gcc/ada/gen-soccon.c
index 643f639..363416a 100644
--- a/gcc/ada/gen-soccon.c
+++ b/gcc/ada/gen-soccon.c
@@ -24,20 +24,22 @@
/* This program generates g-soccon.ads */
+/* To build using DEC C:
+ CC/DEFINE="TARGET=OpenVMS" gen-soccon
+ LINK gen-soccon
+ RUN gen-soccon
+*/
+
+#ifndef TARGET
+# error Please define TARGET
+#endif
+
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "gsocket.h"
-#ifdef __MINGW32__
-#include <winsock2.h>
-#else
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <sys/ioctl.h>
-#include <netdb.h>
-#endif
-
struct line {
char *text;
char *value;
@@ -65,6 +67,9 @@ struct line *first = NULL, *last = NULL;
#define CN_(name,comment) add_line(#name, name, comment);
/* Constant (generic) */
+#define STR(p) STR1(p)
+#define STR1(p) #p
+
void output (void);
/* Generate output spec */
@@ -113,7 +118,7 @@ TXT("-- This package provides target dependent definitions of constant for use"
TXT("-- by the GNAT.Sockets package (g-socket.ads). This package should not be")
TXT("-- directly with'ed by an applications program.")
_NL
-TXT("-- This is the version for " TARGET)
+TXT("-- This is the version for " STR (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
@@ -377,12 +382,12 @@ _NL
#ifndef FIONBIO
#define FIONBIO -1
#endif
-CNX(FIONBIO, "Set/clear non-blocking io")
+CND(FIONBIO, "Set/clear non-blocking io")
#ifndef FIONREAD
#define FIONREAD -1
#endif
-CNX(FIONREAD, "How many bytes to read")
+CND(FIONREAD, "How many bytes to read")
_NL
TXT(" --------------------")
TXT(" -- Shutdown modes --")
@@ -549,6 +554,17 @@ CND(IP_ADD_MEMBERSHIP, "Join a multicast group")
CND(IP_DROP_MEMBERSHIP, "Leave a multicast group")
_NL
+TXT(" -------------------")
+TXT(" -- System limits --")
+TXT(" -------------------")
+_NL
+
+#ifndef IOV_MAX
+#define IOV_MAX INT_MAX
+#endif
+CND(IOV_MAX, "Maximum writev iovcnt")
+
+_NL
TXT("end GNAT.Sockets.Constants;")
output ();
@@ -587,9 +603,12 @@ output (void) {
char *
f_itoa (char *fmt, int n) {
- char buf[32];
+ char buf[32], *ret;
sprintf (buf, fmt, n);
- return strdup (buf);
+ ret = malloc (strlen (buf) + 1);
+ if (ret != NULL)
+ strcpy (ret, buf);
+ return ret;
}
void