Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Mar 2003 14:38:49 +0200
From:      ianf@za.uu.net
To:        Bruce Evans <bde@zeta.org.au>
Cc:        Peter Pentchev <roam@ringlet.net>, Luigi Rizzo <rizzo@icir.org>, net@FreeBSD.ORG, Tristan Goode <tgoode@iprimus.com.au>
Subject:   Re: write(2) SIGPIPE on a closed socket? 
Message-ID:  <91167.1048077529@wcom.com>
In-Reply-To: Your message of "Wed, 19 Mar 2003 22:44:34 %2B1100." <20030319223311.U8508@gamplex.bde.org> 
References:  <20030319223311.U8508@gamplex.bde.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
Bruce Evans wrote:
> On Wed, 19 Mar 2003, Peter Pentchev wrote:
> 
> > Actually, I wonder if I have answered my own question.  dnscache seems
> > to use poll(2), and it would be poll(2)'s task to notify the program of
> > any exceptional (error) conditions.  I wonder if it is possible that
> > dnscache does not handle POLLERR properly... Let me check.
> 
> Everything in poll() except flags for non-exceptional i/o is defective
> in FreeBSD.  E.g., POLLERR is not ever referenced in `find /sys/ -name
> *.c`, and POLLHUP is only supported for keyboards, ptys, very dead
> ttys (ones with no tty struct but not hung up ones), ordinary pipes
> and revoked fd's.
> 
> write(2) may still fail after poll(2) finds something to write on
> because anything may go away after it is found.

Not always so.  I've found that the act of going away results in
poll() finding something to write on.  I presume your poll flags
would have POLLRDNORM or POLLWRNORM (POLLHUP and POLLERR are checked
anyway) I've understood this to mean not quite what the manual page
suggests "Normal data may be read or written without blocking", but
"a read or write on the file descriptor will not block".  In other
words, your read or write won't block, but may return with an error.

Ian

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?91167.1048077529>