2001-02-11 18:39:17

by Chris Evans

[permalink] [raw]
Subject: BUG: SO_LINGER + shutdown() does not block?


Hi,

>From socket(7):

SO_LINGER
...
When enabled, a close(2) or shutdown(2) will not
return until all queued messages for the socket
have been successfully sent or the linger timeout
has been reached.

I'm not seeing shutdown(2) block on a TCP socket. This is Linux kernel
2.2.16 (RH7.0). Is this a kernel bug, a documentation bug, or does it all
work fine and it's a Chris bug?

Cheers
Chris


2001-02-11 20:22:32

by Alexey Kuznetsov

[permalink] [raw]
Subject: Re: BUG: SO_LINGER + shutdown() does not block?

Hello!

> I'm not seeing shutdown(2) block on a TCP socket. This is Linux kernel
> 2.2.16 (RH7.0). Is this a kernel bug, a documentation bug,

Man page is wrong.

What's about kernel... Hmm, actually, it is worth to test genuine bsd.
Such feature could be useful.

Alexey

2001-02-11 20:41:32

by Chris Evans

[permalink] [raw]
Subject: Re: BUG: SO_LINGER + shutdown() does not block?


[cc: Andi]

On Sun, 11 Feb 2001 [email protected] wrote:

> Hello!
>
> > I'm not seeing shutdown(2) block on a TCP socket. This is Linux kernel
> > 2.2.16 (RH7.0). Is this a kernel bug, a documentation bug,
>
> Man page is wrong.

Yes, man socket(7) seems to be wrong.

I don't have access to a genuine BSD at the moment, but from man pages:
- HP/UX specifically states that SO_LINGER has no effect on shutdown()
- Solaris SO_LINGER only mentions that close() is affected.
- Likewise FreeBSD

Cheers
Chris

2001-02-11 20:52:37

by Andi Kleen

[permalink] [raw]
Subject: Re: BUG: SO_LINGER + shutdown() does not block?

On Sun, Feb 11, 2001 at 08:41:04PM +0000, Chris Evans wrote:
>
> [cc: Andi]

Missing context..

>
> On Sun, 11 Feb 2001 [email protected] wrote:
>
> > Hello!
> >
> > > I'm not seeing shutdown(2) block on a TCP socket. This is Linux kernel
> > > 2.2.16 (RH7.0). Is this a kernel bug, a documentation bug,
> >
> > Man page is wrong.
>
> Yes, man socket(7) seems to be wrong.

What do you exactly think is wrong?


-Andi

2001-02-11 21:05:39

by Chris Evans

[permalink] [raw]
Subject: Re: BUG: SO_LINGER + shutdown() does not block?


On Sun, 11 Feb 2001, Andi Kleen wrote:

> On Sun, Feb 11, 2001 at 08:41:04PM +0000, Chris Evans wrote:
> >
> > [cc: Andi]
>
> Missing context..

[...]

> What do you exactly think is wrong?

man socket(7) says that setting SO_LINGER on a socket will make shutdown()
and close() block. That's incorrect; only close() blocks.

Sorry for the missing context.

Cheers
Chris

2001-02-11 21:08:49

by Andi Kleen

[permalink] [raw]
Subject: Re: BUG: SO_LINGER + shutdown() does not block?

On Sun, Feb 11, 2001 at 09:05:07PM +0000, Chris Evans wrote:
>
> On Sun, 11 Feb 2001, Andi Kleen wrote:
>
> > On Sun, Feb 11, 2001 at 08:41:04PM +0000, Chris Evans wrote:
> > >
> > > [cc: Andi]
> >
> > Missing context..
>
> [...]
>
> > What do you exactly think is wrong?
>
> man socket(7) says that setting SO_LINGER on a socket will make shutdown()
> and close() block. That's incorrect; only close() blocks.

Ok, fixed. Thanks.

-Andi