X-Spam-Check-By: sourceware.org Date: Sat, 16 Sep 2006 11:02:01 +0000 (GMT) From: Holger Kiehl To: Dave Korn Cc: cygwin AT cygwin DOT com Subject: Re: RE: 1.5.21: Problems with fifos In-Reply-To: <02b801c6d0cc$b26272e0$a501a8c0@CAM.ARTIMI.COM> Message-ID: References: <02b801c6d0cc$b26272e0$a501a8c0 AT CAM DOT ARTIMI DOT COM> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="646810922-300355867-1158404521=:27295" X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com --646810922-300355867-1158404521=:27295 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed On Tue, 5 Sep 2006, Dave Korn wrote: > On 05 September 2006 09:39, Holger Kiehl wrote: > >> >> Attached I have the cygcheck.out file. Please tell me if I forget to mention >> any information that could be usefull or what I can do to solve this. > > The single most valuable thing you could do would be try and extract a > simple testcase that demonstrates the problem. AFD is a huge project and > there may be many confounding factors; if you can write a little > self-contained program that opens and uses fifos in the same fashion as AFD > and shows the same effects, the problem would be a lot more tractable. > I have managed to write a little test program that shows that the fifos do not work as I expected it. The attached program can be compiled simply by 'cc fifot.c'. When called without any argument it opens the fifo fifot.fifo and does a select on it to wait for some data to arrive. When called with an argument it opens the fifo for writting and writes "Hallo Ballo!". Calling this program under cygwin as follows: ./a.exe 1 will cause it to block. Under linux it does not block and I would expect under any other unix like system it will not block either (which I have not tested). My understanding of fifos was that when I open a fifo for both reading and writting, I could write to a fifo without it blocking. Is cygwin handling fifos correct here and my understanding wrong? Regards, Holger --646810922-300355867-1158404521=:27295 Content-Type: TEXT/PLAIN; charset=US-ASCII; name=fifot.c Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename=fifot.c I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8c3RyaW5nLmg+DQojaW5j bHVkZSA8c3lzL3R5cGVzLmg+DQojaW5jbHVkZSA8c3lzL3N0YXQuaD4NCiNp bmNsdWRlIDx1bmlzdGQuaD4NCiNpbmNsdWRlIDxmY250bC5oPg0KI2luY2x1 ZGUgPGVycm5vLmg+DQoNCiNkZWZpbmUgRklGT1RfTkFNRSAgImZpZm90LmZp Zm8iDQoNCmludA0KbWFpbihpbnQgYXJnYywgY2hhciAqYXJndltdKQ0Kew0K ICAgaW50ICAgICAgICAgcmVhZGZkLA0KICAgICAgICAgICAgICAgdmFsLA0K ICAgICAgICAgICAgICAgd3JpdGVmZDsNCiAgIHN0cnVjdCBzdGF0IHN0YXRf YnVmOw0KDQogICBpZiAoc3RhdChGSUZPVF9OQU1FLCAmc3RhdF9idWYpID09 IC0xKQ0KICAgew0KICAgICAgaWYgKGVycm5vID09IEVOT0VOVCkNCiAgICAg IHsNCiAgICAgICAgIGlmIChta2ZpZm8oRklGT1RfTkFNRSwgU19JUlVTUiB8 IFNfSVdVU1IpID09IC0xKQ0KICAgICAgICAgew0KICAgICAgICAgICAgKHZv aWQpZnByaW50ZihzdGRlcnIsICJta2ZpZm8oKSBlcnJvciA6ICVzXG4iLCBz dHJlcnJvcihlcnJubykpOw0KICAgICAgICAgICAgZXhpdCgxKTsNCiAgICAg ICAgIH0NCiAgICAgIH0NCiAgICAgIGVsc2UNCiAgICAgIHsNCiAgICAgICAg ICh2b2lkKWZwcmludGYoc3RkZXJyLCAic3RhdCgpIGVycm9yIDogJXNcbiIs IHN0cmVycm9yKGVycm5vKSk7DQogICAgICAgICBleGl0KDEpOw0KICAgICAg fQ0KICAgfQ0KDQogICBpZiAoKHJlYWRmZCA9IG9wZW4oRklGT1RfTkFNRSwg T19SRE9OTFkgfCBPX05PTkJMT0NLKSkgPT0gLTEpDQogICB7DQogICAgICAo dm9pZClmcHJpbnRmKHN0ZGV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IT0gMTIpDQog ICAgICAgICB7DQogICAgICAgICAgICAodm9pZClmcHJpbnRmKHN0ZGVyciwg InJlYWQoKSBlcnJvciAoJWQpIDogJXNcbiIsIHJldCwgc3RyZXJyb3IoZXJy bm8pKTsNCiAgICAgICAgICAgIGV4aXQoMSk7DQogICAgICAgICB9DQogICAg ICAgICBidWZmZXJbMTJdID0gJ1wwJzsNCiAgICAgICAgICh2b2lkKWZwcmlu dGYoc3Rkb3V0LCAiSGF2ZSByZWNlaXZlZCBgJXMnXG4iLCBidWZmZXIpOw0K ICAgICAgfQ0KICAgICAgZWxzZQ0KICAgICAgew0KICAgICAgICAgKHZvaWQp ZnByaW50ZihzdGRlcnIsICJzZWxlY3QoKSBlcnJvciA6ICVzXG4iLCBzdHJl cnJvcihlcnJubykpOw0KICAgICAgICAgZXhpdCgxKTsNCiAgICAgIH0NCiAg IH0NCiAgIGVsc2UNCiAgIHsNCiAgICAgIGlmICh3cml0ZSh3cml0ZWZkLCAi SGFsbG8gQmFsbG8hIiwgMTIpICE9IDEyKQ0KICAgICAgew0KICAgICAgICAg KHZvaWQpZnByaW50ZihzdGRlcnIsICJ3cml0ZSgpIGVycm9yIDogJXNcbiIs IHN0cmVycm9yKGVycm5vKSk7DQogICAgICAgICBleGl0KDEpOw0KICAgICAg fQ0KICAgfQ0KICAgZXhpdCgwKTsNCn0NCg== --646810922-300355867-1158404521=:27295 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ --646810922-300355867-1158404521=:27295--