From owner-freebsd-current@FreeBSD.ORG Fri May 30 09:55:18 2008 Return-Path: Delivered-To: current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF5711065672; Fri, 30 May 2008 09:55:18 +0000 (UTC) (envelope-from dds@aueb.gr) Received: from mx-out.forthnet.gr (mx-out.forthnet.gr [193.92.150.104]) by mx1.freebsd.org (Postfix) with ESMTP id 40E518FC1A; Fri, 30 May 2008 09:55:17 +0000 (UTC) (envelope-from dds@aueb.gr) Received: from mx-av-04.forthnet.gr (mx-av.forthnet.gr [193.92.150.27]) by mx-out-04.forthnet.gr (8.14.3/8.14.3) with ESMTP id m4U9tFFQ009952; Fri, 30 May 2008 12:55:15 +0300 Received: from MX-IN-04.forthnet.gr (mx-in-04.forthnet.gr [193.92.150.163]) by mx-av-04.forthnet.gr (8.14.3/8.14.3) with ESMTP id m4U9tFMe001279; Fri, 30 May 2008 12:55:15 +0300 Received: from [192.168.136.22] (adsl164-88.kln.forthnet.gr [62.1.67.88]) by MX-IN-04.forthnet.gr (8.14.3/8.14.3) with ESMTP id m4U9tBfm019804; Fri, 30 May 2008 12:55:12 +0300 Authentication-Results: MX-IN-04.forthnet.gr smtp.mail=dds@aueb.gr; spf=neutral Authentication-Results: MX-IN-04.forthnet.gr header.from=dds@aueb.gr; sender-id=neutral Message-ID: <483FCEE6.3030608@aueb.gr> Date: Fri, 30 May 2008 12:54:46 +0300 From: Diomidis Spinellis User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080313 SeaMonkey/1.1.9 MIME-Version: 1.0 To: Maxim Sobolev References: <20080528110003.Q24259@beagle.kn.op.dlr.de> <483D5DF8.4020504@icyb.net.ua> <483F1559.2020600@aueb.gr> <483F3AA2.8000601@FreeBSD.org> In-Reply-To: <483F3AA2.8000601@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Fri, 30 May 2008 11:08:36 +0000 Cc: Harti Brandt , Andriy Gapon , current@FreeBSD.org Subject: Re: cp(1) and mmap X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 May 2008 09:55:19 -0000 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