Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 May 2008 12:54:46 +0300
From:      Diomidis Spinellis <dds@aueb.gr>
To:        Maxim Sobolev <sobomax@FreeBSD.org>
Cc:        Harti Brandt <harti@FreeBSD.org>, Andriy Gapon <avg@icyb.net.ua>, current@FreeBSD.org
Subject:   Re: cp(1) and mmap
Message-ID:  <483FCEE6.3030608@aueb.gr>
In-Reply-To: <483F3AA2.8000601@FreeBSD.org>
References:  <20080528110003.Q24259@beagle.kn.op.dlr.de>	<483D5DF8.4020504@icyb.net.ua> <483F1559.2020600@aueb.gr> <483F3AA2.8000601@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?483FCEE6.3030608>