delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/08/22/09:40:56

X-Spam-Check-By: sourceware.org
Date: Tue, 22 Aug 2006 09:40:40 -0400 (EDT)
From: Igor Peshansky <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Ernesto Paiser <paiser AT esrf DOT fr>
cc: cygwin AT cygwin DOT com
Subject: Re: read() blocking and TIOCINQ
In-Reply-To: <44EABC07.3010305@esrf.fr>
Message-ID: <Pine.GSO.4.63.0608220936070.14509@access1.cims.nyu.edu>
References: <44EABC07 DOT 3010305 AT esrf DOT fr>
MIME-Version: 1.0
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

On Tue, 22 Aug 2006, Ernesto Paiser wrote:

> Hello Corinna,

FYI, this is a mailing list, and unless you're replying to a specific
message, you're actually talking to many people.

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

Please post a complete compilable test case that reproduces the problem.
For example, in the above code, it's unclear what the variable sl contains
(and I suspect it contains "COM1", which is a no-no -- you should be using
"/dev/ttyS0").
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"

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