delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-0.1 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD |
X-Spam-Check-By: | sourceware.org |
From: | bob 295 <icanprogram AT 295 DOT ca> |
To: | cygwin AT cygwin DOT com |
Subject: | named pipe (fifo) question |
Date: | Tue, 19 Apr 2011 11:01:55 -0400 |
User-Agent: | KMail/1.8.3 |
MIME-Version: | 1.0 |
Message-Id: | <201104191101.55556.icanprogram@295.ca> |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
I'm porting a library from Linux to Cygwin and I've encountered a problem with the behavior of named pipes (fifo's). In my sequence a pair of fifos are opened by each end of the conversation. One is opened as WRONLY, the other as RDWR. Some documentation seems to frown on RDWR pipes. We found that this allows us to trap certain errors when processes on other ends of the pipe vanish. The message exchange sequence is then: For the sender i) open the WRONLY pipe to receiver ii) write an integer on the WRONLY pipe iii) drop into a read on the RDWR pipe (which blocks in Linux) For the receiver i) drop into read on the RDWR pipe (which blocks in Linux) ii) process the message iii) open the WRONLY end of pipe for response iv) write an integer onto the WRONLY pipe back to sender v) close the WRONLY end of pipe The sender leaves the WRONLY pipe open in case another message will be sent. It only closes the file descriptor upon process exit. The receiver opens, writes and closes its WRONLY end on each pass. In Linux this sequence works just fine and has been working in all versions for at least 10 years now. However, on Cygwin it would appear that after the first time the receiver closes the WRONLY end of the sender's pipe, the sender's next read comes back with a 0 (eof) repeatedly without ever blocking. Is this the intended POSIX behavior? Is the problem the RDWR open? Thanks in advance for your help. bob -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |