Re: [patch] sendfile in fileutils

Andrea Arcangeli (andrea@e-mind.com)
Thu, 17 Dec 1998 23:02:05 +0100 (CET)


On Thu, 17 Dec 1998, Andrea Arcangeli wrote:

>I' ve done a little patch to fileutils to allow me to do zero copy inside
>`cp` and `dd`.

woops, sendfile is not generic enough to cope with devices in /dev/. This
little _incremental_ patch is needed:

--- copy.c~ Thu Dec 17 22:58:13 1998
+++ copy.c Thu Dec 17 22:58:59 1998
@@ -340,17 +340,8 @@
} else /* sendfile */ {
off_t offset = 0;
int retval;
- switch ((retval = sendfile(dest_desc, source_desc, &offset, sb.st_size)))
- {
- case -ENOSYS:
+ if (sendfile(dest_desc, source_desc, &offset, sb.st_size) < 0)
goto no_zero_copy;
- default:
- if (retval < 0)
- {
- error (0, errno, "%s", dst_path);
- return_val = -1;
- }
- }
}
ret:
if (close (dest_desc) < 0)

Andrea Arcangeli

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/