From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7120 invoked by alias); 20 Jul 2011 15:47:45 -0000 Received: (qmail 6915 invoked by uid 22791); 20 Jul 2011 15:47:22 -0000 X-Spam-Check-By: sourceware.org Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.83/v0.83-20-g38e4449) with ESMTP; Wed, 20 Jul 2011 15:46:50 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 31F1B2CAE5D; Wed, 20 Jul 2011 17:46:47 +0200 (CEST) Date: Wed, 20 Jul 2011 15:47:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: ioctl: FIONREAD and ENOTTY Message-ID: <20110720154647.GA15150@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <1311149476.7796.50.camel@YAAKOV04> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1311149476.7796.50.camel@YAAKOV04> User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2011-07/txt/msg00270.txt.bz2 On Jul 20 03:11, Yaakov (Cygwin/X) wrote: > On Linux, ioctl(2) returns several different errors[1]: > > EBADF d is not a valid descriptor. > EFAULT argp references an inaccessible memory area. > EINVAL Request or argp is not valid. > ENOTTY d is not associated with a character special device. > ENOTTY The specified request does not apply to the kind of object that > the descriptor d references. > > In the case of FIONREAD, Cygwin doesn't seem to distinguish between > EINVAL and ENOTTY, and this causes at least one major bug: > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35536 > > I have patched GCJ and GNU classpath to work around it, but this really > needs to be fixed in Cygwin itself. Would this patch be sufficient? Index: fhandler.cc =================================================================== RCS file: /cvs/src/src/winsup/cygwin/fhandler.cc,v retrieving revision 1.397 diff -u -p -r1.397 fhandler.cc --- fhandler.cc 5 Jul 2011 12:02:10 -0000 1.397 +++ fhandler.cc 20 Jul 2011 15:46:40 -0000 @@ -1151,6 +1151,10 @@ fhandler_base::ioctl (unsigned int cmd, set_nonblocking (*(int *) buf); res = 0; break; + case FIONREAD: + set_errno (ENOTTY); + res = -1; + break; default: set_errno (EINVAL); res = -1; 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