Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Jan 2002 18:14:31 -0800
From:      David Greenman <dg@root.com>
To:        Alfred Perlstein <bright@mu.org>
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>
In-Reply-To: <20020122173051.H13686@elvis.mu.org>; from bright@mu.org on Tue, Jan 22, 2002 at 05:30:51PM -0800
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>

next in thread | previous in thread | raw e-mail | index | archive | help
>* David Greenman <dg@root.com> [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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020122181431.F52101>