Hi all,
I've just installed distcc on
FreeBSD xxx.yyy.ru 7.0-CURRENT-200703 FreeBSD 7.0-CURRENT-200703 #0: Tue
Mar  6 22:35:04 UTC 2007   
[EMAIL PROTECTED]:/usr/obj/usr/src/sys/GENERIC  amd64
and found that sendfile() on it can (and often do) send partial file size.
Seems, that it works some send-algorithm, I didn't find in manual what
is it.

I've attached simple patch to show the problem (and to fix it).
Here the log:
distccd[30529] (dcc_check_client) connection from 212.5.80.7:50383
distccd[30529] compile from entry.cpp to entry.o
distccd[30529] (dcc_pump_readwrite) Notice: need to transmit 872815 bytes
distccd[30529] (dcc_r_file_timed) 872815 bytes received in 0.079618s,
rate 10706kB/s
distccd[30529] (dcc_collect_child) cc times: user 1.507591s, system
0.173373s, 15932 minflt, 0 majflt
distccd[30529] (sys_sendfile) Notice: need to transmit 287352 bytes at
offset 0
distccd[30529] (sys_sendfile) Notice: transmitted 143992 bytes
distccd[30529] (dcc_pump_sendfile) Notice: sendfile: partial
transmission of 143992 bytes; retrying 143360 @143992
distccd[30529] (sys_sendfile) Notice: need to transmit 143360 bytes at
offset 143992
distccd[30529] (sys_sendfile) Notice: transmitted 73096 bytes
distccd[30529] (dcc_pump_sendfile) Notice: sendfile: partial
transmission of 73096 bytes; retrying 70264 @217088
distccd[30529] (sys_sendfile) Notice: need to transmit 70264 bytes at
offset 217088
distccd[30529] (sys_sendfile) Notice: transmitted 36864 bytes
distccd[30529] (dcc_pump_sendfile) Notice: sendfile: partial
transmission of 36864 bytes; retrying 33400 @253952
distccd[30529] (sys_sendfile) Notice: need to transmit 33400 bytes at
offset 253952
distccd[30529] (sys_sendfile) Notice: transmitted 17016 bytes
distccd[30529] (dcc_pump_sendfile) Notice: sendfile: partial
transmission of 17016 bytes; retrying 16384 @270968
distccd[30529] (sys_sendfile) Notice: need to transmit 16384 bytes at
offset 270968
distccd[30529] (sys_sendfile) Notice: transmitted 8824 bytes
distccd[30529] (dcc_pump_sendfile) Notice: sendfile: partial
transmission of 8824 bytes; retrying 7560 @279792
distccd[30529] (sys_sendfile) Notice: need to transmit 7560 bytes at
offset 279792
distccd[30529] (sys_sendfile) Notice: transmitted 4728 bytes
distccd[30529] (dcc_pump_sendfile) Notice: sendfile: partial
transmission of 4728 bytes; retrying 2832 @284520
distccd[30529] (sys_sendfile) Notice: need to transmit 2832 bytes at
offset 284520
distccd[30529] (sys_sendfile) Notice: transmitted 2200 bytes
distccd[30529] (dcc_pump_sendfile) Notice: sendfile: partial
transmission of 2200 bytes; retrying 632 @286720
distccd[30529] (sys_sendfile) Notice: need to transmit 632 bytes at
offset 286720
distccd[30529] (sys_sendfile) Notice: transmitted 632 bytes
distccd[30529] g++ entry.cpp on localhost completed ok
distccd[30529] job complete

--- src.old/sendfile.c	Sun Oct 24 09:05:49 2004
+++ src/sendfile.c	Mon Oct  8 20:35:58 2007
@@ -84,6 +84,7 @@
 #if defined(__FreeBSD__)
 static ssize_t sys_sendfile(int ofd, int ifd, off_t *offset, size_t size)
 {
+    rs_log_notice("need to transmit %ld bytes at offset %ld", size, *offset);
     off_t sent_bytes;
     int ret;
     
@@ -107,8 +108,9 @@
             return -1;
         }
     } else if (ret == 0) {
-        *offset += size;
-        return size;
+        *offset += sent_bytes;
+        rs_log_notice("transmitted %ld bytes", sent_bytes);
+        return sent_bytes;
     } else {
         rs_log_error("don't know how to handle return %d from BSD sendfile",
                      ret);

Attachment: 0x0A74C34A.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature

__ 
distcc mailing list            http://distcc.samba.org/
To unsubscribe or change options: 
https://lists.samba.org/mailman/listinfo/distcc

Reply via email to