From owner-freebsd-arch Sat Mar 17 8:35:16 2001 Delivered-To: freebsd-arch@freebsd.org Received: from nebula.cybercable.fr (d217.dhcp212-126.cybercable.fr [212.198.126.217]) by hub.freebsd.org (Postfix) with ESMTP id 0F08737B718 for ; Sat, 17 Mar 2001 08:35:12 -0800 (PST) (envelope-from mux@qualys.com) Received: (from mux@localhost) by nebula.cybercable.fr (8.11.3/8.11.3) id f2HGYjf05956; Sat, 17 Mar 2001 17:34:45 +0100 (CET) (envelope-from mux) Date: Sat, 17 Mar 2001 17:34:44 +0100 From: Maxime Henrion To: arch@FreeBSD.org Cc: des@ofug.org Subject: Re: Proposal for a new syscall Message-ID: <20010317173444.B420@nebula.cybercable.fr> References: <20010317164411.A420@nebula.cybercable.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from des@ofug.org on Sat, Mar 17, 2001 at 04:50:16PM +0100 Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Dag-Erling Smorgrav wrote: > Maxime Henrion writes: > > While I was writing a network application, I was thinking that it would > > be nice to have a syscall that could "bind" two file descriptors, of any > > type (socket, file...), a bit like funopen() does in the libc. > You don't seem to understand what funopen() really does... I think I do, since I already used it successfully. Look at how it is used in libfetch (AFAIK, you are the author of libfetch, I'm not sure if you wrote this part though), it's given a read function to read the socket and a write function that will then write this into a file, and this is used to download a file. I would like to do the same thing but with the read/write functions done in the kernel so that it can be optimized, and with any type of fd (not just from a socket to a file, or from a file to a socket like sendfile() does). Something like : int foo(int fdin, int fdout, off_t offset, size_t nbytes); > > Having > > such a syscall in the kernel would allow to implement "zero-copy" > > wherever it is feasible. > No. It would save you two copies and a bunch of syscalls, but it > wouldn't be real zero-copy, just "n-2 copy" instead of "n copy". And if n == 2 ? It sounds like it would definitely be useful anyway, no ? :-) > > Then, sendfile() would just be a particular case of this syscall, where > > the input fd is a file and the output fd is a socket, and it could be > > rewritten using it. > No. Have you looked at the sendfile() code? Probably not enough ; however I don't understand why it wouldn't be possible to write a more generic function than sendfile() dealing with any type of file descriptors that sendfile() could call then. Maxime -- Don't be fooled by cheap finnish imitations ; BSD is the One True Code Key fingerprint = F9B6 1D5A 4963 331C 88FC CA6A AB50 1EF2 8CBE 99D6 Public Key : http://www.epita.fr/~henrio_m/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message