From owner-freebsd-net@FreeBSD.ORG Thu Jul 20 16:59:21 2006 Return-Path: X-Original-To: net@freebsd.org Delivered-To: freebsd-net@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4768D16A4DE for ; Thu, 20 Jul 2006 16:59:20 +0000 (UTC) (envelope-from julian@elischer.org) Received: from a50.ironport.com (a50.ironport.com [63.251.108.112]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7ECDD43D4C for ; Thu, 20 Jul 2006 16:59:20 +0000 (GMT) (envelope-from julian@elischer.org) Received: from unknown (HELO [192.168.2.4]) ([10.251.60.66]) by a50.ironport.com with ESMTP; 20 Jul 2006 09:59:19 -0700 Message-ID: <44BFB667.60106@elischer.org> Date: Thu, 20 Jul 2006 09:59:19 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.13) Gecko/20060414 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "David G. Lawrence" References: <200607192230.14939.mi+mx@aldan.algebra.com> <20060720025003.GF924@tnn.dglawrence.com> In-Reply-To: <20060720025003.GF924@tnn.dglawrence.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: Mikhail Teterin , net@freebsd.org Subject: Re: complement to sendfile()? X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Jul 2006 16:59:21 -0000 David G. Lawrence wrote: >>Hello! >> >>My program receives data from the socket and writes it to a file -- with the >>usual read()/write() tedium. >> >>Is there anything zero-copying like sendfile() for the socket->file direction? >> >>In fact, sendfile's API may allow to use it in any direction, but the manual >>is quite explicit, that the second (destination) argument must be socket. >> >>recvfile()? Thanks! >> >> > > 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. :-) > > We used to do something like this in BSD4.3 (not FreeBSD 4.3) in 1991, but we used a propriatary filesystem and a proprietary protocol that knew each other's data types. >-DG > >David G. Lawrence >President >Download Technologies, Inc. - http://www.downloadtech.com - (866) 399 8500 >The FreeBSD Project - http://www.freebsd.org >Pave the road of life with opportunities. >_______________________________________________ >freebsd-net@freebsd.org mailing list >http://lists.freebsd.org/mailman/listinfo/freebsd-net >To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" > >