bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFT] Wrap winsock functions for improved compatibility


From: Paolo Bonzini
Subject: Re: [RFT] Wrap winsock functions for improved compatibility
Date: Fri, 12 Sep 2008 14:53:57 +0200
User-agent: Thunderbird 2.0.0.16 (Macintosh/20080707)

> - > It needs to be tested on Windows (mingw and cygwin)
> 
>   The patch is supposed to change nothing on Cygwin, right? Cygwin has
>   perfectly fine POSIX socket support already.

I added a #error to verify that.  That's why I needed testing on Cygwin.

> - The transformation of WSAGetLastError() values to errno values is a nice
>   trick, but the mapping e -> e - 10000 will not work out because of some
>   clashes. Looking at mingw's <errno.h> and <winsock2.h> the first ones are
>   ok but not the later ones:
>
>   I would propose to leave the higher WSA* values as is, though a
>   mapping   e -> (e < 10025 ? e - 10000 : e)

Good.  But then, let's "randomly" pick 10060 for Yoann's other patch.

> - It would be good to extend the gnulib <errno.h>, <string.h>, <stdio.h>,
>   strerror, perror replacements to handle these values (when the sys_socket
>   module is in use). (errno values are supposed to be all defined in 
> <errno.h>,
>   strerror is supposed to be declared in <string.h>, and perror is supposed
>   to be declared in <stdio.h>.)

Yes... but can we do it later? :-)

> - Can we call the replacement functions "rpl_getsockopt" etc. please, not
>   "win_getsockopt"? To make it clear that it's the gnulib replacement, and
>   because the prefix "win" is subtle brainwashing.

Yes, of course.

> - What about the need to call WSAInit()? Is it still needed at all?

That's provided by the separate sockets module.

> - The doc should document that while most fd-based POSIX functions are
>   correctly replaced, things like
>      int fd = connect (...);
>      FILE *fp = fdopen (fd, "w");
>   will not work - because the fwrite() function will call write(), not send(),
>   under the hood.

ReadFile and WriteFile work under win32 with sockets (learning that is
what prompted me to submit this finally).

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]