Re: socket: setting SO_SNDBUF

From: Reto Baettig (baettig@scs.ch)
Date: Wed May 10 2000 - 19:55:00 EST


David Schwartz wrote:
>
> The Linux operating system stores more in those buffers than other
> operating systems do. So if we just passed along the size unmodified, people
> would wind up with, effectively, smaller buffers than they expected.
>
> DS
>
> > hi,
> >
> > I do not understand why setting SO_SNDBUF with
> >
> > res = BUFSIZE;
> > err = setsockopt(s, SOL_SOCKET, SO_SNDBUF, &res, len);
> >
> > actually sets the buffer size to 2*BUFSIZE. What is the reason for that?
> >
> > The corresponding code fragment is in sock.c, int sock_setsockopt(...

... so then we should maybe change sock_getsockopt to:

                case SO_SNDBUF:
                        v.val=sk->sndbuf/2;
                        break;

                case SO_RCVBUF:
                        v.val =sk->rcvbuf/2;
                        break;

because I would expect following behaviour:

        err = getsockopt(s, SOL_SOCKET, SO_SNDBUF, &res1, &len);
        err = setsockopt(s, SOL_SOCKET, SO_SNDBUF, &res1, len);
        err = getsockopt(s, SOL_SOCKET, SO_SNDBUF, &res2, &len);

        after that sequence, res1 should be == res2 !

Am I totally wrong?

Reto

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon May 15 2000 - 21:00:17 EST