fhandler_base::ioctl (FIONBIO)
Corinna Vinschen
cygwin-patches@cygwin.com
Fri Oct 24 12:43:00 GMT 2003
On Thu, Oct 23, 2003 at 06:06:09PM -0500, Brian Ford wrote:
> Any reason not to support this? It seams to me that this patch just
> parallels what is already in fhandler_base::fcntl (F_SETFL) for
> O_NONBLOCK.
Yes, I think you're right. However, I'd like to ask you to rearrange
your patch a bit. Most (all?) other ioctl methods are using a switch
statement rather than a if/else clause. To allow later easier extension,
I think using a switch here would be better as well, even though there's
only one case so far.
Corinna
>
> I was trying to fix this issue:
>
> http://www.cygwin.com/ml/cygwin/2003-10/msg01159.html
>
> 2003-10-23 Brian Ford <ford@vss.fsi.com>
>
> * fhandler.cc (fhandler_base::ioctl): Handle FIONBIO.
>
> --
> Brian Ford
> Senior Realtime Software Engineer
> VITAL - Visual Simulation Systems
> FlightSafety International
> Phone: 314-551-8460
> Fax: 314-551-8444
> Index: fhandler.cc
> ===================================================================
> RCS file: /cvs/src/src/winsup/cygwin/fhandler.cc,v
> retrieving revision 1.159
> diff -u -p -r1.159 fhandler.cc
> --- fhandler.cc 30 Sep 2003 21:46:08 -0000 1.159
> +++ fhandler.cc 23 Oct 2003 21:38:51 -0000
> @@ -909,13 +909,21 @@ fhandler_base::close ()
> int
> fhandler_base::ioctl (unsigned int cmd, void *buf)
> {
> + int res;
> +
> if (cmd == FIONBIO)
> - syscall_printf ("ioctl (FIONBIO, %p)", buf);
> + {
> + set_nonblocking (*(int *) buf);
> + res = 0;
> + }
> else
> - syscall_printf ("ioctl (%x, %p)", cmd, buf);
> + {
> + set_errno (EINVAL);
> + res = -1;
> + }
>
> - set_errno (EINVAL);
> - return -1;
> + syscall_printf ("%d = ioctl (%x, %p)", res, cmd, buf);
> + return res;
> }
>
> int
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Developer mailto:cygwin@cygwin.com
Red Hat, Inc.
More information about the Cygwin-patches
mailing list