OSDN Git Service

Add NIOS2 support. Code from SourceyG++.
[pf3gnuchains/gcc-fork.git] / gcc / ada / g-socthi.ads
index 8eae6c6..1f103e8 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---                     Copyright (C) 2001-2008, AdaCore                     --
+--                     Copyright (C) 2001-2009, 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- --
@@ -54,6 +54,11 @@ package GNAT.Sockets.Thin is
 
    package C renames Interfaces.C;
 
+   use type C.size_t;
+   type ssize_t is range -(2 ** (C.size_t'Size - 1))
+     .. +(2 ** (C.size_t'Size - 1) - 1);
+   --  Signed type of the same size as size_t
+
    function Socket_Errno return Integer renames GNAT.OS_Lib.Errno;
    --  Returns last socket error number
 
@@ -117,23 +122,15 @@ package GNAT.Sockets.Thin is
       Optval  : System.Address;
       Optlen  : not null access C.int) return C.int;
 
-   function C_Inet_Addr
-     (Cp : C.Strings.chars_ptr) return C.int;
-
-   function C_Ioctl
-     (S    : C.int;
-      Req  : C.int;
-      Arg  : access C.int) return C.int;
+   function Socket_Ioctl
+     (S   : C.int;
+      Req : C.int;
+      Arg : access C.int) return C.int;
 
    function C_Listen
      (S       : C.int;
       Backlog : C.int) return C.int;
 
-   function C_Readv
-     (Fd     : C.int;
-      Iov    : System.Address;
-      Iovcnt : C.int) return C.int;
-
    function C_Recv
      (S     : C.int;
       Msg   : System.Address;
@@ -145,9 +142,14 @@ package GNAT.Sockets.Thin is
       Msg     : System.Address;
       Len     : C.int;
       Flags   : C.int;
-      From    : Sockaddr_In_Access;
+      From    : System.Address;
       Fromlen : not null access C.int) return C.int;
 
+   function C_Recvmsg
+     (S     : C.int;
+      Msg   : System.Address;
+      Flags : C.int) return ssize_t;
+
    function C_Select
      (Nfds      : C.int;
       Readfds   : access Fd_Set;
@@ -155,18 +157,17 @@ package GNAT.Sockets.Thin is
       Exceptfds : access Fd_Set;
       Timeout   : Timeval_Access) return C.int;
 
-   function C_Send
+   function C_Sendmsg
      (S     : C.int;
       Msg   : System.Address;
-      Len   : C.int;
-      Flags : C.int) return C.int;
+      Flags : C.int) return ssize_t;
 
    function C_Sendto
      (S     : C.int;
       Msg   : System.Address;
       Len   : C.int;
       Flags : C.int;
-      To    : Sockaddr_In_Access;
+      To    : System.Address;
       Tolen : C.int) return C.int;
 
    function C_Setsockopt
@@ -185,17 +186,9 @@ package GNAT.Sockets.Thin is
       Typ      : C.int;
       Protocol : C.int) return C.int;
 
-   function C_Strerror
-     (Errnum : C.int) return C.Strings.chars_ptr;
-
    function C_System
      (Command : System.Address) return C.int;
 
-   function C_Writev
-     (Fd     : C.int;
-      Iov    : System.Address;
-      Iovcnt : C.int) return C.int;
-
    -------------------------------------------------------
    -- Signalling file descriptors for selector abortion --
    -------------------------------------------------------
@@ -257,15 +250,11 @@ private
    pragma Import (C, C_Getpeername, "getpeername");
    pragma Import (C, C_Getsockname, "getsockname");
    pragma Import (C, C_Getsockopt, "getsockopt");
-   pragma Import (C, C_Inet_Addr, "inet_addr");
    pragma Import (C, C_Listen, "listen");
-   pragma Import (C, C_Readv, "readv");
    pragma Import (C, C_Select, "select");
    pragma Import (C, C_Setsockopt, "setsockopt");
    pragma Import (C, C_Shutdown, "shutdown");
-   pragma Import (C, C_Strerror, "strerror");
    pragma Import (C, C_System, "system");
-   pragma Import (C, C_Writev, "writev");
 
    pragma Import (C, Nonreentrant_Gethostbyname, "gethostbyname");
    pragma Import (C, Nonreentrant_Gethostbyaddr, "gethostbyaddr");