lkml.org 
[lkml]   [1998]   [Dec]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: select() on FIFOs
Date
Open the fifo in Read/Write mode (O_RDWR).  This will work around the
problem as a reader will always exist for your fifo. The problem is that
once the first reader closes the fifo your read handle of the fifo is set to
readonly.

-----Original Message-----
From: Martynas Kunigelis <mkunigelis@alna.lt>
To: linux-kernel@vger.rutgers.edu <linux-kernel@vger.rutgers.edu>
Date: Thursday, December 24, 1998 9:43 AM
Subject: select() on FIFOs


>Hello,
>
>I am trying to write a pseudo client/server program, where clients talk
>to the server through a named pipe. In the server, I intended to have
>the FIFO open in O_NONBLOCK mode, and then use select() to check when
>there's data to read. However, when a client opens the communication
>FIFO, writes some data to it and then closes it, all subsequent select()
>calls in the server return, saying that there is data to read in the
>FIFO. However, there's no data to read, and the server gets stuck in a
>loop:
>
> select() returns 1
> read() returns 0
>
>What is the correct solution? I can get it to work having the server
>open() and close() the FIFO in blocking mode for each session, but this
>does not appeal to me. I wish a had the Stevens book... :) (Ah, and
>input multiplexing is not a problem as the clients will never write to
>the FIFO concurrently).
>
>Please CC: me on all replies, as I'm not subscribed to the list.
>Thanks in advance and merry Christmas to everyone!
>
>-Martynas
>
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to majordomo@vger.rutgers.edu
>Please read the FAQ at http://www.tux.org/lkml/
>



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:46    [W:0.072 / U:0.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site