From owner-freebsd-stable@FreeBSD.ORG Wed Jun 3 13:10:55 2009 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B054B1065670 for ; Wed, 3 Jun 2009 13:10:55 +0000 (UTC) (envelope-from dudu@dudu.ro) Received: from mail-fx0-f163.google.com (mail-fx0-f163.google.com [209.85.220.163]) by mx1.freebsd.org (Postfix) with ESMTP id 4CD878FC0A for ; Wed, 3 Jun 2009 13:10:55 +0000 (UTC) (envelope-from dudu@dudu.ro) Received: by fxm7 with SMTP id 7so2653021fxm.43 for ; Wed, 03 Jun 2009 06:10:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.108.74 with SMTP id e10mr550677fap.35.1244034654285; Wed, 03 Jun 2009 06:10:54 -0700 (PDT) In-Reply-To: References: <20090603123208.GK1927@deviant.kiev.zoral.com.ua> From: Vlad Galu Date: Wed, 3 Jun 2009 16:10:34 +0300 Message-ID: To: Kostik Belousov Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-stable@freebsd.org Subject: Re: poll()-ing a pipe descriptor, watching for POLLHUP X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jun 2009 13:10:56 -0000 On Wed, Jun 3, 2009 at 3:35 PM, Vlad Galu wrote: > On Wed, Jun 3, 2009 at 3:32 PM, Kostik Belousov wrote: >> On Wed, Jun 03, 2009 at 03:15:32PM +0300, Vlad Galu wrote: >>> Hello, >>> >>> Please take a look at the attached code. Shouldn't poll() get a >>> POLLHUP event when the child process exits, closing the write end of >>> the pipe? >> >> It seems that you code forgot to close the write end of the pipe in >> parent. Thus, pipe is referenced by another file descriptor from >> the parent process, and you do not get close event. >> > > Aaarhg! You're right! Sorry for the noise! > Hm, I was having an issue with an internal piece of software, but never checked what kind of pipe caused the problem. Turns out it was a FIFO, and I got bitten by the same bug described here: http://lists.freebsd.org/pipermail/freebsd-bugs/2006-March/017591.html The problem is that the reader process isn't notified when the writer process exits or closes the FIFO fd...