delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-Spam-Check-By: | sourceware.org |
Date: | Thu, 25 Oct 2012 10:35:59 +0200 |
From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
To: | cygwin AT cygwin DOT com |
Subject: | Re: termios VTIME and VMIN prevent SIGALRM from interrupting read |
Message-ID: | <20121025083559.GB30580@calimero.vinschen.de> |
Reply-To: | cygwin AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
References: | <7603230f0f415b46b2bf1bebe58c87c8 DOT squirrel AT indra DOT com> |
MIME-Version: | 1.0 |
In-Reply-To: | <7603230f0f415b46b2bf1bebe58c87c8.squirrel@indra.com> |
User-Agent: | Mutt/1.5.21 (2010-09-15) |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
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 Oct 23 16:27, J. L. Sloan wrote: > If I use termios(3) to set VTIME and VMIN to values greater than zero for > a serial port, I can no longer interrupt a read(2) against the descriptor > with SIGALRM. Replacing read(2) with nanosleep(2) yields EINTR as > expected. Not setting VTIME and VMIN, read(2) yields EINTR as desired. > Test program and cygcheck output attached. Could be this is intended > behavior. It seems more likely that this is a bug in the driver for my > USB-to-serial adapter. Cygwin 1.7.17 snapshot 2012-10-16. VMIN shouldn't have any influence on that behaviour, in theory. If you use VTIME values > 0, the Cygwin code doesn't use it's own interruptible wait routine, but rather calls ReadFile directly and relies on OS timeout handling. So, yes, it's kind of expected right now. I think it should be possible to rewrite the VTIME behaviour so that it doesn't rely on the OS timeout but instead adds a timer to the interruptible wait. Adding the timer is pretty simple, but changing the setting of the SetCommTimeouts values might be tricky. See http://cygwin.com/cgi-bin/cvsweb.cgi/src/winsup/cygwin/fhandler_serial.cc?rev=1.89&content-type=text/x-cvsweb-markup&cvsroot=src especially the VMIN/VTIME comment deep down in fhandler_serial::tcsetattr(). Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- 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 |