The function ioctl bug

Corinna Vinschen
Fri Jul 1 15:10:00 GMT 2016

Hi Viacheslav,

On Jul  1 23:38, Бабенко Вячеслав wrote:
> Dear friends!
> The function ioctl return -1 (errno equal 95) if I use cygwin-x86_64 but return 0 if I use cygwin-x86.
> #include <stdio.h>
> #include <sys/socket.h>
> #include <sys/ioctl.h>
> #include <unistd.h>
> #include <errno.h>
> int main()
> {
>     int c;
>     int fd = socket(AF_INET, SOCK_STREAM, 0);
>     if (ioctl(fd, FIONREAD, &c) == -1)
>         printf("errno:%u\n", errno);
>     close(fd);
>     return 0;
> }

My fault.  As result of a header change in newlib I also changed the
definition of FIONREAD and others in <asm/socket.h>, but failed to make
sure to call Winsock's ioctlsocket with the correctly specified Winsock
FIONREAD.  This only affects x86_64 as you noticed.

I applied a patch to fix this issue and uploaded new developer
snapshots to

(Note that recent snapshots don't work on XP and Server 2003 anymore)

Please give them a try.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <>

More information about the Cygwin mailing list