From: kuznet@ms2.inr.ac.ru
To: alex@baretta.COM (Alessandro Baretta)
Cc: linux-kernel@vger.kernel.org
Subject: Re: Inadequate documentation: sockets
Date: Tue, 6 Mar 2001 22:26:38 +0300 (MSK) [thread overview]
Message-ID: <200103061926.WAA23796@ms2.inr.ac.ru> (raw)
In-Reply-To: <3AA52916.5FD87258@baretta.com> from "Alessandro Baretta" at Mar 6, 1 09:45:02 pm
Hello!
> The manual specifies the following flag to be returned by the
> kernel
> > #define POLLHUP 0x0010 /* Hung up */
>
> Hanging up is ambiguous. Does it mean that the client is dead,
> that he closed his end of the socket, or that he shut down one or
> both directions of the data flow? The following man page clears
> this up, but I think the following information would best be
> placed in man poll.
The information is is not quite correct.
POLLHUP is really ambigous in the case of full-duplex connections
with bi-directional close sort of TCP. However, invariants are:
* POLLHUP is set when connection is closed in both directions.
* POLLHUP implies that descriptor is not-writable and any write
will cause error and, probably, SIGPIPE.
* POLLHUP is _not_ set when descriptor is writable (i.e. connection
is shutdowned in write direction by remote)
Standards require that POLLHUP and POLLOUT never happened
together, however linux does this, which is formally bug.
However, it is not fixed, assuming that POLLHUP overrides POLLOUT.
> Finally I'm left with my original problem: how am I supposed to
> detect a close or a shutdown from the peer?
By EOF. No other way exists. POLLHUP is local condition, only
local side can close connection in write direction. Exception
is abort (reset) initiated by peer.
> by addressing me to more adequate documentation.
UNIX98 and Austin draft pages. The are very ambiguous though.
Alexey
next prev parent reply other threads:[~2001-03-06 19:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-03-06 18:14 Alessandro Baretta
2001-03-06 18:34 ` Alan Cox
2001-03-06 17:05 ` Khalid Aziz
2001-03-06 19:26 ` kuznet [this message]
2001-03-06 19:30 ` Alessandro Baretta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200103061926.WAA23796@ms2.inr.ac.ru \
--to=kuznet@ms2.inr.ac.ru \
--cc=alex@baretta.COM \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®