[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 22 Sep 2008 11:04:25 +0400
From: Evgeniy Polyakov <johnpol@....mipt.ru>
To: David Miller <davem@...emloft.net>
Cc: johaahn@...il.com, netdev@...r.kernel.org
Subject: Re: [PATCH] sendfile() and UDP socket
On Sun, Sep 21, 2008 at 11:54:44PM -0700, David Miller (davem@...emloft.net) wrote:
> > So effectively you are saying, that sendfile() is just a pure send(),
> > but with diferent arguments? I.e. it is not supposed to send the whole
> > data it points to, but as much as possible according to send() standard?
>
> It already makes this, guess what happens when socket error occurs
> midstream during sendfile(), even for TCP?
>
> First, we return length successfully sent.
>
> User has to retry sendfile() call with remaining length, and at this
> point they will immediately get the socket error return value.
>
> This was broken at one point and I remember applying the fix for this
> several years ago :-)
Well, still tcp errors are completely different from udp ones: the
former ony result in a real problem or interrupt/timeout in the simple
case. UDP adds 'it is too big to be transferred' one. And instead of
just send the previous frame and start new one, we return error so that
user could do the same with additional syscall.
> > Well, it may be a right or wrong decision, and in my opinion sendfile()
> > is very diferent than send() since it should require the whole data to
> > be sent, i.e. being like a loop of send()s, but since sendfile() is
> > effectively a very new approach, it could have different behaviour
> > rules.
>
> It is in fact exactly and precisely like send(). It must even give
> the same error return semantics as other socket data transfer calls
> do. See above.
That's the main difference on how you and me look at sendfile().
> The user has to have a resending loop _anyways_, in order to do
> correct error handling.
>
> Nothing is gained from the proposal, really. It can only harm application
> developers into thinking that segmentation over datagram sockets is not
> their responsibility, when it absolutely is.
Which basically means that sendfile() for udp is exactly send() of the
mapped data. And it is not about segmentation, since packets are
correctly segmented with this proposal: packet is rounded to the
submitted page. This is about optimization compared to send() of the
data. You basically draw a line, that with UDP it is impossible to do.
--
Evgeniy Polyakov
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists