This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ada/54010] New: Sockets: C_Recv should restart the call on EINTR


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: unassigned@gcc.gnu.org
        ReportedBy: baldrick@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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]