cp(1) and mmap
Diomidis Spinellis
dds at aueb.gr
Fri May 30 09:55:19 UTC 2008
Maxim Sobolev wrote:
>> I also think we should use mmap for larger files, mmapping and writing
>> them out in several chunks.
>
> I believe that even better way is to extend sendfile(2) to allow both
> sockets and file descriptors to be used as the destination and use that
> interface instead of mmap/read/write. Linux for example allows that.
Sounds like a good idea. Linux's sendfile documents this behavior:
"sendfile() copies data between one file descriptor and another.",
but then mentions it is not currently implemented:
"Presently (Linux 2.6.9): in_fd, must correspond to a file which
supports mmap()-like operations (i.e., it cannot be a socket); and
out_fd must refer to a socket."
Solaris documents it and supports it:
"The in_fd argument should be a file descriptor to a regular file
opened for reading. See open(2). The out_fd argument should be a file
descriptor to a regular file opened for writing or to a connected
AF_INET or AF_INET6 socket of SOCK_STREAM type."
I will look at it after fixing the more pressing cp(1) bug.
Diomidis
More information about the freebsd-current
mailing list