On Fri, 24 Oct 2003, Corinna Vinschen wrote:
> 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.
>
Ok. Revised as suggested and attached. Same ChangeLog entry.
BTW, I noticed that, but I decided to just follow what was there already.
It looked like someone started to do this and then just forgot. Also,
comming from a realtime background, I can't/don't always rely on the
compiler to just "do the right thing", even for simple optimizations like
this; been burned too many times with new compiler releases. Just FYI.
> > I was trying to fix this issue:
> >
> > http://www.cygwin.com/ml/cygwin/2003-10/msg01159.html
> >
> > 2003-10-23 Brian Ford <[EMAIL PROTECTED]>
> >
> > * 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.160
diff -u -p -r1.160 fhandler.cc
--- fhandler.cc 24 Oct 2003 12:11:20 -0000 1.160
+++ fhandler.cc 24 Oct 2003 14:41:58 -0000
@@ -909,13 +909,22 @@ fhandler_base::close ()
int
fhandler_base::ioctl (unsigned int cmd, void *buf)
{
- if (cmd == FIONBIO)
- syscall_printf ("ioctl (FIONBIO, %p)", buf);
- else
- syscall_printf ("ioctl (%x, %p)", cmd, buf);
+ int res;
- set_errno (EINVAL);
- return -1;
+ switch (cmd)
+ {
+ case FIONBIO:
+ set_nonblocking (*(int *) buf);
+ res = 0;
+ break;
+ default:
+ set_errno (EINVAL);
+ res = -1;
+ break;
+ }
+
+ syscall_printf ("%d = ioctl (%x, %p)", res, cmd, buf);
+ return res;
}
int