Re: cp(1) and mmap

From: Diomidis Spinellis <dds_at_aueb.gr>
Date: Fri, 30 May 2008 12:54:46 +0300
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
Received on Fri May 30 2008 - 07:55:18 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:31 UTC