From owner-freebsd-net Wed Mar 19 4:39:38 2003 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 63D6937B404 for ; Wed, 19 Mar 2003 04:39:36 -0800 (PST) Received: from mailspool.ops.uunet.co.za (mailspool.ops.uunet.co.za [196.7.0.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id C464943F93 for ; Wed, 19 Mar 2003 04:39:34 -0800 (PST) (envelope-from ianf@wcom.com) Received: from copernicus.so.cpt1.za.uu.net ([196.30.72.32]) by mailspool.ops.uunet.co.za with esmtp (Exim 3.36 #1) id 18vcqb-000HZj-00; Wed, 19 Mar 2003 14:39:09 +0200 Received: from localhost ([127.0.0.1] helo=wcom.com) by copernicus.so.cpt1.za.uu.net with esmtp (Exim 3.36 #1) id 18vcqH-000NiS-00; Wed, 19 Mar 2003 14:38:49 +0200 To: Bruce Evans Cc: Peter Pentchev , Luigi Rizzo , net@FreeBSD.ORG, Tristan Goode Subject: Re: write(2) SIGPIPE on a closed socket? In-reply-to: Your message of "Wed, 19 Mar 2003 22:44:34 +1100." <20030319223311.U8508@gamplex.bde.org> References: <20030319223311.U8508@gamplex.bde.org> From: ianf@za.uu.net X-image-url: http://www.digs.iafrica.com/gallery/ian-small.gif X-BOFH: true X-LART: Depleted uranium X-No-Junk-Mail: I do not want to get *any* junk mail. You have been deleted Date: Wed, 19 Mar 2003 14:38:49 +0200 Message-ID: <91167.1048077529@wcom.com> Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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