Commit 3e1fd98f by Thomas Quinot Committed by Arnaud Charlet

g-soccon.ads: Minor reformatting.

2005-11-14  Thomas Quinot  <quinot@adacore.com>

	* g-soccon.ads: Minor reformatting. Update comments.

	* gsocket.h: Include <sys/times.h> in the VxWorks case, in order to
	gain visibility on the declaration of struct timeval.

	* g-soccon-freebsd.ads,
	g-soccon-darwin.ads,
	g-soccon-tru64.ads,
	g-soccon-aix.ads,
	g-soccon-irix.ads,
	g-soccon-hpux.ads,
	g-soccon-solaris.ads,
	g-soccon-vms.ads,
	g-soccon-mingw.ads,
	g-soccon-vxworks.ads (SIZEOF_tv_sec, SIZEOF_tv_usec): New constants.

	* g-soccon-hpux-ia64.ads, g-soccon-linux-ppc.ads,
	g-soccon-solaris-64.ads, g-soccon-linux-64.ads,
	g-soccon-linux-x86.ads: New files.

	* g-socthi-mingw.adb: 
	(Socket_Error_Message): Remove redundant use of GNAT.Sockets.Constants

	* g-socthi-vxworks.ads, g-socthi-vms.ads, g-socthi-mingw.ads
	(time_t, suseconds_t): New types constructed to match the tv_sec
	and tv_usec fields of C struct timeval.
	(Timeval): Construct structure in terms of the new types.
	(Host_Errno): New function (imported from socket.c), returns last hosts
	database error.

	* g-socthi-vxworks.adb:  Add error handling circuitry.

	* g-socket.ads, g-socket.adb (To_Timeval): Reflect change of type for
	components of struct timeval.
	(Get_Host_By_Name, Get_Host_By_Address): Fix error reporting circuitry.
	(Check_Selector): In error conditions, clear internal socket sets to
	avoid a memory leak.
	(Get_Socket_Option, Set_Socket_Option): Support for Multicast_If,
	Send_Timeout, Receive_Timeout.

	* g-socthi.ads (time_t, suseconds_t): New types constructed to match
	the tv_sec and tv_usec fields of C struct timeval.
	(Timeval): Construct structure in terms of the new types.
	(Host_Errno): New function (imported from socket.c), returns last hosts
	database error.

	* socket.c (__gnat_get_h_errno): New function to retrieve h_errno, the
	hosts database last error code.

	* gen-soccon.c: Complete value expansion should not be performed on
	TARGET, as it has the form of a math expression, and some components
	may be platform-defined macros.
	For VxWorks, generate the OK and ERROR values.
	New constants giving the sizes of the components of C struct timeval.

From-SVN: r106949
parent b4f32d07
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
-- by the GNAT.Sockets package (g-socket.ads). This package should not be -- by the GNAT.Sockets package (g-socket.ads). This package should not be
-- directly with'ed by an applications program. -- 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, -- 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. -- make changes to gen-soccon.c and re-run it on each target.
...@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is ...@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 16; -- Maximum writev iovcnt 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; end GNAT.Sockets.Constants;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is ...@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt 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; end GNAT.Sockets.Constants;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is ...@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 1024; -- Maximum writev iovcnt 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; end GNAT.Sockets.Constants;
------------------------------------------------------------------------------
-- --
-- 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;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is ...@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 16; -- Maximum writev iovcnt 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; end GNAT.Sockets.Constants;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is ...@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt 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; end GNAT.Sockets.Constants;
------------------------------------------------------------------------------
-- --
-- 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;
------------------------------------------------------------------------------
-- --
-- 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;
------------------------------------------------------------------------------
-- --
-- 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;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is ...@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt 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; end GNAT.Sockets.Constants;
------------------------------------------------------------------------------
-- --
-- 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;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is ...@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 16; -- Maximum writev iovcnt 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; end GNAT.Sockets.Constants;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is ...@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 1024; -- Maximum writev iovcnt 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; end GNAT.Sockets.Constants;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is ...@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 1024; -- Maximum writev iovcnt 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; end GNAT.Sockets.Constants;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -169,4 +169,23 @@ package GNAT.Sockets.Constants is ...@@ -169,4 +169,23 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt 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; end GNAT.Sockets.Constants;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -36,6 +36,9 @@ ...@@ -36,6 +36,9 @@
-- directly with'ed by an applications program. -- directly with'ed by an applications program.
-- This is the version for i686-pc-linux-gnu -- 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, -- 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. -- make changes to gen-soccon.c and re-run it on each target.
...@@ -169,4 +172,13 @@ package GNAT.Sockets.Constants is ...@@ -169,4 +172,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt 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; end GNAT.Sockets.Constants;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -489,7 +489,7 @@ package GNAT.Sockets is ...@@ -489,7 +489,7 @@ package GNAT.Sockets is
Host_Error : exception; Host_Error : exception;
-- Exception raised by the two following procedures. Once raised, its -- Exception raised by the two following procedures. Once raised, its
-- message contains a string describing the error code. This exception is -- 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 function Get_Host_By_Address
(Address : Inet_Addr_Type; (Address : Inet_Addr_Type;
...@@ -595,6 +595,16 @@ package GNAT.Sockets is ...@@ -595,6 +595,16 @@ package GNAT.Sockets is
Unknown_Server_Error, Unknown_Server_Error,
Cannot_Resolve_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 -- Get_Socket_Options and Set_Socket_Options manipulate options associated
-- with a socket. Options may exist at multiple protocol levels in the -- with a socket. Options may exist at multiple protocol levels in the
-- communication stack. Socket_Level is the uppermost socket level. -- communication stack. Socket_Level is the uppermost socket level.
...@@ -610,18 +620,21 @@ package GNAT.Sockets is ...@@ -610,18 +620,21 @@ package GNAT.Sockets is
-- a boolean to enable or disable this option. -- a boolean to enable or disable this option.
type Option_Name is ( type Option_Name is (
Keep_Alive, -- Enable sending of keep-alive messages Keep_Alive, -- Enable sending of keep-alive messages
Reuse_Address, -- Allow bind to reuse local address Reuse_Address, -- Allow bind to reuse local address
Broadcast, -- Enable datagram sockets to recv/send broadcast packets Broadcast, -- Enable datagram sockets to recv/send broadcasts
Send_Buffer, -- Set/get the maximum socket send buffer in bytes Send_Buffer, -- Set/get the maximum socket send buffer in bytes
Receive_Buffer, -- Set/get the maximum socket recv 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 Linger, -- Shutdown wait for msg to be sent or timeout occur
Error, -- Get and clear the pending socket error Error, -- Get and clear the pending socket error
No_Delay, -- Do not delay send to coalesce packets (TCP_NODELAY) No_Delay, -- Do not delay send to coalesce packets (TCP_NODELAY)
Add_Membership, -- Join a multicast group Add_Membership, -- Join a multicast group
Drop_Membership, -- Leave a multicast group Drop_Membership, -- Leave a multicast group
Multicast_TTL, -- Indicate the time-to-live of sent multicast packets Multicast_If, -- Set default outgoing interface for multicast packets
Multicast_Loop); -- Sent multicast packets are looped to the local socket 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 type Option_Type (Name : Option_Name := Keep_Alive) is record
case Name is case Name is
...@@ -652,9 +665,16 @@ package GNAT.Sockets is ...@@ -652,9 +665,16 @@ package GNAT.Sockets is
Multicast_Address : Inet_Addr_Type; Multicast_Address : Inet_Addr_Type;
Local_Interface : Inet_Addr_Type; Local_Interface : Inet_Addr_Type;
when Multicast_If =>
Outgoing_If : Inet_Addr_Type;
when Multicast_TTL => when Multicast_TTL =>
Time_To_Live : Natural; Time_To_Live : Natural;
when Send_Timeout |
Receive_Timeout =>
Timeout : Timeval_Duration;
end case; end case;
end record; end record;
...@@ -935,15 +955,7 @@ package GNAT.Sockets is ...@@ -935,15 +955,7 @@ package GNAT.Sockets is
type Selector_Type is limited private; type Selector_Type is limited private;
type Selector_Access is access all Selector_Type; type Selector_Access is access all Selector_Type;
-- Selector_Duration is a subtype of Standard.Duration because the full subtype Selector_Duration is Timeval_Duration;
-- 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;
procedure Create_Selector (Selector : out Selector_Type); procedure Create_Selector (Selector : out Selector_Type);
-- Create a new selector -- Create a new selector
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -59,8 +59,7 @@ package body GNAT.Sockets.Thin is ...@@ -59,8 +59,7 @@ package body GNAT.Sockets.Thin is
function Standard_Connect function Standard_Connect
(S : C.int; (S : C.int;
Name : System.Address; Name : System.Address;
Namelen : C.int) Namelen : C.int) return C.int;
return C.int;
pragma Import (Stdcall, Standard_Connect, "connect"); pragma Import (Stdcall, Standard_Connect, "connect");
function Standard_Select function Standard_Select
...@@ -68,8 +67,7 @@ package body GNAT.Sockets.Thin is ...@@ -68,8 +67,7 @@ package body GNAT.Sockets.Thin is
Readfds : Fd_Set_Access; Readfds : Fd_Set_Access;
Writefds : Fd_Set_Access; Writefds : Fd_Set_Access;
Exceptfds : Fd_Set_Access; Exceptfds : Fd_Set_Access;
Timeout : Timeval_Access) Timeout : Timeval_Access) return C.int;
return C.int;
pragma Import (Stdcall, Standard_Select, "select"); pragma Import (Stdcall, Standard_Select, "select");
type Error_Type is type Error_Type is
...@@ -239,8 +237,7 @@ package body GNAT.Sockets.Thin is ...@@ -239,8 +237,7 @@ package body GNAT.Sockets.Thin is
function C_Connect function C_Connect
(S : C.int; (S : C.int;
Name : System.Address; Name : System.Address;
Namelen : C.int) Namelen : C.int) return C.int
return C.int
is is
Res : C.int; Res : C.int;
...@@ -263,8 +260,7 @@ package body GNAT.Sockets.Thin is ...@@ -263,8 +260,7 @@ package body GNAT.Sockets.Thin is
function C_Readv function C_Readv
(Socket : C.int; (Socket : C.int;
Iov : System.Address; Iov : System.Address;
Iovcnt : C.int) Iovcnt : C.int) return C.int
return C.int
is is
Res : C.int; Res : C.int;
Count : C.int := 0; Count : C.int := 0;
...@@ -299,8 +295,7 @@ package body GNAT.Sockets.Thin is ...@@ -299,8 +295,7 @@ package body GNAT.Sockets.Thin is
Readfds : Fd_Set_Access; Readfds : Fd_Set_Access;
Writefds : Fd_Set_Access; Writefds : Fd_Set_Access;
Exceptfds : Fd_Set_Access; Exceptfds : Fd_Set_Access;
Timeout : Timeval_Access) Timeout : Timeval_Access) return C.int
return C.int
is is
pragma Warnings (Off, Exceptfds); pragma Warnings (Off, Exceptfds);
...@@ -441,8 +436,7 @@ package body GNAT.Sockets.Thin is ...@@ -441,8 +436,7 @@ package body GNAT.Sockets.Thin is
function C_Writev function C_Writev
(Socket : C.int; (Socket : C.int;
Iov : System.Address; Iov : System.Address;
Iovcnt : C.int) Iovcnt : C.int) return C.int
return C.int
is is
Res : C.int; Res : C.int;
Count : C.int := 0; Count : C.int := 0;
...@@ -553,11 +547,8 @@ package body GNAT.Sockets.Thin is ...@@ -553,11 +547,8 @@ package body GNAT.Sockets.Thin is
-------------------------- --------------------------
function Socket_Error_Message function Socket_Error_Message
(Errno : Integer) (Errno : Integer) return C.Strings.chars_ptr
return C.Strings.chars_ptr
is is
use GNAT.Sockets.Constants;
begin begin
case Errno is case Errno is
when EINTR => return Error_Messages (N_EINTR); when EINTR => return Error_Messages (N_EINTR);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -61,20 +61,32 @@ package GNAT.Sockets.Thin is ...@@ -61,20 +61,32 @@ package GNAT.Sockets.Thin is
-- Set last socket error number -- Set last socket error number
function Socket_Error_Message function Socket_Error_Message
(Errno : Integer) (Errno : Integer) return C.Strings.chars_ptr;
return C.Strings.chars_ptr;
-- Returns the error message string for the error number Errno. If -- Returns the error message string for the error number Errno. If
-- Errno is not known it returns "Unknown system error". -- 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; subtype Fd_Set_Access is System.Address;
No_Fd_Set : constant Fd_Set_Access := System.Null_Address; No_Fd_Set : constant Fd_Set_Access := System.Null_Address;
type Timeval_Unit is new C.long; type time_t is
pragma Convention (C, Timeval_Unit); 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 type Timeval is record
Tv_Sec : Timeval_Unit; Tv_Sec : time_t;
Tv_Usec : Timeval_Unit; Tv_Usec : suseconds_t;
end record; end record;
pragma Convention (C, Timeval); pragma Convention (C, Timeval);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -64,15 +64,28 @@ package GNAT.Sockets.Thin is ...@@ -64,15 +64,28 @@ package GNAT.Sockets.Thin is
-- Returns the error message string for the error number Errno. If -- Returns the error message string for the error number Errno. If
-- Errno is not known it returns "Unknown system error". -- 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; subtype Fd_Set_Access is System.Address;
No_Fd_Set : constant Fd_Set_Access := System.Null_Address; No_Fd_Set : constant Fd_Set_Access := System.Null_Address;
type Timeval_Unit is new C.int; type time_t is
pragma Convention (C, Timeval_Unit); 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 type Timeval is record
Tv_Sec : Timeval_Unit; Tv_Sec : time_t;
Tv_Usec : Timeval_Unit; Tv_Usec : suseconds_t;
end record; end record;
pragma Convention (C, Timeval); pragma Convention (C, Timeval);
...@@ -197,94 +210,78 @@ package GNAT.Sockets.Thin is ...@@ -197,94 +210,78 @@ package GNAT.Sockets.Thin is
function C_Accept function C_Accept
(S : C.int; (S : C.int;
Addr : System.Address; Addr : System.Address;
Addrlen : access C.int) Addrlen : access C.int) return C.int;
return C.int;
function C_Bind function C_Bind
(S : C.int; (S : C.int;
Name : System.Address; Name : System.Address;
Namelen : C.int) Namelen : C.int) return C.int;
return C.int;
function C_Close function C_Close
(Fd : C.int) (Fd : C.int) return C.int;
return C.int;
function C_Connect function C_Connect
(S : C.int; (S : C.int;
Name : System.Address; Name : System.Address;
Namelen : C.int) Namelen : C.int) return C.int;
return C.int;
function C_Gethostbyaddr function C_Gethostbyaddr
(Addr : System.Address; (Addr : System.Address;
Len : C.int; Len : C.int;
Typ : C.int) Typ : C.int) return Hostent_Access;
return Hostent_Access;
function C_Gethostbyname function C_Gethostbyname
(Name : C.char_array) (Name : C.char_array) return Hostent_Access;
return Hostent_Access;
function C_Gethostname function C_Gethostname
(Name : System.Address; (Name : System.Address;
Namelen : C.int) Namelen : C.int) return C.int;
return C.int;
function C_Getpeername function C_Getpeername
(S : C.int; (S : C.int;
Name : System.Address; Name : System.Address;
Namelen : access C.int) Namelen : access C.int) return C.int;
return C.int;
function C_Getservbyname function C_Getservbyname
(Name : C.char_array; (Name : C.char_array;
Proto : C.char_array) Proto : C.char_array) return Servent_Access;
return Servent_Access;
function C_Getservbyport function C_Getservbyport
(Port : C.int; (Port : C.int;
Proto : C.char_array) Proto : C.char_array) return Servent_Access;
return Servent_Access;
function C_Getsockname function C_Getsockname
(S : C.int; (S : C.int;
Name : System.Address; Name : System.Address;
Namelen : access C.int) Namelen : access C.int) return C.int;
return C.int;
function C_Getsockopt function C_Getsockopt
(S : C.int; (S : C.int;
Level : C.int; Level : C.int;
Optname : C.int; Optname : C.int;
Optval : System.Address; Optval : System.Address;
Optlen : access C.int) Optlen : access C.int) return C.int;
return C.int;
function C_Inet_Addr function C_Inet_Addr
(Cp : C.Strings.chars_ptr) (Cp : C.Strings.chars_ptr) return C.int;
return C.int;
function C_Ioctl function C_Ioctl
(S : C.int; (S : C.int;
Req : C.int; Req : C.int;
Arg : Int_Access) Arg : Int_Access) return C.int;
return C.int;
function C_Listen (S, Backlog : C.int) return C.int; function C_Listen (S, Backlog : C.int) return C.int;
function C_Readv function C_Readv
(Fd : C.int; (Fd : C.int;
Iov : System.Address; Iov : System.Address;
Iovcnt : C.int) Iovcnt : C.int) return C.int;
return C.int;
function C_Recv function C_Recv
(S : C.int; (S : C.int;
Msg : System.Address; Msg : System.Address;
Len : C.int; Len : C.int;
Flags : C.int) Flags : C.int) return C.int;
return C.int;
function C_Recvfrom function C_Recvfrom
(S : C.int; (S : C.int;
...@@ -292,23 +289,20 @@ package GNAT.Sockets.Thin is ...@@ -292,23 +289,20 @@ package GNAT.Sockets.Thin is
Len : C.int; Len : C.int;
Flags : C.int; Flags : C.int;
From : Sockaddr_In_Access; From : Sockaddr_In_Access;
Fromlen : access C.int) Fromlen : access C.int) return C.int;
return C.int;
function C_Select function C_Select
(Nfds : C.int; (Nfds : C.int;
Readfds : Fd_Set_Access; Readfds : Fd_Set_Access;
Writefds : Fd_Set_Access; Writefds : Fd_Set_Access;
Exceptfds : Fd_Set_Access; Exceptfds : Fd_Set_Access;
Timeout : Timeval_Access) Timeout : Timeval_Access) return C.int;
return C.int;
function C_Send function C_Send
(S : C.int; (S : C.int;
Msg : System.Address; Msg : System.Address;
Len : C.int; Len : C.int;
Flags : C.int) Flags : C.int) return C.int;
return C.int;
function C_Sendto function C_Sendto
(S : C.int; (S : C.int;
...@@ -316,44 +310,37 @@ package GNAT.Sockets.Thin is ...@@ -316,44 +310,37 @@ package GNAT.Sockets.Thin is
Len : C.int; Len : C.int;
Flags : C.int; Flags : C.int;
To : Sockaddr_In_Access; To : Sockaddr_In_Access;
Tolen : C.int) Tolen : C.int) return C.int;
return C.int;
function C_Setsockopt function C_Setsockopt
(S : C.int; (S : C.int;
Level : C.int; Level : C.int;
Optname : C.int; Optname : C.int;
Optval : System.Address; Optval : System.Address;
Optlen : C.int) Optlen : C.int) return C.int;
return C.int;
function C_Shutdown function C_Shutdown
(S : C.int; (S : C.int;
How : C.int) How : C.int) return C.int;
return C.int;
function C_Socket function C_Socket
(Domain : C.int; (Domain : C.int;
Typ : C.int; Typ : C.int;
Protocol : C.int) Protocol : C.int) return C.int;
return C.int;
function C_Strerror function C_Strerror
(Errnum : C.int) (Errnum : C.int) return C.Strings.chars_ptr;
return C.Strings.chars_ptr;
function C_System function C_System
(Command : System.Address) (Command : System.Address) return C.int;
return C.int;
function C_Writev function C_Writev
(Fd : C.int; (Fd : C.int;
Iov : System.Address; Iov : System.Address;
Iovcnt : C.int) Iovcnt : C.int) return C.int;
return C.int;
procedure Free_Socket_Set procedure Free_Socket_Set
(Set : Fd_Set_Access); (Set : Fd_Set_Access);
-- Free system-dependent socket set -- Free system-dependent socket set
procedure Get_Socket_From_Set procedure Get_Socket_From_Set
...@@ -387,8 +374,7 @@ package GNAT.Sockets.Thin is ...@@ -387,8 +374,7 @@ package GNAT.Sockets.Thin is
-- set back to the real largest socket in the socket set. -- set back to the real largest socket in the socket set.
function New_Socket_Set function New_Socket_Set
(Set : Fd_Set_Access) (Set : Fd_Set_Access) return Fd_Set_Access;
return Fd_Set_Access;
-- Allocate a new socket set which is a system-dependent structure -- Allocate a new socket set which is a system-dependent structure
-- and initialize by copying Set if it is non-null, by making it -- and initialize by copying Set if it is non-null, by making it
-- empty otherwise. -- empty otherwise.
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -267,14 +267,19 @@ package body GNAT.Sockets.Thin is ...@@ -267,14 +267,19 @@ package body GNAT.Sockets.Thin is
function To_Pointer is function To_Pointer is
new Unchecked_Conversion (System.Address, int_Access); new Unchecked_Conversion (System.Address, int_Access);
procedure VxWorks_Gethostbyaddr function VxWorks_hostGetByAddr
(Addr : C.int; Buf : out C.char_array); (Addr : C.int; Buf : System.Address) return C.int;
pragma Import (C, VxWorks_Gethostbyaddr, "hostGetByAddr"); 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 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); 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); Local_Hostent.all.H_Name := C.Strings.New_Char_Array (Host_Name);
...@@ -289,14 +294,17 @@ package body GNAT.Sockets.Thin is ...@@ -289,14 +294,17 @@ package body GNAT.Sockets.Thin is
function C_Gethostbyname function C_Gethostbyname
(Name : C.char_array) return Hostent_Access (Name : C.char_array) return Hostent_Access
is is
function VxWorks_Gethostbyname function VxWorks_hostGetByName
(Name : C.char_array) return C.int; (Name : C.char_array) return C.int;
pragma Import (C, VxWorks_Gethostbyname, "hostGetByName"); pragma Import (C, VxWorks_hostGetByName, "hostGetByName");
Addr : C.int; Addr : C.int;
begin 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); In_Addr_Access_Ptr.all.all := To_In_Addr (Addr);
Local_Hostent.all.H_Name := C.Strings.New_Char_Array (To_C (Host_Name)); Local_Hostent.all.H_Name := C.Strings.New_Char_Array (To_C (Host_Name));
...@@ -515,7 +523,6 @@ package body GNAT.Sockets.Thin is ...@@ -515,7 +523,6 @@ package body GNAT.Sockets.Thin is
function Non_Blocking_Socket (S : C.int) return Boolean is function Non_Blocking_Socket (S : C.int) return Boolean is
R : Boolean; R : Boolean;
begin begin
Task_Lock.Lock; Task_Lock.Lock;
R := (Is_Socket_In_Set (Non_Blocking_Sockets, S) /= 0); R := (Is_Socket_In_Set (Non_Blocking_Sockets, S) /= 0);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -63,15 +63,28 @@ package GNAT.Sockets.Thin is ...@@ -63,15 +63,28 @@ package GNAT.Sockets.Thin is
-- Returns the error message string for the error number Errno. If Errno is -- Returns the error message string for the error number Errno. If Errno is
-- not known it returns "Unknown system error". -- 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; subtype Fd_Set_Access is System.Address;
No_Fd_Set : constant Fd_Set_Access := System.Null_Address; No_Fd_Set : constant Fd_Set_Access := System.Null_Address;
type Timeval_Unit is new C.int; type time_t is
pragma Convention (C, Timeval_Unit); 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 type Timeval is record
Tv_Sec : Timeval_Unit; Tv_Sec : time_t;
Tv_Usec : Timeval_Unit; Tv_Usec : suseconds_t;
end record; end record;
pragma Convention (C, Timeval); pragma Convention (C, Timeval);
...@@ -199,94 +212,78 @@ package GNAT.Sockets.Thin is ...@@ -199,94 +212,78 @@ package GNAT.Sockets.Thin is
function C_Accept function C_Accept
(S : C.int; (S : C.int;
Addr : System.Address; Addr : System.Address;
Addrlen : access C.int) Addrlen : access C.int) return C.int;
return C.int;
function C_Bind function C_Bind
(S : C.int; (S : C.int;
Name : System.Address; Name : System.Address;
Namelen : C.int) Namelen : C.int) return C.int;
return C.int;
function C_Close function C_Close
(Fd : C.int) (Fd : C.int) return C.int;
return C.int;
function C_Connect function C_Connect
(S : C.int; (S : C.int;
Name : System.Address; Name : System.Address;
Namelen : C.int) Namelen : C.int) return C.int;
return C.int;
function C_Gethostbyaddr function C_Gethostbyaddr
(Addr : System.Address; (Addr : System.Address;
Len : C.int; Len : C.int;
Typ : C.int) Typ : C.int) return Hostent_Access;
return Hostent_Access;
function C_Gethostbyname function C_Gethostbyname
(Name : C.char_array) (Name : C.char_array) return Hostent_Access;
return Hostent_Access;
function C_Gethostname function C_Gethostname
(Name : System.Address; (Name : System.Address;
Namelen : C.int) Namelen : C.int) return C.int;
return C.int;
function C_Getpeername function C_Getpeername
(S : C.int; (S : C.int;
Name : System.Address; Name : System.Address;
Namelen : access C.int) Namelen : access C.int) return C.int;
return C.int;
function C_Getservbyname function C_Getservbyname
(Name : C.char_array; (Name : C.char_array;
Proto : C.char_array) Proto : C.char_array) return Servent_Access;
return Servent_Access;
function C_Getservbyport function C_Getservbyport
(Port : C.int; (Port : C.int;
Proto : C.char_array) Proto : C.char_array) return Servent_Access;
return Servent_Access;
function C_Getsockname function C_Getsockname
(S : C.int; (S : C.int;
Name : System.Address; Name : System.Address;
Namelen : access C.int) Namelen : access C.int) return C.int;
return C.int;
function C_Getsockopt function C_Getsockopt
(S : C.int; (S : C.int;
Level : C.int; Level : C.int;
Optname : C.int; Optname : C.int;
Optval : System.Address; Optval : System.Address;
Optlen : access C.int) Optlen : access C.int) return C.int;
return C.int;
function C_Inet_Addr function C_Inet_Addr
(Cp : C.Strings.chars_ptr) (Cp : C.Strings.chars_ptr) return C.int;
return C.int;
function C_Ioctl function C_Ioctl
(S : C.int; (S : C.int;
Req : C.int; Req : C.int;
Arg : Int_Access) Arg : Int_Access) return C.int;
return C.int;
function C_Listen (S, Backlog : C.int) return C.int; function C_Listen (S, Backlog : C.int) return C.int;
function C_Readv function C_Readv
(Fd : C.int; (Fd : C.int;
Iov : System.Address; Iov : System.Address;
Iovcnt : C.int) Iovcnt : C.int) return C.int;
return C.int;
function C_Recv function C_Recv
(S : C.int; (S : C.int;
Msg : System.Address; Msg : System.Address;
Len : C.int; Len : C.int;
Flags : C.int) Flags : C.int) return C.int;
return C.int;
function C_Recvfrom function C_Recvfrom
(S : C.int; (S : C.int;
...@@ -294,23 +291,20 @@ package GNAT.Sockets.Thin is ...@@ -294,23 +291,20 @@ package GNAT.Sockets.Thin is
Len : C.int; Len : C.int;
Flags : C.int; Flags : C.int;
From : Sockaddr_In_Access; From : Sockaddr_In_Access;
Fromlen : access C.int) Fromlen : access C.int) return C.int;
return C.int;
function C_Select function C_Select
(Nfds : C.int; (Nfds : C.int;
Readfds : Fd_Set_Access; Readfds : Fd_Set_Access;
Writefds : Fd_Set_Access; Writefds : Fd_Set_Access;
Exceptfds : Fd_Set_Access; Exceptfds : Fd_Set_Access;
Timeout : Timeval_Access) Timeout : Timeval_Access) return C.int;
return C.int;
function C_Send function C_Send
(S : C.int; (S : C.int;
Msg : System.Address; Msg : System.Address;
Len : C.int; Len : C.int;
Flags : C.int) Flags : C.int) return C.int;
return C.int;
function C_Sendto function C_Sendto
(S : C.int; (S : C.int;
...@@ -318,44 +312,37 @@ package GNAT.Sockets.Thin is ...@@ -318,44 +312,37 @@ package GNAT.Sockets.Thin is
Len : C.int; Len : C.int;
Flags : C.int; Flags : C.int;
To : Sockaddr_In_Access; To : Sockaddr_In_Access;
Tolen : C.int) Tolen : C.int) return C.int;
return C.int;
function C_Setsockopt function C_Setsockopt
(S : C.int; (S : C.int;
Level : C.int; Level : C.int;
Optname : C.int; Optname : C.int;
Optval : System.Address; Optval : System.Address;
Optlen : C.int) Optlen : C.int) return C.int;
return C.int;
function C_Shutdown function C_Shutdown
(S : C.int; (S : C.int;
How : C.int) How : C.int) return C.int;
return C.int;
function C_Socket function C_Socket
(Domain : C.int; (Domain : C.int;
Typ : C.int; Typ : C.int;
Protocol : C.int) Protocol : C.int) return C.int;
return C.int;
function C_Strerror function C_Strerror
(Errnum : C.int) (Errnum : C.int) return C.Strings.chars_ptr;
return C.Strings.chars_ptr;
function C_System function C_System
(Command : System.Address) (Command : System.Address) return C.int;
return C.int;
function C_Writev function C_Writev
(Fd : C.int; (Fd : C.int;
Iov : System.Address; Iov : System.Address;
Iovcnt : C.int) Iovcnt : C.int) return C.int;
return C.int;
procedure Free_Socket_Set procedure Free_Socket_Set
(Set : Fd_Set_Access); (Set : Fd_Set_Access);
-- Free system-dependent socket set -- Free system-dependent socket set
procedure Get_Socket_From_Set procedure Get_Socket_From_Set
...@@ -389,8 +376,7 @@ package GNAT.Sockets.Thin is ...@@ -389,8 +376,7 @@ package GNAT.Sockets.Thin is
-- set back to the real largest socket in the socket set. -- set back to the real largest socket in the socket set.
function New_Socket_Set function New_Socket_Set
(Set : Fd_Set_Access) (Set : Fd_Set_Access) return Fd_Set_Access;
return Fd_Set_Access;
-- Allocate a new socket set which is a system-dependent structure -- Allocate a new socket set which is a system-dependent structure
-- and initialize by copying Set if it is non-null, by making it -- and initialize by copying Set if it is non-null, by making it
-- empty otherwise. -- empty otherwise.
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -65,15 +65,28 @@ package GNAT.Sockets.Thin is ...@@ -65,15 +65,28 @@ package GNAT.Sockets.Thin is
-- Returns the error message string for the error number Errno. If Errno is -- Returns the error message string for the error number Errno. If Errno is
-- not known it returns "Unknown system error". -- 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; subtype Fd_Set_Access is System.Address;
No_Fd_Set : constant Fd_Set_Access := System.Null_Address; No_Fd_Set : constant Fd_Set_Access := System.Null_Address;
type Timeval_Unit is new C.int; type time_t is
pragma Convention (C, Timeval_Unit); 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 type Timeval is record
Tv_Sec : Timeval_Unit; Tv_Sec : time_t;
Tv_Usec : Timeval_Unit; Tv_Usec : suseconds_t;
end record; end record;
pragma Convention (C, Timeval); pragma Convention (C, Timeval);
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* * * *
* G E N - S O C C O N * * 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 * * 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- * * terms of the GNU General Public License as published by the Free Soft- *
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
/* This program generates g-soccon.ads */ /* This program generates g-soccon.ads */
/* To build using DEC C: /* To build using DEC C:
CC/DEFINE="TARGET=OpenVMS" gen-soccon CC/DEFINE="TARGET=""OpenVMS""" gen-soccon
LINK gen-soccon LINK gen-soccon
RUN gen-soccon RUN gen-soccon
*/ */
...@@ -37,6 +37,11 @@ ...@@ -37,6 +37,11 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <limits.h>
#ifdef __MINGW32__
#include <fcntl.h>
#endif
#include "gsocket.h" #include "gsocket.h"
...@@ -55,8 +60,8 @@ struct line *first = NULL, *last = NULL; ...@@ -55,8 +60,8 @@ struct line *first = NULL, *last = NULL;
#define _NL TXT("") #define _NL TXT("")
/* Empty line */ /* Empty line */
#define itoad(n) f_itoa ("%d", n) #define itoad(n) f_itoa ("%d", (n))
#define itoax(n) f_itoa ("16#%08x#", n) #define itoax(n) f_itoa ("16#%08x#", (n))
#define CND(name,comment) add_line(#name, itoad (name), comment); #define CND(name,comment) add_line(#name, itoad (name), comment);
/* Constant (decimal) */ /* Constant (decimal) */
...@@ -78,6 +83,10 @@ char *f_itoa (char *, int); ...@@ -78,6 +83,10 @@ char *f_itoa (char *, int);
void add_line (char *, char*, char*); void add_line (char *, char*, char*);
#ifdef __MINGW32__
unsigned int _CRT_fmode = _O_BINARY;
#endif
int int
main (void) { 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 ...@@ -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("-- --")
TXT("-- S p e c --") TXT("-- S p e c --")
TXT("-- --") TXT("-- --")
TXT("-- Copyright (C) 2000-2005 Free Software Foundation, Inc. --") TXT("-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --")
TXT("-- --") TXT("-- --")
TXT("-- GNAT is free software; you can redistribute it and/or modify it under --") 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- --") 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" ...@@ -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("-- by the GNAT.Sockets package (g-socket.ads). This package should not be")
TXT("-- directly with'ed by an applications program.") TXT("-- directly with'ed by an applications program.")
_NL _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("-- 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.") TXT("-- make changes to gen-soccon.c and re-run it on each target.")
_NL _NL
...@@ -565,6 +574,36 @@ _NL ...@@ -565,6 +574,36 @@ _NL
CND(IOV_MAX, "Maximum writev iovcnt") CND(IOV_MAX, "Maximum writev iovcnt")
_NL _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;") TXT("end GNAT.Sockets.Constants;")
output (); output ();
...@@ -614,6 +653,7 @@ f_itoa (char *fmt, int n) { ...@@ -614,6 +653,7 @@ f_itoa (char *fmt, int n) {
void void
add_line (char *_text, char *_value, char *_comment) { add_line (char *_text, char *_value, char *_comment) {
struct line *l = (struct line *) malloc (sizeof (struct line)); struct line *l = (struct line *) malloc (sizeof (struct line));
l->text = _text; l->text = _text;
l->value = _value; l->value = _value;
l->comment = _comment; l->comment = _comment;
......
...@@ -55,6 +55,8 @@ ...@@ -55,6 +55,8 @@
#if defined(__vxworks) #if defined(__vxworks)
#include <vxWorks.h> #include <vxWorks.h>
#include <ioLib.h> #include <ioLib.h>
#include <hostLib.h>
#include <resolvLib.h>
#define SHUT_RD 0 #define SHUT_RD 0
#define SHUT_WR 1 #define SHUT_WR 1
#define SHUT_RDWR 2 #define SHUT_RDWR 2
...@@ -131,7 +133,9 @@ ...@@ -131,7 +133,9 @@
#include <errno.h> #include <errno.h>
#endif #endif
#ifndef __vxworks #ifdef __vxworks
#include <sys/times.h>
#else
#include <sys/time.h> #include <sys/time.h>
#endif #endif
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
/* Required for __gnat_malloc() */ /* Required for __gnat_malloc() */
#include <string.h> #include <string.h>
/* Required for memcpy() */
extern void __gnat_disable_sigpipe (int fd); extern void __gnat_disable_sigpipe (int fd);
extern void __gnat_free_socket_set (fd_set *); extern void __gnat_free_socket_set (fd_set *);
...@@ -49,8 +50,10 @@ extern void __gnat_insert_socket_in_set (fd_set *, int); ...@@ -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 int __gnat_is_socket_in_set (fd_set *, int);
extern fd_set *__gnat_new_socket_set (fd_set *); extern fd_set *__gnat_new_socket_set (fd_set *);
extern void __gnat_remove_socket_from_set (fd_set *, int); 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 */ /* Disable the sending of SIGPIPE for writes on a broken stream */
void void
__gnat_disable_sigpipe (int fd) __gnat_disable_sigpipe (int fd)
{ {
...@@ -152,3 +155,41 @@ __gnat_remove_socket_from_set (fd_set *set, int socket) ...@@ -152,3 +155,41 @@ __gnat_remove_socket_from_set (fd_set *set, int socket)
{ {
FD_CLR (socket, set); 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
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment