diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-06 09:15:09 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-06 09:15:09 +0000 |
commit | 232e4d04f0263022b1379a7886e28e7f082f7eb8 (patch) | |
tree | d2a9f2de1b4f8ce5a655a929362077213fa220da /gcc/ada/g-socthi-vms.ads | |
parent | 32c07c22100b9a6f342e6a5825ac36b1b72d036b (diff) | |
download | gcc-232e4d04f0263022b1379a7886e28e7f082f7eb8.tar.gz |
2007-04-06 Thomas Quinot <quinot@adacore.com>
Pat Rogers <rogers@adacore.com>
Pascal Obry <obry@adacore.com>
* g-stsifd-sockets.adb: New file.
* g-socthi.ads, g-socket.adb, g-socthi-vxworks.adb,
g-socthi-vxworks.ads, g-socthi-mingw.ads, g-socthi-vms.ads,
g-socthi-vms.adb: Move signalling
fd management to a nested package, so that they can conveniently be
moved to a subunit that is shared across Windows, VMS, and VxWorks
(Ada implementation) or completed with imported bodies from socket.c
(UNIX case).
(Read_Signalling_Fd, Write_Signalling_Fd, Create_Signalling_Fds): New
subprograms.
(Check_Selector): Use Read_Signalling_Fd to read and discard data from
the signalling file descriptor.
(Abort_Selector): Use Write_Signalling_Fd to write dummy data to the
signalling file descriptor.
(Create_Selector): Use new C-imported subprogram Create_Signalling_Fds
instead of creating a pair of sockets for signalling here.
* g-socthi.adb: Ditto.
Set the runtime process to ignore SIGPIPEs on platforms that support
neither SO_NOSIGPIPE nor MSG_NOSIGNAL functionality.
* g-socthi-mingw.adb: Ditto.
(WS_Version): Use Windows 2.2.
Use Winsock 2.2 (instead of 1.1) for the GNAT.Socket API.
* g-soliop-mingw.ads: Link with ws2_32 for Windows 2.x support.
Use Winsock 2.2 (instead of 1.1) for the GNAT.Socket API.
* Makefile.in: New libgnat pair g-stsifd.adb<g-stsifd-sockets.adb.
added GNAT byte swapping facility
Update FreeBSD THREADSLIB from -lc_r to -lpthread, for FreeBSD 6.
* g-bytswa.adb, g-bytswa-x86.adb, g-bytswa.ads: New files.
* socket.c (__gnat_read_signalling_fd, __gnat_write_controlling_fd):
New subprograms.
(__gnat_create_signalling_fds): New subprogram.
Set the runtime process to ignore SIGPIPEs on platforms that support
neither SO_NOSIGPIPE nor MSG_NOSIGNAL functionality.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123542 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/g-socthi-vms.ads')
-rw-r--r-- | gcc/ada/g-socthi-vms.ads | 87 |
1 files changed, 61 insertions, 26 deletions
diff --git a/gcc/ada/g-socthi-vms.ads b/gcc/ada/g-socthi-vms.ads index 1b05e4719bc..c1bd1164371 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, AdaCore -- +-- Copyright (C) 2002-2006, 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- -- @@ -38,8 +38,8 @@ -- This is the Alpha/VMS version with Interfaces.C.Pointers; - with Interfaces.C.Strings; + with GNAT.Sockets.Constants; with GNAT.OS_Lib; @@ -60,9 +60,12 @@ package GNAT.Sockets.Thin is function Socket_Errno return Integer renames GNAT.OS_Lib.Errno; -- Returns last socket error number + procedure Set_Socket_Errno (Errno : Integer) renames GNAT.OS_Lib.Set_Errno; + -- Set last socket error number + function Socket_Error_Message (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". + -- 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"); @@ -165,8 +168,8 @@ package GNAT.Sockets.Thin is -- Set Sin.Sin_Family to Family procedure Set_Port - (Sin : Sockaddr_In_Access; - Port : C.unsigned_short); + (Sin : Sockaddr_In_Access; + Port : C.unsigned_short); pragma Inline (Set_Port); -- Set Sin.Sin_Port to Port @@ -203,14 +206,24 @@ package GNAT.Sockets.Thin is pragma Convention (C, Servent_Access); -- Access to service entry - type Two_Int is array (0 .. 1) of C.int; - pragma Convention (C, Two_Int); - -- Used with pipe() + type Two_Ints is array (0 .. 1) of C.int; + pragma Convention (C, Two_Ints); + -- Container for two int values + + subtype Fd_Pair is Two_Ints; + -- Two_Ints as used for Create_Signalling_Fds: a pair of connected file + -- descriptors, one of which (the "read end" of the connection) being used + -- for reading, the other one (the "write end") being used for writing. + + Read_End : constant := 0; + Write_End : constant := 1; + -- Indices into an Fd_Pair value providing access to each of the connected + -- file descriptors. function C_Accept (S : C.int; Addr : System.Address; - Addrlen : access C.int) return C.int; + Addrlen : not null access C.int) return C.int; function C_Bind (S : C.int; @@ -240,7 +253,7 @@ package GNAT.Sockets.Thin is function C_Getpeername (S : C.int; Name : System.Address; - Namelen : access C.int) return C.int; + Namelen : not null access C.int) return C.int; function C_Getservbyname (Name : C.char_array; @@ -253,24 +266,26 @@ package GNAT.Sockets.Thin is function C_Getsockname (S : C.int; Name : System.Address; - Namelen : access C.int) return C.int; + Namelen : not null 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 : not null 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; - function C_Listen (S, Backlog : C.int) return C.int; + function C_Listen + (S : C.int; + Backlog : C.int) return C.int; function C_Readv (Fd : C.int; @@ -289,7 +304,7 @@ package GNAT.Sockets.Thin is Len : C.int; Flags : C.int; From : Sockaddr_In_Access; - Fromlen : access C.int) return C.int; + Fromlen : not null access C.int) return C.int; function C_Select (Nfds : C.int; @@ -320,8 +335,8 @@ package GNAT.Sockets.Thin is 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; @@ -339,6 +354,25 @@ package GNAT.Sockets.Thin is Iov : System.Address; Iovcnt : C.int) return C.int; + package Signalling_Fds is + + function Create (Fds : not null access Fd_Pair) return C.int; + pragma Convention (C, Create); + -- Create a pair of connected descriptors suitable for use with C_Select + -- (used for signalling in Selector objects). + + function Read (Rsig : C.int) return C.int; + pragma Convention (C, Read); + -- Read one byte of data from rsig, the read end of a pair of signalling + -- fds created by Create_Signalling_Fds. + + function Write (Wsig : C.int) return C.int; + pragma Convention (C, Write); + -- Write one byte of data to wsig, the write end of a pair of signalling + -- fds created by Create_Signalling_Fds. + + end Signalling_Fds; + procedure Free_Socket_Set (Set : Fd_Set_Access); -- Free system-dependent socket set @@ -367,17 +401,17 @@ package GNAT.Sockets.Thin is procedure Last_Socket_In_Set (Set : Fd_Set_Access; Last : Int_Access); - -- Find the largest socket in the socket set. This is needed for - -- select(). When Last_Socket_In_Set is called, parameter Last is - -- a maximum value of the largest socket. This hint is used to - -- avoid scanning very large socket sets. After the call, Last is - -- set back to the real largest socket in the socket set. + -- Find the largest socket in the socket set. This is needed for select(). + -- When Last_Socket_In_Set is called, parameter Last is a maximum value of + -- the largest socket. This hint is used to avoid scanning very large + -- socket sets. After the call, Last is set back to the real largest socket + -- in the socket set. function New_Socket_Set (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. + -- 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. procedure Remove_Socket_From_Set (Set : Fd_Set_Access; @@ -414,4 +448,5 @@ private pragma Import (C, New_Socket_Set, "__gnat_new_socket_set"); pragma Import (C, Insert_Socket_In_Set, "__gnat_insert_socket_in_set"); pragma Import (C, Remove_Socket_From_Set, "__gnat_remove_socket_from_set"); + end GNAT.Sockets.Thin; |