Re: How to know write end of FIFO has closed

From: Barry Margolin (barmar_at_alum.mit.edu)
Date: 01/21/05


Date: Thu, 20 Jan 2005 22:50:58 -0500

In article <1106220462.714260.102690@f14g2000cwb.googlegroups.com>,
 sandeep_onsite@yahoo.com wrote:

> Hi,
>
> How to check write end of a FIFO has been closed?
> My problem:
>
> My Linux syslog daemon(syslogd) is sending the syslog messages to a
> FIFO. my application daemon program keeps reading from FIFO using
> blocking read() call.
> When syslogd terminates, read() call always returns 0 bytes, indicating
> EOF. But how do I confirm 0 bytes read was due to syslogd closing the
> write end of the FIFO. Is there any way to check that write end is
> closed.

EOF on a pipe means that the write end was closed.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


Relevant Pages

  • fork process to handle fifo input
    ... has the purpose to collect log entries generated by iptables through ... must collect the log entries coming through the fifo and prepare them ... data from syslog through the fifo as they should. ... that syslog is generating approx 200 entires per second. ...
    (comp.lang.perl.misc)
  • Re: read from a named pipe?
    ... with syslog. ... I suspect that if syslogd gets a sigpipe writing to ... the fifo that it stops writing to that fifo. ... code to simply check for file sizes ) to know when ...
    (comp.lang.perl.misc)
  • Re: How to know write end of FIFO has closed
    ... > How to check write end of a FIFO has been closed? ... > My Linux syslog daemonis sending the syslog messages to a ... man errno ...
    (comp.unix.questions)
  • How to know write end of FIFO has closed
    ... How to check write end of a FIFO has been closed? ... My Linux syslog daemonis sending the syslog messages to a ...
    (comp.unix.questions)
  • Re: select rtns ready;read returns 0
    ... I wonder if the writer is closing the pipe, which, as Barry has ... readreturns 0 then you've reached EOF; ... FIFO you can keep reading and eventually get new data when another ... process opens the FIFO for writing. ...
    (comp.unix.programmer)