From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24154 invoked by alias); 20 Jul 2011 22:37:23 -0000 Received: (qmail 24143 invoked by uid 22791); 20 Jul 2011 22:37:22 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-gx0-f171.google.com (HELO mail-gx0-f171.google.com) (209.85.161.171) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 20 Jul 2011 22:36:54 +0000 Received: by gxk22 with SMTP id 22so390282gxk.2 for ; Wed, 20 Jul 2011 15:36:53 -0700 (PDT) Received: by 10.236.175.7 with SMTP id y7mr1936914yhl.213.1311201413450; Wed, 20 Jul 2011 15:36:53 -0700 (PDT) Received: from [127.0.0.1] (S0106000cf16f58b1.wp.shawcable.net [174.5.115.130]) by mx.google.com with ESMTPS id g5sm638911yhn.9.2011.07.20.15.36.51 (version=SSLv3 cipher=OTHER); Wed, 20 Jul 2011 15:36:52 -0700 (PDT) Subject: Re: ioctl: FIONREAD and ENOTTY From: "Yaakov (Cygwin/X)" To: cygwin@cygwin.com Date: Wed, 20 Jul 2011 22:37:00 -0000 In-Reply-To: <20110720154647.GA15150@calimero.vinschen.de> References: <1311149476.7796.50.camel@YAAKOV04> <20110720154647.GA15150@calimero.vinschen.de> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Message-ID: <1311201422.6248.10.camel@YAAKOV04> Mime-Version: 1.0 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/msg00278.txt.bz2 On Wed, 2011-07-20 at 17:46 +0200, Corinna Vinschen wrote: > 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; Given my testcases, give me a few days to check this out. Yaakov -- 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