summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ada/g-soccon-aix.ads13
-rw-r--r--gcc/ada/g-soccon-darwin.ads11
-rw-r--r--gcc/ada/g-soccon-freebsd.ads11
-rw-r--r--gcc/ada/g-soccon-hpux-ia64.ads181
-rw-r--r--gcc/ada/g-soccon-hpux.ads11
-rw-r--r--gcc/ada/g-soccon-irix.ads11
-rw-r--r--gcc/ada/g-soccon-linux-64.ads181
-rw-r--r--gcc/ada/g-soccon-linux-ppc.ads181
-rw-r--r--gcc/ada/g-soccon-linux-x86.ads181
-rw-r--r--gcc/ada/g-soccon-mingw.ads11
-rw-r--r--gcc/ada/g-soccon-solaris-64.ads181
-rw-r--r--gcc/ada/g-soccon-solaris.ads11
-rw-r--r--gcc/ada/g-soccon-tru64.ads11
-rw-r--r--gcc/ada/g-soccon-vms.ads11
-rw-r--r--gcc/ada/g-soccon-vxworks.ads21
-rw-r--r--gcc/ada/g-soccon.ads14
-rw-r--r--gcc/ada/g-socket.adb289
-rw-r--r--gcc/ada/g-socket.ads58
-rw-r--r--gcc/ada/g-socthi-mingw.adb25
-rw-r--r--gcc/ada/g-socthi-mingw.ads26
-rw-r--r--gcc/ada/g-socthi-vms.ads106
-rw-r--r--gcc/ada/g-socthi-vxworks.adb27
-rw-r--r--gcc/ada/g-socthi-vxworks.ads112
-rw-r--r--gcc/ada/g-socthi.ads23
-rw-r--r--gcc/ada/gen-soccon.c52
-rw-r--r--gcc/ada/gsocket.h6
-rw-r--r--gcc/ada/socket.c41
27 files changed, 1489 insertions, 317 deletions
diff --git a/gcc/ada/g-soccon-aix.ads b/gcc/ada/g-soccon-aix.ads
index 3b361b51a14..06773f24c08 100644
--- a/gcc/ada/g-soccon-aix.ads
+++ b/gcc/ada/g-soccon-aix.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, 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-ibm-aix5.1.0.0
+-- This is the version for powerpc-ibm-aix5.3.0.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.
@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 16; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-darwin.ads b/gcc/ada/g-soccon-darwin.ads
index 3927b789798..4ae827d3574 100644
--- a/gcc/ada/g-soccon-darwin.ads
+++ b/gcc/ada/g-soccon-darwin.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, 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- --
@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-freebsd.ads b/gcc/ada/g-soccon-freebsd.ads
index 29319a2bc0b..964e75bc83b 100644
--- a/gcc/ada/g-soccon-freebsd.ads
+++ b/gcc/ada/g-soccon-freebsd.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, 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- --
@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 1024; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-hpux-ia64.ads b/gcc/ada/g-soccon-hpux-ia64.ads
new file mode 100644
index 00000000000..ea7a63d21fa
--- /dev/null
+++ b/gcc/ada/g-soccon-hpux-ia64.ads
@@ -0,0 +1,181 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . C O N S T A N T S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2000-2005, 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- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides target dependent definitions of constant for use
+-- 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 ia64-hp-hpux11.23
+-- 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.
+
+package GNAT.Sockets.Constants is
+
+ --------------
+ -- Families --
+ --------------
+
+ AF_INET : constant := 2; -- IPv4 address family
+ AF_INET6 : constant := 22; -- IPv6 address family
+
+ -----------
+ -- Modes --
+ -----------
+
+ SOCK_STREAM : constant := 1; -- Stream socket
+ SOCK_DGRAM : constant := 2; -- Datagram socket
+
+ -------------------
+ -- Socket errors --
+ -------------------
+
+ EACCES : constant := 13; -- Permission denied
+ EADDRINUSE : constant := 226; -- Address already in use
+ EADDRNOTAVAIL : constant := 227; -- Cannot assign address
+ EAFNOSUPPORT : constant := 225; -- Addr family not supported
+ EALREADY : constant := 244; -- Operation in progress
+ EBADF : constant := 9; -- Bad file descriptor
+ ECONNABORTED : constant := 231; -- Connection aborted
+ ECONNREFUSED : constant := 239; -- Connection refused
+ ECONNRESET : constant := 232; -- Connection reset by peer
+ EDESTADDRREQ : constant := 217; -- Destination addr required
+ EFAULT : constant := 14; -- Bad address
+ EHOSTDOWN : constant := 241; -- Host is down
+ EHOSTUNREACH : constant := 242; -- No route to host
+ EINPROGRESS : constant := 245; -- Operation now in progress
+ EINTR : constant := 4; -- Interrupted system call
+ EINVAL : constant := 22; -- Invalid argument
+ EIO : constant := 5; -- Input output error
+ EISCONN : constant := 234; -- Socket already connected
+ ELOOP : constant := 249; -- Too many symbolic lynks
+ EMFILE : constant := 24; -- Too many open files
+ EMSGSIZE : constant := 218; -- Message too long
+ ENAMETOOLONG : constant := 248; -- Name too long
+ ENETDOWN : constant := 228; -- Network is down
+ ENETRESET : constant := 230; -- Disconn. on network reset
+ ENETUNREACH : constant := 229; -- Network is unreachable
+ ENOBUFS : constant := 233; -- No buffer space available
+ ENOPROTOOPT : constant := 220; -- Protocol not available
+ ENOTCONN : constant := 235; -- Socket not connected
+ ENOTSOCK : constant := 216; -- Operation on non socket
+ EOPNOTSUPP : constant := 223; -- Operation not supported
+ EPFNOSUPPORT : constant := 224; -- Unknown protocol family
+ EPROTONOSUPPORT : constant := 221; -- Unknown protocol
+ EPROTOTYPE : constant := 219; -- Unknown protocol type
+ ESHUTDOWN : constant := 236; -- Cannot send once shutdown
+ ESOCKTNOSUPPORT : constant := 222; -- Socket type not supported
+ ETIMEDOUT : constant := 238; -- Connection timed out
+ ETOOMANYREFS : constant := 237; -- Too many references
+ EWOULDBLOCK : constant := 246; -- Operation would block
+
+ -----------------
+ -- Host errors --
+ -----------------
+
+ HOST_NOT_FOUND : constant := 1; -- Unknown host
+ TRY_AGAIN : constant := 2; -- Host name lookup failure
+ NO_DATA : constant := 4; -- No data record for name
+ NO_RECOVERY : constant := 3; -- Non recoverable errors
+
+ -------------------
+ -- Control flags --
+ -------------------
+
+ FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
+ FIONREAD : constant := 1074030207; -- How many bytes to read
+
+ --------------------
+ -- Shutdown modes --
+ --------------------
+
+ SHUT_RD : constant := 0; -- No more recv
+ SHUT_WR : constant := 1; -- No more send
+ SHUT_RDWR : constant := 2; -- No more recv/send
+
+ ---------------------
+ -- Protocol levels --
+ ---------------------
+
+ SOL_SOCKET : constant := 65535; -- Options for socket level
+ IPPROTO_IP : constant := 0; -- Dummy protocol for IP
+ IPPROTO_UDP : constant := 17; -- UDP
+ IPPROTO_TCP : constant := 6; -- TCP
+
+ -------------------
+ -- Request flags --
+ -------------------
+
+ MSG_OOB : constant := 1; -- Process out-of-band data
+ MSG_PEEK : constant := 2; -- Peek at incoming data
+ MSG_EOR : constant := 8; -- Send end of record
+ MSG_WAITALL : constant := 64; -- Wait for full reception
+ MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send
+ MSG_Forced_Flags : constant := 0;
+ -- Flags set on all send(2) calls
+
+ --------------------
+ -- Socket options --
+ --------------------
+
+ TCP_NODELAY : constant := 1; -- Do not coalesce packets
+ SO_REUSEADDR : constant := 4; -- Bind reuse local address
+ SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
+ SO_LINGER : constant := 128; -- Defer close to flush data
+ SO_BROADCAST : constant := 32; -- Can send broadcast msgs
+ SO_SNDBUF : constant := 4097; -- Set/get send buffer size
+ SO_RCVBUF : constant := 4098; -- Set/get recv buffer size
+ SO_SNDTIMEO : constant := 4101; -- Emission timeout
+ SO_RCVTIMEO : constant := 4102; -- Reception timeout
+ SO_ERROR : constant := 4103; -- Get/clear error status
+ IP_MULTICAST_IF : constant := 2; -- Set/get mcast interface
+ IP_MULTICAST_TTL : constant := 3; -- Set/get multicast TTL
+ IP_MULTICAST_LOOP : constant := 4; -- Set/get mcast loopback
+ IP_ADD_MEMBERSHIP : constant := 5; -- Join a multicast group
+ IP_DROP_MEMBERSHIP : constant := 6; -- Leave a multicast group
+
+ -------------------
+ -- System limits --
+ -------------------
+
+ IOV_MAX : constant := 16; -- Maximum writev iovcnt
+
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 8; -- tv_sec
+ SIZEOF_tv_usec : constant := 8; -- tv_usec
+
+end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-hpux.ads b/gcc/ada/g-soccon-hpux.ads
index 9145146da38..0b6012e0ee6 100644
--- a/gcc/ada/g-soccon-hpux.ads
+++ b/gcc/ada/g-soccon-hpux.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, 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- --
@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 16; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-irix.ads b/gcc/ada/g-soccon-irix.ads
index b07191f102c..3fd365c3470 100644
--- a/gcc/ada/g-soccon-irix.ads
+++ b/gcc/ada/g-soccon-irix.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, 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- --
@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-linux-64.ads b/gcc/ada/g-soccon-linux-64.ads
new file mode 100644
index 00000000000..fc8c507b3a7
--- /dev/null
+++ b/gcc/ada/g-soccon-linux-64.ads
@@ -0,0 +1,181 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . C O N S T A N T S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2000-2005, 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- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides target dependent definitions of constant for use
+-- 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 ia64-hp-linux-gnu
+-- 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.
+
+package GNAT.Sockets.Constants is
+
+ --------------
+ -- Families --
+ --------------
+
+ AF_INET : constant := 2; -- IPv4 address family
+ AF_INET6 : constant := 10; -- IPv6 address family
+
+ -----------
+ -- Modes --
+ -----------
+
+ SOCK_STREAM : constant := 1; -- Stream socket
+ SOCK_DGRAM : constant := 2; -- Datagram socket
+
+ -------------------
+ -- Socket errors --
+ -------------------
+
+ EACCES : constant := 13; -- Permission denied
+ EADDRINUSE : constant := 98; -- Address already in use
+ EADDRNOTAVAIL : constant := 99; -- Cannot assign address
+ EAFNOSUPPORT : constant := 97; -- Addr family not supported
+ EALREADY : constant := 114; -- Operation in progress
+ EBADF : constant := 9; -- Bad file descriptor
+ ECONNABORTED : constant := 103; -- Connection aborted
+ ECONNREFUSED : constant := 111; -- Connection refused
+ ECONNRESET : constant := 104; -- Connection reset by peer
+ EDESTADDRREQ : constant := 89; -- Destination addr required
+ EFAULT : constant := 14; -- Bad address
+ EHOSTDOWN : constant := 112; -- Host is down
+ EHOSTUNREACH : constant := 113; -- No route to host
+ EINPROGRESS : constant := 115; -- Operation now in progress
+ EINTR : constant := 4; -- Interrupted system call
+ EINVAL : constant := 22; -- Invalid argument
+ EIO : constant := 5; -- Input output error
+ EISCONN : constant := 106; -- Socket already connected
+ ELOOP : constant := 40; -- Too many symbolic lynks
+ EMFILE : constant := 24; -- Too many open files
+ EMSGSIZE : constant := 90; -- Message too long
+ ENAMETOOLONG : constant := 36; -- Name too long
+ ENETDOWN : constant := 100; -- Network is down
+ ENETRESET : constant := 102; -- Disconn. on network reset
+ ENETUNREACH : constant := 101; -- Network is unreachable
+ ENOBUFS : constant := 105; -- No buffer space available
+ ENOPROTOOPT : constant := 92; -- Protocol not available
+ ENOTCONN : constant := 107; -- Socket not connected
+ ENOTSOCK : constant := 88; -- Operation on non socket
+ EOPNOTSUPP : constant := 95; -- Operation not supported
+ EPFNOSUPPORT : constant := 96; -- Unknown protocol family
+ EPROTONOSUPPORT : constant := 93; -- Unknown protocol
+ EPROTOTYPE : constant := 91; -- Unknown protocol type
+ ESHUTDOWN : constant := 108; -- Cannot send once shutdown
+ ESOCKTNOSUPPORT : constant := 94; -- Socket type not supported
+ ETIMEDOUT : constant := 110; -- Connection timed out
+ ETOOMANYREFS : constant := 109; -- Too many references
+ EWOULDBLOCK : constant := 11; -- Operation would block
+
+ -----------------
+ -- Host errors --
+ -----------------
+
+ HOST_NOT_FOUND : constant := 1; -- Unknown host
+ TRY_AGAIN : constant := 2; -- Host name lookup failure
+ NO_DATA : constant := 4; -- No data record for name
+ NO_RECOVERY : constant := 3; -- Non recoverable errors
+
+ -------------------
+ -- Control flags --
+ -------------------
+
+ FIONBIO : constant := 21537; -- Set/clear non-blocking io
+ FIONREAD : constant := 21531; -- How many bytes to read
+
+ --------------------
+ -- Shutdown modes --
+ --------------------
+
+ SHUT_RD : constant := 0; -- No more recv
+ SHUT_WR : constant := 1; -- No more send
+ SHUT_RDWR : constant := 2; -- No more recv/send
+
+ ---------------------
+ -- Protocol levels --
+ ---------------------
+
+ SOL_SOCKET : constant := 1; -- Options for socket level
+ IPPROTO_IP : constant := 0; -- Dummy protocol for IP
+ IPPROTO_UDP : constant := 17; -- UDP
+ IPPROTO_TCP : constant := 6; -- TCP
+
+ -------------------
+ -- Request flags --
+ -------------------
+
+ MSG_OOB : constant := 1; -- Process out-of-band data
+ MSG_PEEK : constant := 2; -- Peek at incoming data
+ MSG_EOR : constant := 128; -- Send end of record
+ MSG_WAITALL : constant := 256; -- Wait for full reception
+ MSG_NOSIGNAL : constant := 16384; -- No SIGPIPE on send
+ MSG_Forced_Flags : constant := MSG_NOSIGNAL;
+ -- Flags set on all send(2) calls
+
+ --------------------
+ -- Socket options --
+ --------------------
+
+ TCP_NODELAY : constant := 1; -- Do not coalesce packets
+ SO_REUSEADDR : constant := 2; -- Bind reuse local address
+ SO_KEEPALIVE : constant := 9; -- Enable keep-alive msgs
+ SO_LINGER : constant := 13; -- Defer close to flush data
+ SO_BROADCAST : constant := 6; -- Can send broadcast msgs
+ SO_SNDBUF : constant := 7; -- Set/get send buffer size
+ SO_RCVBUF : constant := 8; -- Set/get recv buffer size
+ SO_SNDTIMEO : constant := 21; -- Emission timeout
+ SO_RCVTIMEO : constant := 20; -- Reception timeout
+ SO_ERROR : constant := 4; -- Get/clear error status
+ IP_MULTICAST_IF : constant := 32; -- Set/get mcast interface
+ IP_MULTICAST_TTL : constant := 33; -- Set/get multicast TTL
+ IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback
+ IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group
+ IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group
+
+ -------------------
+ -- System limits --
+ -------------------
+
+ IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 8; -- tv_sec
+ SIZEOF_tv_usec : constant := 8; -- tv_usec
+
+end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-linux-ppc.ads b/gcc/ada/g-soccon-linux-ppc.ads
new file mode 100644
index 00000000000..185a8da4d24
--- /dev/null
+++ b/gcc/ada/g-soccon-linux-ppc.ads
@@ -0,0 +1,181 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . C O N S T A N T S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2000-2005, 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- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides target dependent definitions of constant for use
+-- 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-linux
+-- 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.
+
+package GNAT.Sockets.Constants is
+
+ --------------
+ -- Families --
+ --------------
+
+ AF_INET : constant := 2; -- IPv4 address family
+ AF_INET6 : constant := 10; -- IPv6 address family
+
+ -----------
+ -- Modes --
+ -----------
+
+ SOCK_STREAM : constant := 1; -- Stream socket
+ SOCK_DGRAM : constant := 2; -- Datagram socket
+
+ -------------------
+ -- Socket errors --
+ -------------------
+
+ EACCES : constant := 13; -- Permission denied
+ EADDRINUSE : constant := 98; -- Address already in use
+ EADDRNOTAVAIL : constant := 99; -- Cannot assign address
+ EAFNOSUPPORT : constant := 97; -- Addr family not supported
+ EALREADY : constant := 114; -- Operation in progress
+ EBADF : constant := 9; -- Bad file descriptor
+ ECONNABORTED : constant := 103; -- Connection aborted
+ ECONNREFUSED : constant := 111; -- Connection refused
+ ECONNRESET : constant := 104; -- Connection reset by peer
+ EDESTADDRREQ : constant := 89; -- Destination addr required
+ EFAULT : constant := 14; -- Bad address
+ EHOSTDOWN : constant := 112; -- Host is down
+ EHOSTUNREACH : constant := 113; -- No route to host
+ EINPROGRESS : constant := 115; -- Operation now in progress
+ EINTR : constant := 4; -- Interrupted system call
+ EINVAL : constant := 22; -- Invalid argument
+ EIO : constant := 5; -- Input output error
+ EISCONN : constant := 106; -- Socket already connected
+ ELOOP : constant := 40; -- Too many symbolic lynks
+ EMFILE : constant := 24; -- Too many open files
+ EMSGSIZE : constant := 90; -- Message too long
+ ENAMETOOLONG : constant := 36; -- Name too long
+ ENETDOWN : constant := 100; -- Network is down
+ ENETRESET : constant := 102; -- Disconn. on network reset
+ ENETUNREACH : constant := 101; -- Network is unreachable
+ ENOBUFS : constant := 105; -- No buffer space available
+ ENOPROTOOPT : constant := 92; -- Protocol not available
+ ENOTCONN : constant := 107; -- Socket not connected
+ ENOTSOCK : constant := 88; -- Operation on non socket
+ EOPNOTSUPP : constant := 95; -- Operation not supported
+ EPFNOSUPPORT : constant := 96; -- Unknown protocol family
+ EPROTONOSUPPORT : constant := 93; -- Unknown protocol
+ EPROTOTYPE : constant := 91; -- Unknown protocol type
+ ESHUTDOWN : constant := 108; -- Cannot send once shutdown
+ ESOCKTNOSUPPORT : constant := 94; -- Socket type not supported
+ ETIMEDOUT : constant := 110; -- Connection timed out
+ ETOOMANYREFS : constant := 109; -- Too many references
+ EWOULDBLOCK : constant := 11; -- Operation would block
+
+ -----------------
+ -- Host errors --
+ -----------------
+
+ HOST_NOT_FOUND : constant := 1; -- Unknown host
+ TRY_AGAIN : constant := 2; -- Host name lookup failure
+ NO_DATA : constant := 4; -- No data record for name
+ NO_RECOVERY : constant := 3; -- Non recoverable errors
+
+ -------------------
+ -- Control flags --
+ -------------------
+
+ FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
+ FIONREAD : constant := 1074030207; -- How many bytes to read
+
+ --------------------
+ -- Shutdown modes --
+ --------------------
+
+ SHUT_RD : constant := 0; -- No more recv
+ SHUT_WR : constant := 1; -- No more send
+ SHUT_RDWR : constant := 2; -- No more recv/send
+
+ ---------------------
+ -- Protocol levels --
+ ---------------------
+
+ SOL_SOCKET : constant := 1; -- Options for socket level
+ IPPROTO_IP : constant := 0; -- Dummy protocol for IP
+ IPPROTO_UDP : constant := 17; -- UDP
+ IPPROTO_TCP : constant := 6; -- TCP
+
+ -------------------
+ -- Request flags --
+ -------------------
+
+ MSG_OOB : constant := 1; -- Process out-of-band data
+ MSG_PEEK : constant := 2; -- Peek at incoming data
+ MSG_EOR : constant := 128; -- Send end of record
+ MSG_WAITALL : constant := 256; -- Wait for full reception
+ MSG_NOSIGNAL : constant := 16384; -- No SIGPIPE on send
+ MSG_Forced_Flags : constant := MSG_NOSIGNAL;
+ -- Flags set on all send(2) calls
+
+ --------------------
+ -- Socket options --
+ --------------------
+
+ TCP_NODELAY : constant := 1; -- Do not coalesce packets
+ SO_REUSEADDR : constant := 2; -- Bind reuse local address
+ SO_KEEPALIVE : constant := 9; -- Enable keep-alive msgs
+ SO_LINGER : constant := 13; -- Defer close to flush data
+ SO_BROADCAST : constant := 6; -- Can send broadcast msgs
+ SO_SNDBUF : constant := 7; -- Set/get send buffer size
+ SO_RCVBUF : constant := 8; -- Set/get recv buffer size
+ SO_SNDTIMEO : constant := 19; -- Emission timeout
+ SO_RCVTIMEO : constant := 18; -- Reception timeout
+ SO_ERROR : constant := 4; -- Get/clear error status
+ IP_MULTICAST_IF : constant := 32; -- Set/get mcast interface
+ IP_MULTICAST_TTL : constant := 33; -- Set/get multicast TTL
+ IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback
+ IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group
+ IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group
+
+ -------------------
+ -- System limits --
+ -------------------
+
+ IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
+end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-linux-x86.ads b/gcc/ada/g-soccon-linux-x86.ads
new file mode 100644
index 00000000000..6b0521fcc04
--- /dev/null
+++ b/gcc/ada/g-soccon-linux-x86.ads
@@ -0,0 +1,181 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . C O N S T A N T S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2000-2005, 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- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides target dependent definitions of constant for use
+-- 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 i686-pc-linux-gnu
+-- 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.
+
+package GNAT.Sockets.Constants is
+
+ --------------
+ -- Families --
+ --------------
+
+ AF_INET : constant := 2; -- IPv4 address family
+ AF_INET6 : constant := 10; -- IPv6 address family
+
+ -----------
+ -- Modes --
+ -----------
+
+ SOCK_STREAM : constant := 1; -- Stream socket
+ SOCK_DGRAM : constant := 2; -- Datagram socket
+
+ -------------------
+ -- Socket errors --
+ -------------------
+
+ EACCES : constant := 13; -- Permission denied
+ EADDRINUSE : constant := 98; -- Address already in use
+ EADDRNOTAVAIL : constant := 99; -- Cannot assign address
+ EAFNOSUPPORT : constant := 97; -- Addr family not supported
+ EALREADY : constant := 114; -- Operation in progress
+ EBADF : constant := 9; -- Bad file descriptor
+ ECONNABORTED : constant := 103; -- Connection aborted
+ ECONNREFUSED : constant := 111; -- Connection refused
+ ECONNRESET : constant := 104; -- Connection reset by peer
+ EDESTADDRREQ : constant := 89; -- Destination addr required
+ EFAULT : constant := 14; -- Bad address
+ EHOSTDOWN : constant := 112; -- Host is down
+ EHOSTUNREACH : constant := 113; -- No route to host
+ EINPROGRESS : constant := 115; -- Operation now in progress
+ EINTR : constant := 4; -- Interrupted system call
+ EINVAL : constant := 22; -- Invalid argument
+ EIO : constant := 5; -- Input output error
+ EISCONN : constant := 106; -- Socket already connected
+ ELOOP : constant := 40; -- Too many symbolic lynks
+ EMFILE : constant := 24; -- Too many open files
+ EMSGSIZE : constant := 90; -- Message too long
+ ENAMETOOLONG : constant := 36; -- Name too long
+ ENETDOWN : constant := 100; -- Network is down
+ ENETRESET : constant := 102; -- Disconn. on network reset
+ ENETUNREACH : constant := 101; -- Network is unreachable
+ ENOBUFS : constant := 105; -- No buffer space available
+ ENOPROTOOPT : constant := 92; -- Protocol not available
+ ENOTCONN : constant := 107; -- Socket not connected
+ ENOTSOCK : constant := 88; -- Operation on non socket
+ EOPNOTSUPP : constant := 95; -- Operation not supported
+ EPFNOSUPPORT : constant := 96; -- Unknown protocol family
+ EPROTONOSUPPORT : constant := 93; -- Unknown protocol
+ EPROTOTYPE : constant := 91; -- Unknown protocol type
+ ESHUTDOWN : constant := 108; -- Cannot send once shutdown
+ ESOCKTNOSUPPORT : constant := 94; -- Socket type not supported
+ ETIMEDOUT : constant := 110; -- Connection timed out
+ ETOOMANYREFS : constant := 109; -- Too many references
+ EWOULDBLOCK : constant := 11; -- Operation would block
+
+ -----------------
+ -- Host errors --
+ -----------------
+
+ HOST_NOT_FOUND : constant := 1; -- Unknown host
+ TRY_AGAIN : constant := 2; -- Host name lookup failure
+ NO_DATA : constant := 4; -- No data record for name
+ NO_RECOVERY : constant := 3; -- Non recoverable errors
+
+ -------------------
+ -- Control flags --
+ -------------------
+
+ FIONBIO : constant := 21537; -- Set/clear non-blocking io
+ FIONREAD : constant := 21531; -- How many bytes to read
+
+ --------------------
+ -- Shutdown modes --
+ --------------------
+
+ SHUT_RD : constant := 0; -- No more recv
+ SHUT_WR : constant := 1; -- No more send
+ SHUT_RDWR : constant := 2; -- No more recv/send
+
+ ---------------------
+ -- Protocol levels --
+ ---------------------
+
+ SOL_SOCKET : constant := 1; -- Options for socket level
+ IPPROTO_IP : constant := 0; -- Dummy protocol for IP
+ IPPROTO_UDP : constant := 17; -- UDP
+ IPPROTO_TCP : constant := 6; -- TCP
+
+ -------------------
+ -- Request flags --
+ -------------------
+
+ MSG_OOB : constant := 1; -- Process out-of-band data
+ MSG_PEEK : constant := 2; -- Peek at incoming data
+ MSG_EOR : constant := 128; -- Send end of record
+ MSG_WAITALL : constant := 256; -- Wait for full reception
+ MSG_NOSIGNAL : constant := 16384; -- No SIGPIPE on send
+ MSG_Forced_Flags : constant := MSG_NOSIGNAL;
+ -- Flags set on all send(2) calls
+
+ --------------------
+ -- Socket options --
+ --------------------
+
+ TCP_NODELAY : constant := 1; -- Do not coalesce packets
+ SO_REUSEADDR : constant := 2; -- Bind reuse local address
+ SO_KEEPALIVE : constant := 9; -- Enable keep-alive msgs
+ SO_LINGER : constant := 13; -- Defer close to flush data
+ SO_BROADCAST : constant := 6; -- Can send broadcast msgs
+ SO_SNDBUF : constant := 7; -- Set/get send buffer size
+ SO_RCVBUF : constant := 8; -- Set/get recv buffer size
+ SO_SNDTIMEO : constant := 21; -- Emission timeout
+ SO_RCVTIMEO : constant := 20; -- Reception timeout
+ SO_ERROR : constant := 4; -- Get/clear error status
+ IP_MULTICAST_IF : constant := 32; -- Set/get mcast interface
+ IP_MULTICAST_TTL : constant := 33; -- Set/get multicast TTL
+ IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback
+ IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group
+ IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group
+
+ -------------------
+ -- System limits --
+ -------------------
+
+ IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
+end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-mingw.ads b/gcc/ada/g-soccon-mingw.ads
index 3577c17c596..f0c25c392b5 100644
--- a/gcc/ada/g-soccon-mingw.ads
+++ b/gcc/ada/g-soccon-mingw.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, 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- --
@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-solaris-64.ads b/gcc/ada/g-soccon-solaris-64.ads
new file mode 100644
index 00000000000..be1fc4ffea3
--- /dev/null
+++ b/gcc/ada/g-soccon-solaris-64.ads
@@ -0,0 +1,181 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . C O N S T A N T S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2000-2005, 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- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides target dependent definitions of constant for use
+-- 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 sparc-sun-solaris2.8/64
+-- 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.
+
+package GNAT.Sockets.Constants is
+
+ --------------
+ -- Families --
+ --------------
+
+ AF_INET : constant := 2; -- IPv4 address family
+ AF_INET6 : constant := 26; -- IPv6 address family
+
+ -----------
+ -- Modes --
+ -----------
+
+ SOCK_STREAM : constant := 2; -- Stream socket
+ SOCK_DGRAM : constant := 1; -- Datagram socket
+
+ -------------------
+ -- Socket errors --
+ -------------------
+
+ EACCES : constant := 13; -- Permission denied
+ EADDRINUSE : constant := 125; -- Address already in use
+ EADDRNOTAVAIL : constant := 126; -- Cannot assign address
+ EAFNOSUPPORT : constant := 124; -- Addr family not supported
+ EALREADY : constant := 149; -- Operation in progress
+ EBADF : constant := 9; -- Bad file descriptor
+ ECONNABORTED : constant := 130; -- Connection aborted
+ ECONNREFUSED : constant := 146; -- Connection refused
+ ECONNRESET : constant := 131; -- Connection reset by peer
+ EDESTADDRREQ : constant := 96; -- Destination addr required
+ EFAULT : constant := 14; -- Bad address
+ EHOSTDOWN : constant := 147; -- Host is down
+ EHOSTUNREACH : constant := 148; -- No route to host
+ EINPROGRESS : constant := 150; -- Operation now in progress
+ EINTR : constant := 4; -- Interrupted system call
+ EINVAL : constant := 22; -- Invalid argument
+ EIO : constant := 5; -- Input output error
+ EISCONN : constant := 133; -- Socket already connected
+ ELOOP : constant := 90; -- Too many symbolic lynks
+ EMFILE : constant := 24; -- Too many open files
+ EMSGSIZE : constant := 97; -- Message too long
+ ENAMETOOLONG : constant := 78; -- Name too long
+ ENETDOWN : constant := 127; -- Network is down
+ ENETRESET : constant := 129; -- Disconn. on network reset
+ ENETUNREACH : constant := 128; -- Network is unreachable
+ ENOBUFS : constant := 132; -- No buffer space available
+ ENOPROTOOPT : constant := 99; -- Protocol not available
+ ENOTCONN : constant := 134; -- Socket not connected
+ ENOTSOCK : constant := 95; -- Operation on non socket
+ EOPNOTSUPP : constant := 122; -- Operation not supported
+ EPFNOSUPPORT : constant := 123; -- Unknown protocol family
+ EPROTONOSUPPORT : constant := 120; -- Unknown protocol
+ EPROTOTYPE : constant := 98; -- Unknown protocol type
+ ESHUTDOWN : constant := 143; -- Cannot send once shutdown
+ ESOCKTNOSUPPORT : constant := 121; -- Socket type not supported
+ ETIMEDOUT : constant := 145; -- Connection timed out
+ ETOOMANYREFS : constant := 144; -- Too many references
+ EWOULDBLOCK : constant := 11; -- Operation would block
+
+ -----------------
+ -- Host errors --
+ -----------------
+
+ HOST_NOT_FOUND : constant := 1; -- Unknown host
+ TRY_AGAIN : constant := 2; -- Host name lookup failure
+ NO_DATA : constant := 4; -- No data record for name
+ NO_RECOVERY : constant := 3; -- Non recoverable errors
+
+ -------------------
+ -- Control flags --
+ -------------------
+
+ FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
+ FIONREAD : constant := 1074030207; -- How many bytes to read
+
+ --------------------
+ -- Shutdown modes --
+ --------------------
+
+ SHUT_RD : constant := 0; -- No more recv
+ SHUT_WR : constant := 1; -- No more send
+ SHUT_RDWR : constant := 2; -- No more recv/send
+
+ ---------------------
+ -- Protocol levels --
+ ---------------------
+
+ SOL_SOCKET : constant := 65535; -- Options for socket level
+ IPPROTO_IP : constant := 0; -- Dummy protocol for IP
+ IPPROTO_UDP : constant := 17; -- UDP
+ IPPROTO_TCP : constant := 6; -- TCP
+
+ -------------------
+ -- Request flags --
+ -------------------
+
+ MSG_OOB : constant := 1; -- Process out-of-band data
+ MSG_PEEK : constant := 2; -- Peek at incoming data
+ MSG_EOR : constant := 8; -- Send end of record
+ MSG_WAITALL : constant := 64; -- Wait for full reception
+ MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send
+ MSG_Forced_Flags : constant := 0;
+ -- Flags set on all send(2) calls
+
+ --------------------
+ -- Socket options --
+ --------------------
+
+ TCP_NODELAY : constant := 1; -- Do not coalesce packets
+ SO_REUSEADDR : constant := 4; -- Bind reuse local address
+ SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
+ SO_LINGER : constant := 128; -- Defer close to flush data
+ SO_BROADCAST : constant := 32; -- Can send broadcast msgs
+ SO_SNDBUF : constant := 4097; -- Set/get send buffer size
+ SO_RCVBUF : constant := 4098; -- Set/get recv buffer size
+ SO_SNDTIMEO : constant := 4101; -- Emission timeout
+ SO_RCVTIMEO : constant := 4102; -- Reception timeout
+ SO_ERROR : constant := 4103; -- Get/clear error status
+ IP_MULTICAST_IF : constant := 16; -- Set/get mcast interface
+ IP_MULTICAST_TTL : constant := 17; -- Set/get multicast TTL
+ IP_MULTICAST_LOOP : constant := 18; -- Set/get mcast loopback
+ IP_ADD_MEMBERSHIP : constant := 19; -- Join a multicast group
+ IP_DROP_MEMBERSHIP : constant := 20; -- Leave a multicast group
+
+ -------------------
+ -- System limits --
+ -------------------
+
+ IOV_MAX : constant := 16; -- Maximum writev iovcnt
+
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 8; -- tv_sec
+ SIZEOF_tv_usec : constant := 8; -- tv_usec
+
+end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-solaris.ads b/gcc/ada/g-soccon-solaris.ads
index 07de5cdbc29..7204e975c51 100644
--- a/gcc/ada/g-soccon-solaris.ads
+++ b/gcc/ada/g-soccon-solaris.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, 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- --
@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 16; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-tru64.ads b/gcc/ada/g-soccon-tru64.ads
index be7578f3521..b6d6836452d 100644
--- a/gcc/ada/g-soccon-tru64.ads
+++ b/gcc/ada/g-soccon-tru64.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, 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- --
@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 1024; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-vms.ads b/gcc/ada/g-soccon-vms.ads
index 3b0f20fe61c..85996efa3cd 100644
--- a/gcc/ada/g-soccon-vms.ads
+++ b/gcc/ada/g-soccon-vms.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, 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- --
@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 1024; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-vxworks.ads b/gcc/ada/g-soccon-vxworks.ads
index d31337f675c..1accc7cc812 100644
--- a/gcc/ada/g-soccon-vxworks.ads
+++ b/gcc/ada/g-soccon-vxworks.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, 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- --
@@ -169,4 +169,23 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
+ --------------------------------
+ -- VxWorks-specific constants --
+ --------------------------------
+
+ -- These constants may be used only within the VxWorks version of
+ -- GNAT.Sockets.Thin.
+
+ OK : constant := 0; -- VxWorks generic success
+ ERROR : constant := -1; -- VxWorks generic error
+
end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon.ads b/gcc/ada/g-soccon.ads
index 202f442ec30..5fa72f5f27f 100644
--- a/gcc/ada/g-soccon.ads
+++ b/gcc/ada/g-soccon.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, 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- --
@@ -36,6 +36,9 @@
-- directly with'ed by an applications program.
-- This is the version for i686-pc-linux-gnu
+-- WARNING! This file is a default version that must be replaced for
+-- each platform.
+
-- 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.
@@ -169,4 +172,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-socket.adb b/gcc/ada/g-socket.adb
index a7af20b87d2..163dd2d0710 100644
--- a/gcc/ada/g-socket.adb
+++ b/gcc/ada/g-socket.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- 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- --
@@ -92,8 +92,11 @@ package body GNAT.Sockets is
No_Delay => Constants.TCP_NODELAY,
Add_Membership => Constants.IP_ADD_MEMBERSHIP,
Drop_Membership => Constants.IP_DROP_MEMBERSHIP,
+ Multicast_If => Constants.IP_MULTICAST_IF,
Multicast_TTL => Constants.IP_MULTICAST_TTL,
- Multicast_Loop => Constants.IP_MULTICAST_LOOP);
+ Multicast_Loop => Constants.IP_MULTICAST_LOOP,
+ Send_Timeout => Constants.SO_SNDTIMEO,
+ Receive_Timeout => Constants.SO_RCVTIMEO);
Flags : constant array (0 .. 3) of C.int :=
(0 => Constants.MSG_OOB, -- Process_Out_Of_Band_Data
@@ -110,6 +113,9 @@ package body GNAT.Sockets is
function To_In_Addr is new Ada.Unchecked_Conversion (C.int, In_Addr);
function To_Int is new Ada.Unchecked_Conversion (In_Addr, C.int);
+ function Err_Code_Image (E : Integer) return String;
+ -- Return the value of E surrounded with brackets
+
-----------------------
-- Local subprograms --
-----------------------
@@ -160,15 +166,20 @@ package body GNAT.Sockets is
function To_Service_Entry (E : Servent) return Service_Entry_Type;
-- Conversion function
- function To_Timeval (Val : Selector_Duration) return Timeval;
+ function To_Timeval (Val : Timeval_Duration) return Timeval;
-- Separate Val in seconds and microseconds
+ function To_Duration (Val : Timeval) return Timeval_Duration;
+ -- Reconstruct a Duration value from a Timeval record (seconds and
+ -- microseconds).
+
procedure Raise_Socket_Error (Error : Integer);
-- Raise Socket_Error with an exception message describing the error code
+ -- from errno.
- procedure Raise_Host_Error (Error : Integer);
+ procedure Raise_Host_Error (H_Error : Integer);
-- Raise Host_Error exception with message describing error code (note
- -- hstrerror seems to be obsolete).
+ -- hstrerror seems to be obsolete) from h_errno.
procedure Narrow (Item : in out Socket_Set_Type);
-- Update Last as it may be greater than the real last socket
@@ -384,6 +395,7 @@ package body GNAT.Sockets is
is
Res : C.int;
Last : C.int;
+ RSig : Socket_Type renames Selector.R_Sig_Socket;
RSet : Socket_Set_Type;
WSet : Socket_Set_Type;
ESet : Socket_Set_Type;
@@ -391,102 +403,116 @@ package body GNAT.Sockets is
TPtr : Timeval_Access;
begin
- Status := Completed;
+ begin
+ Status := Completed;
- -- No timeout or Forever is indicated by a null timeval pointer
+ -- No timeout or Forever is indicated by a null timeval pointer
- if Timeout = Forever then
- TPtr := null;
- else
- TVal := To_Timeval (Timeout);
- TPtr := TVal'Unchecked_Access;
- end if;
+ if Timeout = Forever then
+ TPtr := null;
+ else
+ TVal := To_Timeval (Timeout);
+ TPtr := TVal'Unchecked_Access;
+ end if;
- -- Copy R_Socket_Set in RSet and add read signalling socket
+ -- Copy R_Socket_Set in RSet and add read signalling socket
- RSet := (Set => New_Socket_Set (R_Socket_Set.Set),
- Last => R_Socket_Set.Last);
- Set (RSet, Selector.R_Sig_Socket);
+ RSet := (Set => New_Socket_Set (R_Socket_Set.Set),
+ Last => R_Socket_Set.Last);
+ Set (RSet, RSig);
- -- Copy W_Socket_Set in WSet
+ -- Copy W_Socket_Set in WSet
- WSet := (Set => New_Socket_Set (W_Socket_Set.Set),
- Last => W_Socket_Set.Last);
+ WSet := (Set => New_Socket_Set (W_Socket_Set.Set),
+ Last => W_Socket_Set.Last);
- -- Copy E_Socket_Set in ESet
+ -- Copy E_Socket_Set in ESet
- ESet := (Set => New_Socket_Set (E_Socket_Set.Set),
- Last => E_Socket_Set.Last);
+ ESet := (Set => New_Socket_Set (E_Socket_Set.Set),
+ Last => E_Socket_Set.Last);
- Last := C.int'Max (C.int'Max (C.int (RSet.Last),
- C.int (WSet.Last)),
- C.int (ESet.Last));
+ Last := C.int'Max (C.int'Max (C.int (RSet.Last),
+ C.int (WSet.Last)),
+ C.int (ESet.Last));
- Res :=
- C_Select
- (Last + 1,
- RSet.Set,
- WSet.Set,
- ESet.Set,
- TPtr);
+ Res :=
+ C_Select
+ (Last + 1,
+ RSet.Set,
+ WSet.Set,
+ ESet.Set,
+ TPtr);
- if Res = Failure then
- Raise_Socket_Error (Socket_Errno);
- end if;
+ if Res = Failure then
+ Raise_Socket_Error (Socket_Errno);
+ end if;
- -- If Select was resumed because of read signalling socket, read this
- -- data and remove socket from set.
+ -- If Select was resumed because of read signalling socket, read this
+ -- data and remove socket from set.
- if Is_Set (RSet, Selector.R_Sig_Socket) then
- Clear (RSet, Selector.R_Sig_Socket);
+ if Is_Set (RSet, RSig) then
+ Clear (RSet, RSig);
- declare
- Buf : Character;
+ declare
+ Buf : Character;
- begin
- Res := C_Recv (C.int (Selector.R_Sig_Socket), Buf'Address, 1, 0);
+ begin
+ Res := C_Recv (C.int (RSig), Buf'Address, 1, 0);
- if Res = Failure then
- Raise_Socket_Error (Socket_Errno);
- end if;
- end;
+ if Res = Failure then
+ Raise_Socket_Error (Socket_Errno);
+ end if;
+ end;
- Status := Aborted;
+ Status := Aborted;
- elsif Res = 0 then
- Status := Expired;
- end if;
+ elsif Res = 0 then
+ Status := Expired;
+ end if;
- -- Update RSet, WSet and ESet in regard to their new socket sets
+ -- Update RSet, WSet and ESet in regard to their new socket sets
- Narrow (RSet);
- Narrow (WSet);
- Narrow (ESet);
+ Narrow (RSet);
+ Narrow (WSet);
+ Narrow (ESet);
- -- Reset RSet as it should be if R_Sig_Socket was not added
+ -- Reset RSet as it should be if R_Sig_Socket was not added
- if Is_Empty (RSet) then
- Empty (RSet);
- end if;
+ if Is_Empty (RSet) then
+ Empty (RSet);
+ end if;
- if Is_Empty (WSet) then
- Empty (WSet);
- end if;
+ if Is_Empty (WSet) then
+ Empty (WSet);
+ end if;
- if Is_Empty (ESet) then
- Empty (ESet);
- end if;
+ if Is_Empty (ESet) then
+ Empty (ESet);
+ end if;
- -- Deliver RSet, WSet and ESet
+ -- Deliver RSet, WSet and ESet
- Empty (R_Socket_Set);
- R_Socket_Set := RSet;
+ Empty (R_Socket_Set);
+ R_Socket_Set := RSet;
- Empty (W_Socket_Set);
- W_Socket_Set := WSet;
+ Empty (W_Socket_Set);
+ W_Socket_Set := WSet;
- Empty (E_Socket_Set);
- E_Socket_Set := ESet;
+ Empty (E_Socket_Set);
+ E_Socket_Set := ESet;
+
+ exception
+
+ when Socket_Error =>
+
+ -- The local socket sets must be emptied before propagating
+ -- Socket_Error so the associated storage is freed.
+
+ Empty (RSet);
+ Empty (WSet);
+ Empty (ESet);
+ raise;
+ end;
end Check_Selector;
-----------
@@ -510,11 +536,16 @@ package body GNAT.Sockets is
-- Close_Selector --
--------------------
- -- Comments needed below ???
- -- Why are exceptions ignored ???
-
procedure Close_Selector (Selector : in out Selector_Type) is
begin
+
+ -- Close the signalling sockets used internally for the implementation
+ -- of Abort_Selector. Exceptions are ignored because these sockets
+ -- are implementation artefacts of no interest to the user, and
+ -- there is little that can be done if either Close_Socket call fails
+ -- (which theoretically should not happen anyway). We also want to try
+ -- to perform the second Close_Socket even if the first one failed.
+
begin
Close_Socket (Selector.R_Sig_Socket);
exception
@@ -772,6 +803,17 @@ package body GNAT.Sockets is
Item.Last := No_Socket;
end Empty;
+ --------------------
+ -- Err_Code_Image --
+ --------------------
+
+ function Err_Code_Image (E : Integer) return String is
+ Msg : String := E'Img & "] ";
+ begin
+ Msg (Msg'First) := '[';
+ return Msg;
+ end Err_Code_Image;
+
--------------
-- Finalize --
--------------
@@ -845,7 +887,7 @@ package body GNAT.Sockets is
Res := C_Gethostbyaddr (HA'Address, HA'Size / 8, Constants.AF_INET);
if Res = null then
- Err := Socket_Errno;
+ Err := Host_Errno;
Task_Lock.Unlock;
Raise_Host_Error (Err);
end if;
@@ -884,7 +926,7 @@ package body GNAT.Sockets is
Res := C_Gethostbyname (HN);
if Res = null then
- Err := Socket_Errno;
+ Err := Host_Errno;
Task_Lock.Unlock;
Raise_Host_Error (Err);
end if;
@@ -1027,6 +1069,7 @@ package body GNAT.Sockets is
V8 : aliased Two_Int;
V4 : aliased C.int;
V1 : aliased C.unsigned_char;
+ VT : aliased Timeval;
Len : aliased C.int;
Add : System.Address;
Res : C.int;
@@ -1045,10 +1088,16 @@ package body GNAT.Sockets is
No_Delay |
Send_Buffer |
Receive_Buffer |
+ Multicast_If |
Error =>
Len := V4'Size / 8;
Add := V4'Address;
+ when Send_Timeout |
+ Receive_Timeout =>
+ Len := VT'Size / 8;
+ Add := VT'Address;
+
when Linger |
Add_Membership |
Drop_Membership =>
@@ -1091,12 +1140,19 @@ package body GNAT.Sockets is
To_Inet_Addr (To_In_Addr (V8 (V8'First)), Opt.Multicast_Address);
To_Inet_Addr (To_In_Addr (V8 (V8'Last)), Opt.Local_Interface);
+ when Multicast_If =>
+ To_Inet_Addr (To_In_Addr (V4), Opt.Outgoing_If);
+
when Multicast_TTL =>
Opt.Time_To_Live := Integer (V1);
when Multicast_Loop =>
Opt.Enabled := (V1 /= 0);
+ when Send_Timeout |
+ Receive_Timeout =>
+ Opt.Timeout := To_Duration (VT);
+
end case;
return Opt;
@@ -1379,12 +1435,11 @@ package body GNAT.Sockets is
-- Raise_Host_Error --
----------------------
- procedure Raise_Host_Error (Error : Integer) is
+ procedure Raise_Host_Error (H_Error : Integer) is
function Host_Error_Message return String;
- -- We do not use a C function like strerror because hstrerror
- -- that would correspond seems to be obsolete. Return
- -- appropriate string for error value.
+ -- We do not use a C function like strerror because hstrerror that would
+ -- correspond is obsolete. Return appropriate string for error value.
------------------------
-- Host_Error_Message --
@@ -1392,7 +1447,7 @@ package body GNAT.Sockets is
function Host_Error_Message return String is
begin
- case Error is
+ case H_Error is
when Constants.HOST_NOT_FOUND => return "Host not found";
when Constants.TRY_AGAIN => return "Try again";
when Constants.NO_RECOVERY => return "No recovery";
@@ -1404,7 +1459,9 @@ package body GNAT.Sockets is
-- Start of processing for Raise_Host_Error
begin
- Ada.Exceptions.Raise_Exception (Host_Error'Identity, Host_Error_Message);
+ Ada.Exceptions.Raise_Exception (Host_Error'Identity,
+ Err_Code_Image (H_Error)
+ & Host_Error_Message);
end Raise_Host_Error;
------------------------
@@ -1413,26 +1470,10 @@ package body GNAT.Sockets is
procedure Raise_Socket_Error (Error : Integer) is
use type C.Strings.chars_ptr;
-
- function Image (E : Integer) return String;
-
- -----------
- -- Image --
- -----------
-
- function Image (E : Integer) return String is
- Msg : String := E'Img & "] ";
- begin
- Msg (Msg'First) := '[';
- return Msg;
- end Image;
-
- -- Start of processing for Raise_Socket_Error
-
begin
- Ada.Exceptions.Raise_Exception
- (Socket_Error'Identity,
- Image (Error) & C.Strings.Value (Socket_Error_Message (Error)));
+ Ada.Exceptions.Raise_Exception (Socket_Error'Identity,
+ Err_Code_Image (Error)
+ & C.Strings.Value (Socket_Error_Message (Error)));
end Raise_Socket_Error;
----------
@@ -1639,11 +1680,12 @@ package body GNAT.Sockets is
is
Id : constant Exception_Id := Exception_Identity (Occurrence);
Msg : constant String := Exception_Message (Occurrence);
- First : Natural := Msg'First;
+ First : Natural;
Last : Natural;
Val : Integer;
begin
+ First := Msg'First;
while First <= Msg'Last
and then Msg (First) not in '0' .. '9'
loop
@@ -1655,7 +1697,6 @@ package body GNAT.Sockets is
end if;
Last := First;
-
while Last < Msg'Last
and then Msg (Last + 1) in '0' .. '9'
loop
@@ -1854,7 +1895,8 @@ package body GNAT.Sockets is
V8 : aliased Two_Int;
V4 : aliased C.int;
V1 : aliased C.unsigned_char;
- Len : aliased C.int;
+ VT : aliased Timeval;
+ Len : C.int;
Add : System.Address := Null_Address;
Res : C.int;
@@ -1892,6 +1934,11 @@ package body GNAT.Sockets is
Len := V8'Size / 8;
Add := V8'Address;
+ when Multicast_If =>
+ V4 := To_Int (To_In_Addr (Option.Outgoing_If));
+ Len := V4'Size / 8;
+ Add := V4'Address;
+
when Multicast_TTL =>
V1 := C.unsigned_char (Option.Time_To_Live);
Len := V1'Size / 8;
@@ -1902,6 +1949,12 @@ package body GNAT.Sockets is
Len := V1'Size / 8;
Add := V1'Address;
+ when Send_Timeout |
+ Receive_Timeout =>
+ VT := To_Timeval (Option.Timeout);
+ Len := VT'Size / 8;
+ Add := VT'Address;
+
end case;
Res := C_Setsockopt
@@ -1999,6 +2052,15 @@ package body GNAT.Sockets is
return Integer (Socket);
end To_C;
+ -----------------
+ -- To_Duration --
+ -----------------
+
+ function To_Duration (Val : Timeval) return Timeval_Duration is
+ begin
+ return Natural (Val.Tv_Sec) * 1.0 + Natural (Val.Tv_Usec) * 1.0E-6;
+ end To_Duration;
+
-------------------
-- To_Host_Entry --
-------------------
@@ -2100,6 +2162,7 @@ package body GNAT.Sockets is
if Flags (J) = -1 then
Raise_Socket_Error (Constants.EOPNOTSUPP);
end if;
+
Result := Result + Flags (J);
end if;
@@ -2176,25 +2239,25 @@ package body GNAT.Sockets is
-- To_Timeval --
----------------
- function To_Timeval (Val : Selector_Duration) return Timeval is
- S : Timeval_Unit;
- MS : Timeval_Unit;
+ function To_Timeval (Val : Timeval_Duration) return Timeval is
+ S : time_t;
+ uS : suseconds_t;
begin
-- If zero, set result as zero (otherwise it gets rounded down to -1)
if Val = 0.0 then
S := 0;
- MS := 0;
+ uS := 0;
-- Normal case where we do round down
else
- S := Timeval_Unit (Val - 0.5);
- MS := Timeval_Unit (1_000_000 * (Val - Selector_Duration (S)));
+ S := time_t (Val - 0.5);
+ uS := suseconds_t (1_000_000 * (Val - Selector_Duration (S)));
end if;
- return (S, MS);
+ return (S, uS);
end To_Timeval;
-----------
diff --git a/gcc/ada/g-socket.ads b/gcc/ada/g-socket.ads
index 7529c050892..6268545a5fa 100644
--- a/gcc/ada/g-socket.ads
+++ b/gcc/ada/g-socket.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- 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- --
@@ -489,7 +489,7 @@ package GNAT.Sockets is
Host_Error : exception;
-- Exception raised by the two following procedures. Once raised, its
-- message contains a string describing the error code. This exception is
- -- raised when an host entry can not be retrieved.
+ -- raised when an host entry cannot be retrieved.
function Get_Host_By_Address
(Address : Inet_Addr_Type;
@@ -595,6 +595,16 @@ package GNAT.Sockets is
Unknown_Server_Error,
Cannot_Resolve_Error);
+ -- Timeval_Duration is a subtype of Standard.Duration because the full
+ -- range of Standard.Duration cannot be represented in the equivalent C
+ -- structure. Moreover, negative values are not allowed to avoid system
+ -- incompatibilities.
+
+ Immediate : constant := 0.0;
+ Forever : constant := Duration (Integer'Last) * 1.0;
+
+ subtype Timeval_Duration is Duration range Immediate .. Forever;
+
-- Get_Socket_Options and Set_Socket_Options manipulate options associated
-- with a socket. Options may exist at multiple protocol levels in the
-- communication stack. Socket_Level is the uppermost socket level.
@@ -610,18 +620,21 @@ package GNAT.Sockets is
-- a boolean to enable or disable this option.
type Option_Name is (
- Keep_Alive, -- Enable sending of keep-alive messages
- Reuse_Address, -- Allow bind to reuse local address
- Broadcast, -- Enable datagram sockets to recv/send broadcast packets
- Send_Buffer, -- Set/get the maximum socket send buffer in bytes
- Receive_Buffer, -- Set/get the maximum socket recv buffer in bytes
- Linger, -- Shutdown wait for msg to be sent or timeout occur
- Error, -- Get and clear the pending socket error
- No_Delay, -- Do not delay send to coalesce packets (TCP_NODELAY)
- Add_Membership, -- Join a multicast group
- Drop_Membership, -- Leave a multicast group
- Multicast_TTL, -- Indicate the time-to-live of sent multicast packets
- Multicast_Loop); -- Sent multicast packets are looped to the local socket
+ Keep_Alive, -- Enable sending of keep-alive messages
+ Reuse_Address, -- Allow bind to reuse local address
+ Broadcast, -- Enable datagram sockets to recv/send broadcasts
+ Send_Buffer, -- Set/get the maximum socket send buffer in bytes
+ Receive_Buffer, -- Set/get the maximum socket recv buffer in bytes
+ Linger, -- Shutdown wait for msg to be sent or timeout occur
+ Error, -- Get and clear the pending socket error
+ No_Delay, -- Do not delay send to coalesce packets (TCP_NODELAY)
+ Add_Membership, -- Join a multicast group
+ Drop_Membership, -- Leave a multicast group
+ Multicast_If, -- Set default outgoing interface for multicast packets
+ Multicast_TTL, -- Indicate the time-to-live of sent multicast packets
+ Multicast_Loop, -- Sent multicast packets are looped to local socket
+ Send_Timeout, -- Set timeout value for output
+ Receive_Timeout); -- Set timeout value for input
type Option_Type (Name : Option_Name := Keep_Alive) is record
case Name is
@@ -652,9 +665,16 @@ package GNAT.Sockets is
Multicast_Address : Inet_Addr_Type;
Local_Interface : Inet_Addr_Type;
+ when Multicast_If =>
+ Outgoing_If : Inet_Addr_Type;
+
when Multicast_TTL =>
Time_To_Live : Natural;
+ when Send_Timeout |
+ Receive_Timeout =>
+ Timeout : Timeval_Duration;
+
end case;
end record;
@@ -935,15 +955,7 @@ package GNAT.Sockets is
type Selector_Type is limited private;
type Selector_Access is access all Selector_Type;
- -- Selector_Duration is a subtype of Standard.Duration because the full
- -- range of Standard.Duration cannot be represented in the equivalent C
- -- structure. Moreover, negative values are not allowed to avoid system
- -- incompatibilities.
-
- Immediate : constant := 0.0;
- Forever : constant := Duration (Integer'Last) * 1.0;
-
- subtype Selector_Duration is Duration range Immediate .. Forever;
+ subtype Selector_Duration is Timeval_Duration;
procedure Create_Selector (Selector : out Selector_Type);
-- Create a new selector
diff --git a/gcc/ada/g-socthi-mingw.adb b/gcc/ada/g-socthi-mingw.adb
index e525cc839e3..862305dbd2e 100644
--- a/gcc/ada/g-socthi-mingw.adb
+++ b/gcc/ada/g-socthi-mingw.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005 AdaCore --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- 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- --
@@ -59,8 +59,7 @@ package body GNAT.Sockets.Thin is
function Standard_Connect
(S : C.int;
Name : System.Address;
- Namelen : C.int)
- return C.int;
+ Namelen : C.int) return C.int;
pragma Import (Stdcall, Standard_Connect, "connect");
function Standard_Select
@@ -68,8 +67,7 @@ package body GNAT.Sockets.Thin is
Readfds : Fd_Set_Access;
Writefds : Fd_Set_Access;
Exceptfds : Fd_Set_Access;
- Timeout : Timeval_Access)
- return C.int;
+ Timeout : Timeval_Access) return C.int;
pragma Import (Stdcall, Standard_Select, "select");
type Error_Type is
@@ -239,8 +237,7 @@ package body GNAT.Sockets.Thin is
function C_Connect
(S : C.int;
Name : System.Address;
- Namelen : C.int)
- return C.int
+ Namelen : C.int) return C.int
is
Res : C.int;
@@ -263,8 +260,7 @@ package body GNAT.Sockets.Thin is
function C_Readv
(Socket : C.int;
Iov : System.Address;
- Iovcnt : C.int)
- return C.int
+ Iovcnt : C.int) return C.int
is
Res : C.int;
Count : C.int := 0;
@@ -299,8 +295,7 @@ package body GNAT.Sockets.Thin is
Readfds : Fd_Set_Access;
Writefds : Fd_Set_Access;
Exceptfds : Fd_Set_Access;
- Timeout : Timeval_Access)
- return C.int
+ Timeout : Timeval_Access) return C.int
is
pragma Warnings (Off, Exceptfds);
@@ -441,8 +436,7 @@ package body GNAT.Sockets.Thin is
function C_Writev
(Socket : C.int;
Iov : System.Address;
- Iovcnt : C.int)
- return C.int
+ Iovcnt : C.int) return C.int
is
Res : C.int;
Count : C.int := 0;
@@ -553,11 +547,8 @@ package body GNAT.Sockets.Thin is
--------------------------
function Socket_Error_Message
- (Errno : Integer)
- return C.Strings.chars_ptr
+ (Errno : Integer) return C.Strings.chars_ptr
is
- use GNAT.Sockets.Constants;
-
begin
case Errno is
when EINTR => return Error_Messages (N_EINTR);
diff --git a/gcc/ada/g-socthi-mingw.ads b/gcc/ada/g-socthi-mingw.ads
index a73b0a7ce03..11509c095ea 100644
--- a/gcc/ada/g-socthi-mingw.ads
+++ b/gcc/ada/g-socthi-mingw.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005 AdaCore --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- 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- --
@@ -61,20 +61,32 @@ package GNAT.Sockets.Thin is
-- Set last socket error number
function Socket_Error_Message
- (Errno : Integer)
- return C.Strings.chars_ptr;
+ (Errno : Integer) return C.Strings.chars_ptr;
-- Returns the error message string for the error number Errno. If
-- Errno is not known it returns "Unknown system error".
+ function Host_Errno return Integer;
+ pragma Import (C, Host_Errno, "__gnat_get_h_errno");
+ -- Returns last host error number
+
subtype Fd_Set_Access is System.Address;
No_Fd_Set : constant Fd_Set_Access := System.Null_Address;
- type Timeval_Unit is new C.long;
- pragma Convention (C, Timeval_Unit);
+ type time_t is
+ range -(2 ** (8 * Constants.SIZEOF_tv_sec - 1))
+ .. 2 ** (8 * Constants.SIZEOF_tv_sec - 1) - 1;
+ for time_t'Size use 8 * Constants.SIZEOF_tv_sec;
+ pragma Convention (C, time_t);
+
+ type suseconds_t is
+ range -(2 ** (8 * Constants.SIZEOF_tv_usec - 1))
+ .. 2 ** (8 * Constants.SIZEOF_tv_usec - 1) - 1;
+ for suseconds_t'Size use 8 * Constants.SIZEOF_tv_usec;
+ pragma Convention (C, suseconds_t);
type Timeval is record
- Tv_Sec : Timeval_Unit;
- Tv_Usec : Timeval_Unit;
+ Tv_Sec : time_t;
+ Tv_Usec : suseconds_t;
end record;
pragma Convention (C, Timeval);
diff --git a/gcc/ada/g-socthi-vms.ads b/gcc/ada/g-socthi-vms.ads
index 6a19d2dc5f4..1b05e4719bc 100644
--- a/gcc/ada/g-socthi-vms.ads
+++ b/gcc/ada/g-socthi-vms.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2002-2005, AdaCore --
-- --
-- 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- --
@@ -64,15 +64,28 @@ package GNAT.Sockets.Thin is
-- Returns the error message string for the error number Errno. If
-- Errno is not known it returns "Unknown system error".
+ function Host_Errno return Integer;
+ pragma Import (C, Host_Errno, "__gnat_get_h_errno");
+ -- Returns last host error number
+
subtype Fd_Set_Access is System.Address;
No_Fd_Set : constant Fd_Set_Access := System.Null_Address;
- type Timeval_Unit is new C.int;
- pragma Convention (C, Timeval_Unit);
+ type time_t is
+ range -2 ** (8 * Constants.SIZEOF_tv_sec - 1)
+ .. 2 ** (8 * Constants.SIZEOF_tv_sec - 1) - 1;
+ for time_t'Size use 8 * Constants.SIZEOF_tv_sec;
+ pragma Convention (C, time_t);
+
+ type suseconds_t is
+ range -2 ** (8 * Constants.SIZEOF_tv_usec - 1)
+ .. 2 ** (8 * Constants.SIZEOF_tv_usec - 1) - 1;
+ for suseconds_t'Size use 8 * Constants.SIZEOF_tv_usec;
+ pragma Convention (C, suseconds_t);
type Timeval is record
- Tv_Sec : Timeval_Unit;
- Tv_Usec : Timeval_Unit;
+ Tv_Sec : time_t;
+ Tv_Usec : suseconds_t;
end record;
pragma Convention (C, Timeval);
@@ -197,94 +210,78 @@ package GNAT.Sockets.Thin is
function C_Accept
(S : C.int;
Addr : System.Address;
- Addrlen : access C.int)
- return C.int;
+ Addrlen : access C.int) return C.int;
function C_Bind
(S : C.int;
Name : System.Address;
- Namelen : C.int)
- return C.int;
+ Namelen : C.int) return C.int;
function C_Close
- (Fd : C.int)
- return C.int;
+ (Fd : C.int) return C.int;
function C_Connect
(S : C.int;
Name : System.Address;
- Namelen : C.int)
- return C.int;
+ Namelen : C.int) return C.int;
function C_Gethostbyaddr
(Addr : System.Address;
Len : C.int;
- Typ : C.int)
- return Hostent_Access;
+ Typ : C.int) return Hostent_Access;
function C_Gethostbyname
- (Name : C.char_array)
- return Hostent_Access;
+ (Name : C.char_array) return Hostent_Access;
function C_Gethostname
(Name : System.Address;
- Namelen : C.int)
- return C.int;
+ Namelen : C.int) return C.int;
function C_Getpeername
(S : C.int;
Name : System.Address;
- Namelen : access C.int)
- return C.int;
+ Namelen : access C.int) return C.int;
function C_Getservbyname
(Name : C.char_array;
- Proto : C.char_array)
- return Servent_Access;
+ Proto : C.char_array) return Servent_Access;
function C_Getservbyport
(Port : C.int;
- Proto : C.char_array)
- return Servent_Access;
+ Proto : C.char_array) return Servent_Access;
function C_Getsockname
(S : C.int;
Name : System.Address;
- Namelen : access C.int)
- return C.int;
+ Namelen : access C.int) return C.int;
function C_Getsockopt
(S : C.int;
Level : C.int;
Optname : C.int;
Optval : System.Address;
- Optlen : access C.int)
- return C.int;
+ Optlen : access C.int) return C.int;
function C_Inet_Addr
- (Cp : C.Strings.chars_ptr)
- return C.int;
+ (Cp : C.Strings.chars_ptr) return C.int;
function C_Ioctl
(S : C.int;
Req : C.int;
- Arg : Int_Access)
- return C.int;
+ Arg : Int_Access) return C.int;
function C_Listen (S, Backlog : C.int) return C.int;
function C_Readv
(Fd : C.int;
Iov : System.Address;
- Iovcnt : C.int)
- return C.int;
+ Iovcnt : C.int) return C.int;
function C_Recv
(S : C.int;
Msg : System.Address;
Len : C.int;
- Flags : C.int)
- return C.int;
+ Flags : C.int) return C.int;
function C_Recvfrom
(S : C.int;
@@ -292,23 +289,20 @@ package GNAT.Sockets.Thin is
Len : C.int;
Flags : C.int;
From : Sockaddr_In_Access;
- Fromlen : access C.int)
- return C.int;
+ Fromlen : access C.int) return C.int;
function C_Select
(Nfds : C.int;
Readfds : Fd_Set_Access;
Writefds : Fd_Set_Access;
Exceptfds : Fd_Set_Access;
- Timeout : Timeval_Access)
- return C.int;
+ Timeout : Timeval_Access) return C.int;
function C_Send
(S : C.int;
Msg : System.Address;
Len : C.int;
- Flags : C.int)
- return C.int;
+ Flags : C.int) return C.int;
function C_Sendto
(S : C.int;
@@ -316,44 +310,37 @@ package GNAT.Sockets.Thin is
Len : C.int;
Flags : C.int;
To : Sockaddr_In_Access;
- Tolen : C.int)
- return C.int;
+ Tolen : C.int) return C.int;
function C_Setsockopt
(S : C.int;
Level : C.int;
Optname : C.int;
Optval : System.Address;
- Optlen : C.int)
- return C.int;
+ Optlen : C.int) return C.int;
function C_Shutdown
(S : C.int;
- How : C.int)
- return C.int;
+ How : C.int) return C.int;
function C_Socket
(Domain : C.int;
Typ : C.int;
- Protocol : C.int)
- return C.int;
+ Protocol : C.int) return C.int;
function C_Strerror
- (Errnum : C.int)
- return C.Strings.chars_ptr;
+ (Errnum : C.int) return C.Strings.chars_ptr;
function C_System
- (Command : System.Address)
- return C.int;
+ (Command : System.Address) return C.int;
function C_Writev
(Fd : C.int;
Iov : System.Address;
- Iovcnt : C.int)
- return C.int;
+ Iovcnt : C.int) return C.int;
procedure Free_Socket_Set
- (Set : Fd_Set_Access);
+ (Set : Fd_Set_Access);
-- Free system-dependent socket set
procedure Get_Socket_From_Set
@@ -387,8 +374,7 @@ package GNAT.Sockets.Thin is
-- set back to the real largest socket in the socket set.
function New_Socket_Set
- (Set : Fd_Set_Access)
- return Fd_Set_Access;
+ (Set : Fd_Set_Access) return Fd_Set_Access;
-- Allocate a new socket set which is a system-dependent structure
-- and initialize by copying Set if it is non-null, by making it
-- empty otherwise.
diff --git a/gcc/ada/g-socthi-vxworks.adb b/gcc/ada/g-socthi-vxworks.adb
index 95de193ecf7..02a0df3fe33 100644
--- a/gcc/ada/g-socthi-vxworks.adb
+++ b/gcc/ada/g-socthi-vxworks.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2004 Ada Core Technologies, Inc. --
+-- Copyright (C) 2002-2005, AdaCore --
-- --
-- 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- --
@@ -267,14 +267,19 @@ package body GNAT.Sockets.Thin is
function To_Pointer is
new Unchecked_Conversion (System.Address, int_Access);
- procedure VxWorks_Gethostbyaddr
- (Addr : C.int; Buf : out C.char_array);
- pragma Import (C, VxWorks_Gethostbyaddr, "hostGetByAddr");
+ function VxWorks_hostGetByAddr
+ (Addr : C.int; Buf : System.Address) return C.int;
+ pragma Import (C, VxWorks_hostGetByAddr, "hostGetByAddr");
- Host_Name : C.char_array (1 .. Max_Name_Length);
+ Host_Name : aliased C.char_array (1 .. Max_Name_Length);
begin
- VxWorks_Gethostbyaddr (To_Pointer (Addr).all, Host_Name);
+ if VxWorks_hostGetByAddr (To_Pointer (Addr).all,
+ Host_Name (Host_Name'First)'Address)
+ /= Constants.OK
+ then
+ return null;
+ end if;
In_Addr_Access_Ptr.all.all := To_In_Addr (To_Pointer (Addr).all);
Local_Hostent.all.H_Name := C.Strings.New_Char_Array (Host_Name);
@@ -289,14 +294,17 @@ package body GNAT.Sockets.Thin is
function C_Gethostbyname
(Name : C.char_array) return Hostent_Access
is
- function VxWorks_Gethostbyname
+ function VxWorks_hostGetByName
(Name : C.char_array) return C.int;
- pragma Import (C, VxWorks_Gethostbyname, "hostGetByName");
+ pragma Import (C, VxWorks_hostGetByName, "hostGetByName");
Addr : C.int;
begin
- Addr := VxWorks_Gethostbyname (Name);
+ Addr := VxWorks_hostGetByName (Name);
+ if Addr /= Constants.OK then
+ return null;
+ end if;
In_Addr_Access_Ptr.all.all := To_In_Addr (Addr);
Local_Hostent.all.H_Name := C.Strings.New_Char_Array (To_C (Host_Name));
@@ -515,7 +523,6 @@ package body GNAT.Sockets.Thin is
function Non_Blocking_Socket (S : C.int) return Boolean is
R : Boolean;
-
begin
Task_Lock.Lock;
R := (Is_Socket_In_Set (Non_Blocking_Sockets, S) /= 0);
diff --git a/gcc/ada/g-socthi-vxworks.ads b/gcc/ada/g-socthi-vxworks.ads
index 2d818272983..6aee25d4ef4 100644
--- a/gcc/ada/g-socthi-vxworks.ads
+++ b/gcc/ada/g-socthi-vxworks.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2002-2005, AdaCore --
-- --
-- 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- --
@@ -63,15 +63,28 @@ package GNAT.Sockets.Thin is
-- Returns the error message string for the error number Errno. If Errno is
-- not known it returns "Unknown system error".
+ function Host_Errno return Integer;
+ pragma Import (C, Host_Errno, "__gnat_get_h_errno");
+ -- Returns last host error number
+
subtype Fd_Set_Access is System.Address;
No_Fd_Set : constant Fd_Set_Access := System.Null_Address;
- type Timeval_Unit is new C.int;
- pragma Convention (C, Timeval_Unit);
+ type time_t is
+ range -2 ** (8 * Constants.SIZEOF_tv_sec - 1)
+ .. 2 ** (8 * Constants.SIZEOF_tv_sec - 1) - 1;
+ for time_t'Size use 8 * Constants.SIZEOF_tv_sec;
+ pragma Convention (C, time_t);
+
+ type suseconds_t is
+ range -2 ** (8 * Constants.SIZEOF_tv_usec - 1)
+ .. 2 ** (8 * Constants.SIZEOF_tv_usec - 1) - 1;
+ for suseconds_t'Size use 8 * Constants.SIZEOF_tv_usec;
+ pragma Convention (C, suseconds_t);
type Timeval is record
- Tv_Sec : Timeval_Unit;
- Tv_Usec : Timeval_Unit;
+ Tv_Sec : time_t;
+ Tv_Usec : suseconds_t;
end record;
pragma Convention (C, Timeval);
@@ -199,94 +212,78 @@ package GNAT.Sockets.Thin is
function C_Accept
(S : C.int;
Addr : System.Address;
- Addrlen : access C.int)
- return C.int;
+ Addrlen : access C.int) return C.int;
function C_Bind
(S : C.int;
Name : System.Address;
- Namelen : C.int)
- return C.int;
+ Namelen : C.int) return C.int;
function C_Close
- (Fd : C.int)
- return C.int;
+ (Fd : C.int) return C.int;
function C_Connect
(S : C.int;
Name : System.Address;
- Namelen : C.int)
- return C.int;
+ Namelen : C.int) return C.int;
function C_Gethostbyaddr
(Addr : System.Address;
Len : C.int;
- Typ : C.int)
- return Hostent_Access;
+ Typ : C.int) return Hostent_Access;
function C_Gethostbyname
- (Name : C.char_array)
- return Hostent_Access;
+ (Name : C.char_array) return Hostent_Access;
function C_Gethostname
(Name : System.Address;
- Namelen : C.int)
- return C.int;
+ Namelen : C.int) return C.int;
function C_Getpeername
(S : C.int;
Name : System.Address;
- Namelen : access C.int)
- return C.int;
+ Namelen : access C.int) return C.int;
function C_Getservbyname
(Name : C.char_array;
- Proto : C.char_array)
- return Servent_Access;
+ Proto : C.char_array) return Servent_Access;
function C_Getservbyport
(Port : C.int;
- Proto : C.char_array)
- return Servent_Access;
+ Proto : C.char_array) return Servent_Access;
function C_Getsockname
(S : C.int;
Name : System.Address;
- Namelen : access C.int)
- return C.int;
+ Namelen : access C.int) return C.int;
function C_Getsockopt
(S : C.int;
Level : C.int;
Optname : C.int;
Optval : System.Address;
- Optlen : access C.int)
- return C.int;
+ Optlen : access C.int) return C.int;
function C_Inet_Addr
- (Cp : C.Strings.chars_ptr)
- return C.int;
+ (Cp : C.Strings.chars_ptr) return C.int;
function C_Ioctl
- (S : C.int;
- Req : C.int;
- Arg : Int_Access)
- return C.int;
+ (S : C.int;
+ Req : C.int;
+ Arg : Int_Access) return C.int;
function C_Listen (S, Backlog : C.int) return C.int;
function C_Readv
(Fd : C.int;
Iov : System.Address;
- Iovcnt : C.int)
- return C.int;
+ Iovcnt : C.int) return C.int;
function C_Recv
(S : C.int;
Msg : System.Address;
Len : C.int;
- Flags : C.int)
- return C.int;
+ Flags : C.int) return C.int;
function C_Recvfrom
(S : C.int;
@@ -294,23 +291,20 @@ package GNAT.Sockets.Thin is
Len : C.int;
Flags : C.int;
From : Sockaddr_In_Access;
- Fromlen : access C.int)
- return C.int;
+ Fromlen : access C.int) return C.int;
function C_Select
(Nfds : C.int;
Readfds : Fd_Set_Access;
Writefds : Fd_Set_Access;
Exceptfds : Fd_Set_Access;
- Timeout : Timeval_Access)
- return C.int;
+ Timeout : Timeval_Access) return C.int;
function C_Send
(S : C.int;
Msg : System.Address;
Len : C.int;
- Flags : C.int)
- return C.int;
+ Flags : C.int) return C.int;
function C_Sendto
(S : C.int;
@@ -318,44 +312,37 @@ package GNAT.Sockets.Thin is
Len : C.int;
Flags : C.int;
To : Sockaddr_In_Access;
- Tolen : C.int)
- return C.int;
+ Tolen : C.int) return C.int;
function C_Setsockopt
(S : C.int;
Level : C.int;
Optname : C.int;
Optval : System.Address;
- Optlen : C.int)
- return C.int;
+ Optlen : C.int) return C.int;
function C_Shutdown
- (S : C.int;
- How : C.int)
- return C.int;
+ (S : C.int;
+ How : C.int) return C.int;
function C_Socket
(Domain : C.int;
Typ : C.int;
- Protocol : C.int)
- return C.int;
+ Protocol : C.int) return C.int;
function C_Strerror
- (Errnum : C.int)
- return C.Strings.chars_ptr;
+ (Errnum : C.int) return C.Strings.chars_ptr;
function C_System
- (Command : System.Address)
- return C.int;
+ (Command : System.Address) return C.int;
function C_Writev
(Fd : C.int;
Iov : System.Address;
- Iovcnt : C.int)
- return C.int;
+ Iovcnt : C.int) return C.int;
procedure Free_Socket_Set
- (Set : Fd_Set_Access);
+ (Set : Fd_Set_Access);
-- Free system-dependent socket set
procedure Get_Socket_From_Set
@@ -389,8 +376,7 @@ package GNAT.Sockets.Thin is
-- set back to the real largest socket in the socket set.
function New_Socket_Set
- (Set : Fd_Set_Access)
- return Fd_Set_Access;
+ (Set : Fd_Set_Access) return Fd_Set_Access;
-- Allocate a new socket set which is a system-dependent structure
-- and initialize by copying Set if it is non-null, by making it
-- empty otherwise.
diff --git a/gcc/ada/g-socthi.ads b/gcc/ada/g-socthi.ads
index 10a9a2160e5..5d06d99bcae 100644
--- a/gcc/ada/g-socthi.ads
+++ b/gcc/ada/g-socthi.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- 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- --
@@ -65,15 +65,28 @@ package GNAT.Sockets.Thin is
-- Returns the error message string for the error number Errno. If Errno is
-- not known it returns "Unknown system error".
+ function Host_Errno return Integer;
+ pragma Import (C, Host_Errno, "__gnat_get_h_errno");
+ -- Returns last host error number
+
subtype Fd_Set_Access is System.Address;
No_Fd_Set : constant Fd_Set_Access := System.Null_Address;
- type Timeval_Unit is new C.int;
- pragma Convention (C, Timeval_Unit);
+ type time_t is
+ range -2 ** (8 * Constants.SIZEOF_tv_sec - 1)
+ .. 2 ** (8 * Constants.SIZEOF_tv_sec - 1) - 1;
+ for time_t'Size use 8 * Constants.SIZEOF_tv_sec;
+ pragma Convention (C, time_t);
+
+ type suseconds_t is
+ range -2 ** (8 * Constants.SIZEOF_tv_usec - 1)
+ .. 2 ** (8 * Constants.SIZEOF_tv_usec - 1) - 1;
+ for suseconds_t'Size use 8 * Constants.SIZEOF_tv_usec;
+ pragma Convention (C, suseconds_t);
type Timeval is record
- Tv_Sec : Timeval_Unit;
- Tv_Usec : Timeval_Unit;
+ Tv_Sec : time_t;
+ Tv_Usec : suseconds_t;
end record;
pragma Convention (C, Timeval);
diff --git a/gcc/ada/gen-soccon.c b/gcc/ada/gen-soccon.c
index 363416a674f..e8284335bcf 100644
--- a/gcc/ada/gen-soccon.c
+++ b/gcc/ada/gen-soccon.c
@@ -4,7 +4,7 @@
* *
* G E N - S O C C O N *
* *
- * Copyright (C) 2004-2005 Free Software Foundation, Inc. *
+ * Copyright (C) 2004-2005, 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- *
@@ -25,7 +25,7 @@
/* This program generates g-soccon.ads */
/* To build using DEC C:
- CC/DEFINE="TARGET=OpenVMS" gen-soccon
+ CC/DEFINE="TARGET=""OpenVMS""" gen-soccon
LINK gen-soccon
RUN gen-soccon
*/
@@ -37,6 +37,11 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <limits.h>
+
+#ifdef __MINGW32__
+#include <fcntl.h>
+#endif
#include "gsocket.h"
@@ -55,8 +60,8 @@ struct line *first = NULL, *last = NULL;
#define _NL TXT("")
/* Empty line */
-#define itoad(n) f_itoa ("%d", n)
-#define itoax(n) f_itoa ("16#%08x#", n)
+#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);
/* Constant (decimal) */
@@ -78,6 +83,10 @@ char *f_itoa (char *, int);
void add_line (char *, char*, char*);
+#ifdef __MINGW32__
+unsigned int _CRT_fmode = _O_BINARY;
+#endif
+
int
main (void) {
@@ -89,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-2005, 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- --")
@@ -118,7 +127,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 " STR (TARGET))
+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
@@ -565,6 +574,36 @@ _NL
CND(IOV_MAX, "Maximum writev iovcnt")
_NL
+TXT(" ----------------------")
+TXT(" -- Type definitions --")
+TXT(" ----------------------")
+_NL
+
+{
+ struct timeval tv;
+TXT(" -- Sizes (in bytes) of the components of struct timeval")
+_NL
+#define SIZEOF_tv_sec (sizeof tv.tv_sec)
+CND(SIZEOF_tv_sec, "tv_sec")
+#define SIZEOF_tv_usec (sizeof tv.tv_usec)
+CND(SIZEOF_tv_usec, "tv_usec")
+}
+
+#ifdef __vxworks
+_NL
+TXT(" --------------------------------")
+TXT(" -- VxWorks-specific constants --")
+TXT(" --------------------------------")
+_NL
+TXT(" -- These constants may be used only within the VxWorks version of")
+TXT(" -- GNAT.Sockets.Thin.")
+_NL
+
+CND(OK, "VxWorks generic success")
+CND(ERROR, "VxWorks generic error")
+#endif
+
+_NL
TXT("end GNAT.Sockets.Constants;")
output ();
@@ -614,6 +653,7 @@ f_itoa (char *fmt, int n) {
void
add_line (char *_text, char *_value, char *_comment) {
struct line *l = (struct line *) malloc (sizeof (struct line));
+
l->text = _text;
l->value = _value;
l->comment = _comment;
diff --git a/gcc/ada/gsocket.h b/gcc/ada/gsocket.h
index f593acfaed4..a380788995a 100644
--- a/gcc/ada/gsocket.h
+++ b/gcc/ada/gsocket.h
@@ -55,6 +55,8 @@
#if defined(__vxworks)
#include <vxWorks.h>
#include <ioLib.h>
+#include <hostLib.h>
+#include <resolvLib.h>
#define SHUT_RD 0
#define SHUT_WR 1
#define SHUT_RDWR 2
@@ -131,7 +133,9 @@
#include <errno.h>
#endif
-#ifndef __vxworks
+#ifdef __vxworks
+#include <sys/times.h>
+#else
#include <sys/time.h>
#endif
diff --git a/gcc/ada/socket.c b/gcc/ada/socket.c
index 32135237b5a..d02763a9548 100644
--- a/gcc/ada/socket.c
+++ b/gcc/ada/socket.c
@@ -40,6 +40,7 @@
/* Required for __gnat_malloc() */
#include <string.h>
+/* Required for memcpy() */
extern void __gnat_disable_sigpipe (int fd);
extern void __gnat_free_socket_set (fd_set *);
@@ -49,8 +50,10 @@ extern void __gnat_insert_socket_in_set (fd_set *, int);
extern int __gnat_is_socket_in_set (fd_set *, int);
extern fd_set *__gnat_new_socket_set (fd_set *);
extern void __gnat_remove_socket_from_set (fd_set *, int);
+extern int __gnat_get_h_errno (void);
/* Disable the sending of SIGPIPE for writes on a broken stream */
+
void
__gnat_disable_sigpipe (int fd)
{
@@ -152,3 +155,41 @@ __gnat_remove_socket_from_set (fd_set *set, int socket)
{
FD_CLR (socket, set);
}
+
+/* Get the value of the last host error */
+
+int
+__gnat_get_h_errno (void) {
+#ifdef __vxworks
+ int vxw_errno = errno;
+
+ switch (vxw_errno) {
+ case 0:
+ return 0;
+
+ case S_resolvLib_HOST_NOT_FOUND:
+ case S_hostLib_UNKNOWN_HOST:
+ return HOST_NOT_FOUND;
+
+ case S_resolvLib_TRY_AGAIN:
+ return TRY_AGAIN;
+
+ case S_resolvLib_NO_RECOVERY:
+ case S_resolvLib_BUFFER_2_SMALL:
+ case S_resolvLib_INVALID_PARAMETER:
+ case S_resolvLib_INVALID_ADDRESS:
+ case S_hostLib_INVALID_PARAMETER:
+ return NO_RECOVERY;
+
+ case S_resolvLib_NO_DATA:
+ return NO_DATA;
+
+ default:
+ return -1;
+ }
+#elif defined(VMS)
+ return errno;
+#else
+ return h_errno;
+#endif
+}