public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* The function ioctl bug
@ 2016-07-01  5:21 Бабенко Вячеслав
  2016-07-01  5:38 ` Marco Atzeri
  0 siblings, 1 reply; 4+ messages in thread
From: Бабенко Вячеслав @ 2016-07-01  5:21 UTC (permalink / raw)
  To: cygwin

Dear friends!

The function ioctl return -1 (errno equal 95) if I use cygwin-x86_64. See my code:
...
int fd = socket(AF_INET, SOCK_STREAM, 0);
if (ioctl(fd, FIONREAD, &c) == -1)
    printf("%u", errno);
...
The function ioctl return 0 if I use cygwin-x86.


--
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: The function ioctl bug
  2016-07-01  5:21 The function ioctl bug Бабенко Вячеслав
@ 2016-07-01  5:38 ` Marco Atzeri
  0 siblings, 0 replies; 4+ messages in thread
From: Marco Atzeri @ 2016-07-01  5:38 UTC (permalink / raw)
  To: cygwin



On 01/07/2016 07:21, Бабенко Вячеслав wrote:
> Dear friends!
>
> The function ioctl return -1 (errno equal 95) if I use cygwin-x86_64. See my code:
> ...
> int fd = socket(AF_INET, SOCK_STREAM, 0);
> if (ioctl(fd, FIONREAD, &c) == -1)
>     printf("%u", errno);
> ...
> The function ioctl return 0 if I use cygwin-x86.
>
>

the test case must be a complete minimal program that anyone could build.



--
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: The function ioctl bug
  2016-07-01 13:38 Бабенко Вячеслав
@ 2016-07-01 15:10 ` Corinna Vinschen
  0 siblings, 0 replies; 4+ messages in thread
From: Corinna Vinschen @ 2016-07-01 15:10 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1187 bytes --]

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 https://cygwin.com/snapshots/

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

Please give them a try.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: The function ioctl bug
@ 2016-07-01 13:38 Бабенко Вячеслав
  2016-07-01 15:10 ` Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Бабенко Вячеслав @ 2016-07-01 13:38 UTC (permalink / raw)
  To: cygwin

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;
}

--
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-07-01 15:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-01  5:21 The function ioctl bug Бабенко Вячеслав
2016-07-01  5:38 ` Marco Atzeri
2016-07-01 13:38 Бабенко Вячеслав
2016-07-01 15:10 ` Corinna Vinschen

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).