This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ada/54010] New: Sockets: C_Recv should restart the call on EINTR
- From: "baldrick at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 18 Jul 2012 08:02:36 +0000
- Subject: [Bug ada/54010] New: Sockets: C_Recv should restart the call on EINTR
- Auto-submitted: auto-generated
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;