OSDN Git Service

2007-09-26 Thomas Quinot <quinot@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / g-socthi-vxworks.ads
index 6e598b7..3e006a7 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---                     Copyright (C) 2002-2006, AdaCore                     --
+--                     Copyright (C) 2002-2007, 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- --
@@ -42,8 +42,8 @@ with Interfaces.C.Strings;
 
 with Ada.Unchecked_Conversion;
 
-with GNAT.Sockets.Constants;
 with GNAT.OS_Lib;
+with GNAT.Sockets.Constants;
 
 with System;
 
@@ -65,12 +65,21 @@ package GNAT.Sockets.Thin is
 
    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".
+   --  not known, returns "Unknown system error".
 
    function Host_Errno return Integer;
    pragma Import (C, Host_Errno, "__gnat_get_h_errno");
    --  Returns last host error number
 
+   package Host_Error_Messages is
+
+      function Host_Error_Message
+        (H_Errno : Integer) return C.Strings.chars_ptr;
+      --  Returns the error message string for the host error number H_Errno.
+      --  If H_Errno is not known, returns "Unknown system error".
+
+   end Host_Error_Messages;
+
    subtype Fd_Set_Access is System.Address;
    No_Fd_Set : constant Fd_Set_Access := System.Null_Address;
 
@@ -112,8 +121,11 @@ package GNAT.Sockets.Thin is
    type In_Addr is record
       S_B1, S_B2, S_B3, S_B4 : C.unsigned_char;
    end record;
+   for In_Addr'Alignment use C.int'Alignment;
    pragma Convention (C, In_Addr);
-   --  Internet address
+   --  IPv4 address, represented as a network-order C.int. Note that the
+   --  underlying operating system may assume that values of this type have
+   --  C.int alignment, so we need to provide a suitable alignment clause here.
 
    function To_In_Addr is new Ada.Unchecked_Conversion (C.int, In_Addr);
 
@@ -223,6 +235,10 @@ package GNAT.Sockets.Thin is
    --  Indices into an Fd_Pair value providing access to each of the connected
    --  file descriptors.
 
+   --------------------------------
+   -- Standard library functions --
+   --------------------------------
+
    function C_Accept
      (S       : C.int;
       Addr    : System.Address;
@@ -241,14 +257,6 @@ package GNAT.Sockets.Thin is
       Name    : System.Address;
       Namelen : C.int) return C.int;
 
-   function C_Gethostbyaddr
-     (Addr : System.Address;
-      Len  : C.int;
-      Typ  : C.int) return Hostent_Access;
-
-   function C_Gethostbyname
-     (Name : C.char_array) return Hostent_Access;
-
    function C_Gethostname
      (Name    : System.Address;
       Namelen : C.int) return C.int;
@@ -258,14 +266,6 @@ package GNAT.Sockets.Thin is
       Name    : System.Address;
       Namelen : not null access C.int) return C.int;
 
-   function C_Getservbyname
-     (Name  : C.char_array;
-      Proto : C.char_array) return Servent_Access;
-
-   function C_Getservbyport
-     (Port  : C.int;
-      Proto : C.char_array) return Servent_Access;
-
    function C_Getsockname
      (S       : C.int;
       Name    : System.Address;
@@ -357,6 +357,10 @@ package GNAT.Sockets.Thin is
       Iov    : System.Address;
       Iovcnt : C.int) return C.int;
 
+   -------------------------------------------------------
+   -- Signalling file descriptors for selector abortion --
+   -------------------------------------------------------
+
    package Signalling_Fds is
 
       function Create (Fds : not null access Fd_Pair) return C.int;
@@ -374,8 +378,16 @@ package GNAT.Sockets.Thin is
       --  Write one byte of data to wsig, the write end of a pair of signalling
       --  fds created by Create_Signalling_Fds.
 
+      procedure Close (Sig : C.int);
+      pragma Convention (C, Close);
+      --  Close one end of a pair of signalling fds (ignoring any error)
+
    end Signalling_Fds;
 
+   ----------------------------
+   -- Socket sets management --
+   ----------------------------
+
    procedure Free_Socket_Set
      (Set : Fd_Set_Access);
    --  Free system-dependent socket set
@@ -384,11 +396,11 @@ package GNAT.Sockets.Thin is
      (Set    : Fd_Set_Access;
       Socket : Int_Access;
       Last   : Int_Access);
-   --  Get last socket in Socket and remove it from the socket
-   --  set. The parameter Last is a maximum value of the largest
-   --  socket. This hint is used to avoid scanning very large socket
-   --  sets. After a call to Get_Socket_From_Set, Last is set back to
-   --  the real largest socket in the socket set.
+   --  Get last socket in Socket and remove it from the socket set. The
+   --  parameter Last is a maximum value of the largest socket. This hint is
+   --  used to avoid scanning very large socket sets. After a call to
+   --  Get_Socket_From_Set, Last is set back to the real largest socket in the
+   --  socket set.
 
    procedure Insert_Socket_In_Set
      (Set    : Fd_Set_Access;
@@ -421,8 +433,8 @@ package GNAT.Sockets.Thin is
       Socket : C.int);
    --  Remove socket from the socket set
 
+   procedure Initialize;
    procedure Finalize;
-   procedure Initialize (Process_Blocking_IO : Boolean);
 
 private
    pragma Import (C, C_Bind, "bind");