середа 19 липень 2006 22:50, David G. Lawrence написав: > sendfile() could be extended to allow arbitrary file descriptor types as > the source and destination, but the zero-copy nature of it can only work > in the file to socket direction. This is because network buffers can be > made out of filesystem buffers (file->network direction), but for the > network to file direction network packets arrive non-deterministically. > With the right network hardware it would in theory be possible to have the > TCP code run on the network card and it could DMA the TCP stream directly > into file buffers. If pigs had wings, they could fly. :-)
Ok, so zero-copy may not work, but one-copy would still be better, than the usual two-copy. Am I right? With the usual read/write method, data is read from the network card to kernel's buffers, from there to the application buffer, and from there to the filesystem. That's two copies, no? Having mmap-ed the output file, I could read from the socket directly into the mmap-returned "buffer", but writing via. mmap appears to be implemented pessimally in FreeBSD and breaks horrendously if the output file happens to be accessed via NFS. Thanks! -mi _______________________________________________ freebsd-net@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-net To unsubscribe, send any mail to "[EMAIL PROTECTED]"