Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 Reply-To: From: "Manav Ahuja" To: Subject: Can u help me how to unsubscribe Date: Fri, 26 Jul 2002 16:55:19 +0530 Organization: Wipro Technologies Message-ID: <002901c23497$216ea2c0$daaba8c0@wipro.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPartTM-000-86770c25-e047-4103-9d99-d48f476189db" X-Priority: 3 (Normal) X-MSMail-Priority: Normal Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 In-Reply-To: ------=_NextPartTM-000-86770c25-e047-4103-9d99-d48f476189db Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit i want unsubsribe from the list ... plz can anybody help Manav -----Original Message----- From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com] On Behalf Of Kandziora Jan Sent: Friday, July 26, 2002 4:47 PM To: 'cygwin AT cygwin DOT com' Subject: piped stdout and O_NONBLOCK Hi all, In short: Does it work? I wanted a program to write its debug messages to a pipe, data flowing into "faucet" of "netpipes" and over a network connection. But that did not work, because faucet blocks on a connect() from the other side and meanwhile does not read any data from the pipe. So the first program blocks in writing its output after a while, even if the output stream is set to O_NONBLOCK. For testing purposes I wrote a program "blocktest": #include #include #include #include #include #include int main(void) { char buffer[4096]; fd_set input_set; int read_bytes; int remaining_bytes; char *p; int written_bytes; if (fcntl(0,F_SETFL,O_NONBLOCK)<0) { perror("input stream can not be set to nonblocking mode"); exit(EXIT_FAILURE); } if (fcntl(1,F_SETFL,O_NONBLOCK)<0) { perror("output stream can not be set to nonblocking mode"); exit(EXIT_FAILURE); } FD_ZERO(&input_set); FD_SET(0,&input_set); for(;;) { // Try to read. if ((read_bytes=read(0,&buffer,sizeof(buffer)))<0) { if (errno!=EAGAIN) { perror("read failed"); exit(EXIT_FAILURE); } } else { // Nothing to read. Try to write. remaining_bytes=read_bytes; p=(char*)&buffer; while (remaining_bytes>0) { if ((written_bytes=write(1,&p,remaining_bytes))<0) { if (errno==EAGAIN) break; perror("write failed"); exit(EXIT_FAILURE); } remaining_bytes-=written_bytes; p+=written_bytes; } // Write would block. Wait for new data to read. select(1,&input_set,NULL,NULL,NULL); } } } Then I put it into a pipeline cat /dev/zero | ./blocktest | sleep 1000 With Linux this works as expected, with a "cat" using nearly all cpu time. With Cygwin, "blocktest" blocks in the write call after writing 12288 bytes, causing "cat" to block. I tested this with Cygwin-1.3.9 and 1.3.12-2. Did I miss something? Jan -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ------=_NextPartTM-000-86770c25-e047-4103-9d99-d48f476189db Content-Type: text/plain; name="Wipro_Disclaimer.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="Wipro_Disclaimer.txt" **************************Disclaimer************************************ Information contained in this E-MAIL being proprietary to Wipro Limited is 'privileged' and 'confidential' and intended for use only by the individual or entity to which it is addressed. You are notified that any use, copying or dissemination of the information contained in the E-MAIL in any manner whatsoever is strictly prohibited. *************************************************************************** ------=_NextPartTM-000-86770c25-e047-4103-9d99-d48f476189db Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ------=_NextPartTM-000-86770c25-e047-4103-9d99-d48f476189db--