From owner-freebsd-hackers@FreeBSD.ORG Sun Nov 9 04:18:37 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0AA2A16A4CE for ; Sun, 9 Nov 2003 04:18:37 -0800 (PST) Received: from park.rambler.ru (park.rambler.ru [81.19.64.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 466F743FE1 for ; Sun, 9 Nov 2003 04:18:35 -0800 (PST) (envelope-from is@rambler-co.ru) Received: from is.park.rambler.ru (is.park.rambler.ru [81.19.64.102]) by park.rambler.ru (8.12.6/8.12.6) with ESMTP id hA9CGtJ6002693; Sun, 9 Nov 2003 15:16:56 +0300 (MSK) (envelope-from is@rambler-co.ru) Date: Sun, 9 Nov 2003 15:16:55 +0300 (MSK) From: Igor Sysoev X-Sender: is@is.park.rambler.ru To: John-Mark Gurney In-Reply-To: <20031109033026.GF558@funkthat.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-hackers@freebsd.org cc: Vivek Pai cc: Alan Cox Subject: Re: Update: Debox sendfile modifications X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Nov 2003 12:18:37 -0000 On Sat, 8 Nov 2003, John-Mark Gurney wrote: > Igor Sysoev wrote this message on Wed, Nov 05, 2003 at 12:31 +0300: > > I think it can done in the following way - a socket should have flag > > that says that sendfile() had started the reading a page. > > layer violation... I do not think that it's layer violation. sendfile() works with descriptor so it should know its state. It should know wheather descriptor is non-blocking or has it enough buffer space. > how do you know that the fd is a socket? fp->f_type == DTYPE_SOCKET > > select()/poll()/kevent() should check this flag before the checking > > a socket buffer space. When the page had been read this flag is reset. > > So, what about using sendfile on a pipe? are you going to teach sendfile > how to interact with pipe's too? What about other fd types? > > If you made this a fd transparent operation then I would agree with > it. The current sendfile() implementation works with sockets only. Well, I agree that such sendfile() implementation is a hack. Nowever this implementation is very usefull in the real world - it allows to minimize a data copy in http and ftp servers. I just could not figure to myself where can be usefull the high perfomance sendfile() to a pipe. I think that it's better to leave sendfile() as a sending to a socket only hack. I believe that any sendfile() generalization (e.g. sending data from a socket to a file) is useless. Igor Sysoev http://sysoev.ru/en/