public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: ioctl: FIONREAD and ENOTTY
Date: Wed, 20 Jul 2011 15:47:00 -0000	[thread overview]
Message-ID: <20110720154647.GA15150@calimero.vinschen.de> (raw)
In-Reply-To: <1311149476.7796.50.camel@YAAKOV04>

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

  reply	other threads:[~2011-07-20 15:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-20  8:11 Yaakov (Cygwin/X)
2011-07-20 15:47 ` Corinna Vinschen [this message]
2011-07-20 22:37   ` Yaakov (Cygwin/X)
2011-07-21 14:40     ` Corinna Vinschen
2011-07-21 17:06       ` Christopher Faylor
2011-07-21 17:48         ` Corinna Vinschen
2011-07-21 19:58           ` Christopher Faylor
2011-07-21 20:22             ` Christopher Faylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110720154647.GA15150@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).