Subject: Re: kqueue: pipes and EOF
To: None <firstname.lastname@example.org>
From: Christos Zoulas <email@example.com>
Date: 10/07/2004 18:01:22
In article <20041007172517.GA551@cyclonus>,
Christian Biere <current-users@NetBSD.org, firstname.lastname@example.org> wrote:
>I often use a DNS helper process to circument the blocking gethostname()
>and use two pipes to let the processes communicate. I've now modified my
>program to use kqueue() instead of poll() if supported. I've noticed a
>semantic difference between kqueue() and poll() with respect to pipes
>which cannot be wrapped properly, unless I'm missing something. My program
>doesn't monitor whether the child or the parent dies but instead relies on
>poll() to set POLLHUP for the pipe descriptor (both processes are always
>polling for readability) if one of the processes dies. This works fine.
>However, doing the equivalent with kqueue() doesn't cause any event if
>one of the processes dies so that the other one will wait forever.
>Well, of course, there are workarounds like (still) using poll()
>periodically on the pipe descriptor or - what I prefer - using
>kqueue() with EVFILT_PROC and waiting for NOTE_EXIT. Though, this is
>completely unnecessary when using poll(), so I cannot directly wrap
>this but rather have to make this a NOP when using poll().
>Is there any reason why kqueue() doesn't return a EVFILT_READ event
>with EV_EOF set in this case or is this a bug?
Sounds like a bug to me.