delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/08/22/10:36:16

X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
Subject: RE: read() blocking and TIOCINQ
Date: Tue, 22 Aug 2006 10:33:54 -0400
Message-ID: <C874DBE9D30B584587F8CD0EC34DA8BE025D6967@EX00.idirect.net>
In-Reply-To: <44EABC07.3010305@esrf.fr>
From: "Nellis, Kenneth" <knellis AT idirect DOT net>
To: <cygwin AT cygwin DOT com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id k7MEaD80007408

The value of errno might give you a clue.

--Ken Nellis

-----Original Message-----
From: Ernesto Paiser [mailto:paiser at esrf dot fr] 
Sent: Tuesday, August 22, 2006 4:11 AM
To: cygwin at cygwin dot com
Subject: read() blocking and TIOCINQ

Hello Corinna,
I have problems with read() function blocking and
waiting for characters on serial line with cygwin:

Here are some code fragments:
========================================================
fd = open(sl, O_RDWR | O_NOCTTY | O_NONBLOCK | O_NDELAY)

newpio.c_cflag = brate | CS8 | CLOCAL | CREAD;
newpio.c_iflag = IGNPAR | ICRNL;
newpio.c_oflag = 0;
newpio.c_lflag = 0;
newpio.c_cc[VTIME]    = 1;
newpio.c_cc[VMIN]     = 0;
...

n = ioctl(fd, TIOCINQ, &n); //It gives me an error (return -1) why??!!!

and

n = read(fd, buffer, 1);  <<< HERE IS BLOCKING!!!
========================================================

TIOCINQ is working on CYGWIN,

Is there another way to solve this problem???

Thank you in advance,
  Ernesto.

-- 
Ernesto PAISER ____________________ paiser AT esrf DOT fr
E.S.R.F. - European Synchrotron Radiation Facility
6 rue Jules Horowitz  BP 220 Grenoble CEDEX France
phone +33 4 76 88 23 48      fax +33 4 76 88 23 25


--
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/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019