diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-20 12:43:29 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-20 12:43:29 +0000 |
commit | bd75c418e8673f4abce0fe318a9e60a8556bfd8e (patch) | |
tree | d477bc164e38f6d8c8babcee4149043637f10957 /gcc/ada/g-socthi.adb | |
parent | 581f8050f25925435ebe0c41e4f90a1f8606412a (diff) | |
download | gcc-bd75c418e8673f4abce0fe318a9e60a8556bfd8e.tar.gz |
2008-05-20 Thomas Quinot <quinot@adacore.com>
* Makefile.rtl (GNAT.Sockets.Thin_Common): New unit.
* g-sttsne-vxworks.adb: Add missing dependency on Sockets.Constants.
Add missing "with" of Ada.Unchecked_Conversion
* g-soccon-linux-ppc.ads, g-soccon-linux-64.ads, g-soccon-lynxos.ads,
g-soccon-linux-x86.ads, g-soccon-hpux-ia64.ads,
g-soccon-solaris-64.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,
g-socthi-vxworks.adb, g-soccon-freebsd.ads, g-soccon.ads:
Move common code out of GNAT.Sockets.Thin implementations and into
Thin_Common.
New constant SIZEOF_fd_set
New flag Has_Sockaddr_Len
New constants SIZEOF_sockaddr_in, SIZEOF_sockaddr_in6
* g-stsifd-sockets.adb
(Create): Remove call to Set_Length; use Set_Family to set the family
and (on appropriate platforms) length fields in struct sockaddr.
* g-socthi.adb, g-socthi.ads, g-socthi-vms.ads, g-socthi-vms.adb,
g-socthi-mingw.adb, g-socthi-mingw.ads, g-socthi-vxworks.adb,
g-soccon-darwin.ads, g-soccon-darwin.ads: New constant SIZEOF_fd_set
Move common code out of GNAT.Sockets.Thin implementations and into
Thin_Common.
* g-socket.ads, g-socket.adb:
Move common code out of GNAT.Sockets.Thin implementations and into
Thin_Common.
(Connect_Socket, Accept_Socket): Provide new versions of these two
routines that operate with a user specified timeout.
(Bind_Socket, Connect_Socket, Send_Socket): Remove calls to Set_Length,
this is now handled automatically by Set_Family on platforms that
require it.
* gen-soccon.c:
Move common code out of GNAT.Sockets.Thin implementations and into
Thin_Common.
(SIZEOF_sockaddr_in6): On platforms where IPv6 is not supported, define
this constant to 0 (not -1) because we use it to initialize an
unsigned_char value.
Align values for numeric constants only.
Handle the case of systems that do not support AF_INET6.
New constant SIZEOF_fd_set
New flag Has_Sockaddr_Len
New constants SIZEOF_sockaddr_in, SIZEOF_sockaddr_in6
* gsocket.h: New flag Has_Sockaddr_Len
New constants SIZEOF_sockaddr_in, SIZEOF_sockaddr_in6
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@135612 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/g-socthi.adb')
-rw-r--r-- | gcc/ada/g-socthi.adb | 64 |
1 files changed, 7 insertions, 57 deletions
diff --git a/gcc/ada/g-socthi.adb b/gcc/ada/g-socthi.adb index 6ea18f67b47..19642aa893d 100644 --- a/gcc/ada/g-socthi.adb +++ b/gcc/ada/g-socthi.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2007, AdaCore -- +-- Copyright (C) 2001-2008, 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,6 +38,7 @@ -- This is the default version with GNAT.OS_Lib; use GNAT.OS_Lib; +with GNAT.Sockets.Constants; with GNAT.Task_Lock; with Interfaces.C; use Interfaces.C; @@ -45,7 +46,7 @@ with Interfaces.C; use Interfaces.C; package body GNAT.Sockets.Thin is Non_Blocking_Sockets : constant Fd_Set_Access := - New_Socket_Set (No_Socket_Set); + New_Socket_Set (No_Fd_Set_Access); -- When this package is initialized with Process_Blocking_IO set -- to True, sockets are set in non-blocking mode to avoid blocking -- the whole process when a thread wants to perform a blocking IO @@ -199,15 +200,15 @@ package body GNAT.Sockets.Thin is Now : aliased Timeval; begin - WSet := New_Socket_Set (No_Socket_Set); + WSet := New_Socket_Set (No_Fd_Set_Access); loop Insert_Socket_In_Set (WSet, S); Now := Immediat; Res := C_Select (S + 1, - No_Fd_Set, + No_Fd_Set_Access, WSet, - No_Fd_Set, + No_Fd_Set_Access, Now'Unchecked_Access); exit when Res > 0; @@ -228,7 +229,7 @@ package body GNAT.Sockets.Thin is if Res = Failure and then Errno = Constants.EISCONN then - return Thin.Success; + return Thin_Common.Success; else return Res; end if; @@ -427,45 +428,6 @@ package body GNAT.Sockets.Thin is return R; end Non_Blocking_Socket; - ----------------- - -- Set_Address -- - ----------------- - - procedure Set_Address - (Sin : Sockaddr_In_Access; - Address : In_Addr) - is - begin - Sin.Sin_Addr := Address; - end Set_Address; - - ---------------- - -- Set_Family -- - ---------------- - - procedure Set_Family - (Sin : Sockaddr_In_Access; - Family : C.int) - is - begin - Sin.Sin_Family := C.unsigned_short (Family); - end Set_Family; - - ---------------- - -- Set_Length -- - ---------------- - - procedure Set_Length - (Sin : Sockaddr_In_Access; - Len : C.int) - is - pragma Unreferenced (Sin); - pragma Unreferenced (Len); - - begin - null; - end Set_Length; - ----------------------------- -- Set_Non_Blocking_Socket -- ----------------------------- @@ -483,18 +445,6 @@ package body GNAT.Sockets.Thin is Task_Lock.Unlock; end Set_Non_Blocking_Socket; - -------------- - -- Set_Port -- - -------------- - - procedure Set_Port - (Sin : Sockaddr_In_Access; - Port : C.unsigned_short) - is - begin - Sin.Sin_Port := Port; - end Set_Port; - -------------------- -- Signalling_Fds -- -------------------- |