On 12/27/05, Thomas Steffen <steffen.list.account@xxxxxxxxx> wrote:
> Dear Ethereal developers
>
> Is there any way to determine (without side effects) that a pipe has
> been closed? Writing to the pipe will give you EPIPE (and SIGPIPE) if
> it is closed, but I cannot find a way to test this without writing
> anything.
can't you handle SIGPIPE?
#in perl
$SIG{PIPE} = sub { reopen_pipe(); write_hdr(); };
> The background is that I am working on a program that receives packet
> from a network connection and forwards them to Etherial via a named
> pipe. I know that Ethereal can read from a named pipe, and it works
> fine. However, after the user restarts capturing in Ethereal, the
> program needs to send a new libpcap header.
>
> I only found two ways to detect a closed end of the named pipe:
> writing to it, and using select on it for reading. Select returns the
> file descriptor ready for reading if the receiving end point is
> closed. But this approach is not reliable, because I have to poll all
> the time. If the writing process is busy, and does not call select at
> the right moment, it can miss the time when the pipe is closed.
>
> Any idea how to "subscribe" to a "pipe closed" event?
>
> Thomas
>
> _______________________________________________
> Ethereal-dev mailing list
> Ethereal-dev@xxxxxxxxxxxx
> http://www.ethereal.com/mailman/listinfo/ethereal-dev
>
--
This information is top security. When you have read it, destroy yourself.
-- Marshall McLuhan