Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Jun 2009 16:10:34 +0300
From:      Vlad Galu <dudu@dudu.ro>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: poll()-ing a pipe descriptor, watching for POLLHUP
Message-ID:  <ad79ad6b0906030610y7e3beb05w5a3a39eaf7ebe2be@mail.gmail.com>
In-Reply-To: <ad79ad6b0906030535o4b1a959ev6bc2b34af4e7304e@mail.gmail.com>
References:  <ad79ad6b0906030515k2e41f4b9t25f752af8ef3866c@mail.gmail.com>  <20090603123208.GK1927@deviant.kiev.zoral.com.ua> <ad79ad6b0906030535o4b1a959ev6bc2b34af4e7304e@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jun 3, 2009 at 3:35 PM, Vlad Galu <dudu@dudu.ro> wrote:
> On Wed, Jun 3, 2009 at 3:32 PM, Kostik Belousov <kostikbel@gmail.com> 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...



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