On Wed, Apr 26, 2000 at 11:18:33PM +0200, Andi Kleen wrote:
> On Wed, Apr 26, 2000 at 04:55:38PM -0400, David Shaw wrote:
> > On Wed, Apr 26, 2000 at 10:38:41PM +0200, Andi Kleen wrote:
> > > On Wed, Apr 26, 2000 at 04:19:55PM -0400, David Shaw wrote:
> > > > Hi,
> > > >
> > > > Run the attached program under 2.0.36 and you get:
> > > > Setting socket receive buffer size to 1024
> > > > The socket receive buffer size was set to 1024
> > > >
> > > > Run it under 2.2.14 and you get:
> > > > Setting socket receive buffer size to 1024
> > > > The socket receive buffer size was set to 2048
> > > >
> > > > The code in question (/usr/src/linux/net/core/sock.c) seems to be very
> > > > clear - it doubles the value.
> > > >
> > > > What do you think - bug? Intentional? Other?
> > >
> > > Intentional.
> >
> > Ah. So if I want a buffer size of X should I ask for X/2, or should I
> > continue to ask for X?
> >
> > What was the intention behind the change?
>
> BSD compatibility. BSD does not account internal metadata, Linux assumes
> half of the buffer will be taken up for it. If the real value was used
> BSD applications would only get half the buffer they need.
Sounds reasonable. The only thing is, why doesn't getsockopt return
the "right" (i.e. internal value divided by 2) answer. After all,
from the program's perspective that IS what the value is. Principle
of least surprise, and all that.
This exposes internal kernel stuff to the user and may make them do
the wrong thing. For example, if a program tried to base internal
functionality on the buffer size it would do the wrong thing under
linux 2.2.
David
--
David Shaw | Chief Architect, Streaming Systems | Akamai Technologies
+---------------------------------------------------------------------------+
[EMAIL PROTECTED] | 617-250-3028 | http://www.jabberwocky.com/
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]