http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54010

             Bug #: 54010
           Summary: Sockets: C_Recv should restart the call on EINTR
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: baldr...@gcc.gnu.org


If an Ada task receives a signal while blocked in a call to C_Recv, for example
called from Receive_Socket, then a SOCKET_ERROR exception is raised with
message
"[4] Interrupted system call".  Instead I think C_Recv should just loop around
and restart the system call when it sees EINTR, rather than exiting with an
error like it does now:

   function C_Recv
     (S     : C.int;
      Msg   : System.Address;
      Len   : C.int;
      Flags : C.int) return C.int
   is
      Res : C.int;

   begin
      loop
         Res := Syscall_Recv (S, Msg, Len, Flags);
         exit when SOSC.Thread_Blocking_IO
           or else Res /= Failure
           or else Non_Blocking_Socket (S)
           or else Errno /= SOSC.EWOULDBLOCK;
         delay Quantum;
      end loop;

      return Res;
   end C_Recv;

Reply via email to