Unix questions - How to know write end of FIFO has closed

This is Interesting: Free IT Magazines  
Home > Archive > Unix questions > January 2005 > How to know write end of FIFO has closed





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How to know write end of FIFO has closed
sandeep_onsite@yahoo.com

2005-01-20, 7:54 am

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.

Appreciate any help.

Thanks in advance,
Sandeep

Ian Stirling

2005-01-20, 5:58 pm

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.


man errno
Barry Margolin

2005-01-21, 2:51 am

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 ***
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com