www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/08/31/22:40:52

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.4 required=5.0 tests=AWL,BAYES_50,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Date: Tue, 31 Aug 2010 22:40:38 -0400 (EDT)
From: Brennan Peter Sellner <bsellner AT andrew DOT cmu DOT edu>
Reply-To: brennan AT sellner DOT org
To: cygwin AT cygwin DOT com
Subject: Re: Support for the TIOCINQ ioctl
In-Reply-To: <AANLkTimbL80QZB3h+OHe-X_R_LL0OfcyExhuZq4c9UMT@mail.gmail.com>
Message-ID: <Pine.LNX.4.64.1008312235360.32463@unix37.andrew.cmu.edu>
References: <Pine DOT LNX DOT 4 DOT 64 DOT 1008271822560 DOT 25309 AT unix11 DOT andrew DOT cmu DOT edu> <AANLkTimbL80QZB3h+OHe-X_R_LL0OfcyExhuZq4c9UMT AT mail DOT gmail DOT com>
MIME-Version: 1.0
X-SMTP-Spam-Clean: 8% ( MIME_TEXT_ONLY_MP_MIXED 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1900_1999 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, FROM_NAME_PHRASE 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CP_URI_IN_BODY 0, __CT 0, __CTYPE_HAS_BOUNDARY 0, __CTYPE_MULTIPART 0, __CTYPE_MULTIPART_MIXED 0, __HAS_MSGID 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_MAILTO 0, __URI_NO_WWW 0)
X-SMTP-Spam-Score: 8%
X-IsSubscribed: yes
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

--41985805-1146114060-1283308838=:32463
Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8BIT

On Sat, 28 Aug 2010, Andy Koppe wrote:
> On 27 August 2010 23:31, Brennan Peter Sellner wrote:
>> By any chance, has support for the TIOCINQ ioctl on file descriptors (used
>> to check how many bytes of data are in the input buffer) been added to
>> Cygwin?  It hadn't as of 2004:
>>
>>  http://sourceware.org/ml/cygwin/2004-07/msg00910.html
>
> It's still implemented only for serial devices.

As I suspected.  Thanks for the confirmation.

>> ...but I haven't found any newer references to it.  I'm inferring that it's
>> not supported, as ioctl(fd, TIOCINQ, &available) (where fd is a valid file
>> descriptor, and available is a long) fails, with errno set to 'invalid
>> argument'.  I'm running Cygwin 1.7.6 on Vista.
>>
>> I'm hoping I'm missing something...  Is there an alternative way to check
>> the number of bytes on an fd's input buffer in Cygwin?
>
> What's your use case? And on what sort of fd?
>
> select() of course can tell you whether there are any bytes available
> to be read from an fd, and usually that's all one needs to know.

I'm porting a fair chunk of legacy code that spawns processes in the 
background, provides an emulated tty, and monitors the output, allowing 
remote clients to interact with the backgrounded processes as if they were 
running in a local terminal.

select can indeed do the trick: there were ioctl calls sprinkled liberally 
throughout the code, and I was attempting to avoid extensive refactoring. 
:-)  Now that I've refactored things properly using select, things are 
once again working smoothly.

Thanks again,

-Brennan


--41985805-1146114060-1283308838=:32463
Content-Type: text/plain; charset=us-ascii

--
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
--41985805-1146114060-1283308838=:32463--

- Raw text -


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