From owner-cvs-all Tue Jan 22 18:27: 8 2002 Delivered-To: cvs-all@freebsd.org Received: from root.com (root.com [209.102.106.178]) by hub.freebsd.org (Postfix) with ESMTP id 3AC8E37B400; Tue, 22 Jan 2002 18:26:59 -0800 (PST) Received: (from dg@localhost) by root.com (8.11.2/8.11.2) id g0N2EV053505; Tue, 22 Jan 2002 18:14:31 -0800 (PST) (envelope-from dg) Date: Tue, 22 Jan 2002 18:14:31 -0800 From: David Greenman To: Alfred Perlstein Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/kern uipc_syscalls.c Message-ID: <20020122181431.F52101@nexus.root.com> References: <200201221732.g0MHWAR50160@freefall.freebsd.org> <20020122104431.X13686@elvis.mu.org> <20020122120048.B50580@nexus.root.com> <20020122124129.E13686@elvis.mu.org> <20020122140113.A52101@nexus.root.com> <20020122173051.H13686@elvis.mu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020122173051.H13686@elvis.mu.org>; from bright@mu.org on Tue, Jan 22, 2002 at 05:30:51PM -0800 Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG >* David Greenman [020122 14:14] wrote: >> > >> >AH! I didn't consider this... but... did it block while sending >> >the entire file... or when sending the trailers? :) >> >> It doesn't matter where it would have blocked. All the application cares >> about is if it is done with everything. >> >> >It seems like returning EAGAIN is correct, but the application would >> >need to stat(2) the file to find out at that point if utilizing >> >trailers? >> >> No. It doesn't need to know that. > >Ok, maybe I'm being dense, but... > >you input: > 100 bytes of trailers, 200 byte file and 100 bytes of trailers, nbytes is 0. >you get back: > ret = -1, errno = EAGAIN, sbytes = 150 > >since you never stat(2)'d the file to begin with (to get the size) >how do you know what to do now without stat(2)'ing it now? Not >that this is a problem, but I'm curious as to how you would avoid >it. You would know that the headers were sent, but I guess you wouldn't know how much of the file was sent unless you stat'd it first -or- you didn't have any trailers. The no trailers case is actually very likely, so in that case you'd know that 50 bytes of the file was sent, so you'd spec an offset of 50 with nbytes = 0 in the next call to sendfile(). I actually haven't found an application yet that uses trailers. -DG David Greenman Co-founder, The FreeBSD Project - http://www.freebsd.org President, TeraSolutions, Inc. - http://www.terasolutions.com President, Download Technologies, Inc. - http://www.downloadtech.com Pave the road of life with opportunities. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message