Hi there,

I just installed distcc 2.11.1 on a FreeBSD 4.9-RC. I
encountered a puzzling problem where distcc would always fail to
distribute jobs with this error:

distcc[28349] (dcc_pump_sendfile) ERROR: sendfile returned 0? can't cope

This was always the case when distcc was run on any FreeBSD
machine. However, the FreeBSD machines could accept jobs fine
from non-FreeBSD machines. (Namely OS X with a FreeBSD cross
compiler.)

Anyway, the problem is in sys_sendfile() for FreeBSD. If
sendfile() returns -1, errno is EAGAIN, and sent_bytes == 0
(generally due to a full send queue), then sys_sendfile() will
return 0 which is an error to dcc_pump_sendfile().

The fix is simply to return -1 in this case, so that
dcc_pump_sendfile() will select() on the socket/pipe.

I've included a patch that does just this. It now seems to work
fine. (Although I've only done a few test compiles...)

-- 
Allan Saddi                 "The Earth is the cradle of mankind,
[EMAIL PROTECTED]              but we cannot live in the cradle
http://www.saddi.com/allan/  forever." - K.E. Tsiolkovsky

--- src/sendfile.c.orig Tue Jul  8 22:53:08 2003
+++ src/sendfile.c      Wed Oct 22 23:03:12 2003
@@ -94,8 +94,13 @@
     if (ret == -1) {
         /* 
http://cvs.apache.org/viewcvs.cgi/apr/network_io/unix/sendrecv.c?rev=1.95&content-type=text/vnd.viewcvs-markup
 */
         if (errno == EAGAIN) {
-            *offset += sent_bytes;
-            return sent_bytes;
+            if (sent_bytes == 0) {
+                /* Didn't send anything. Return error with errno == EAGAIN. */
+                return -1;
+            } else {
+                *offset += sent_bytes;
+                return sent_bytes;
+            }
         } else {
             return -1;
         }
__ 
distcc mailing list            http://distcc.samba.org/
To unsubscribe or change options: 
http://lists.samba.org/mailman/listinfo/distcc

Reply via email to