Longstanding __USE_W32_SOCKETS hiccup.

Christopher Faylor cgf-use-the-mailinglist-please@cygwin.com
Fri Aug 7 15:45:00 GMT 2009

On Fri, Aug 07, 2009 at 03:29:12PM +0100, Dave Korn wrote:
>Corinna Vinschen wrote:
>> struct timeval in winsock2.h only differs by using `long' instead of
>> time_t and susecond_t as types of tv_sec and tv_usec.  The size of the
>> structs is the same, the underlying types are equivalent.
>> So, wouldn't it be less hassle in the long run to define struct timeval
>> in winsock2.h equivalent to sys/time.h if building for Cygwin?
>  Looking at your patch, I discovered that we never actually define
>  That gave me another idea; what if we turn your idea on its head, and define
>struct timeval in sys/time.h equivalent to winsock2.h if *not* building for
>Cygwin (sockets, i.e. if __USE_W32_SOCKETS).  And on taking a closer look, this
>turns out to be what happens in mingw/sys/time.h, so how about doing it this
>way; duplicating the hunk from winsock2.h that would get excluded by
>_TIMEVAL_DEFINED into time.h, but only when __USE_W32_SOCKETS, and then setting

I haven't been paying close attention here but why are we bothering to
accommodate use of winsock2.h and time.h.  This is really only for
Cygwin itself right?

If so, couldn't we get away with just doing some judicious #defining
to "rename" the time.h values get the winsock values  when needed?

Otherwise, I don't think we should worry about people trying to mix
winsock.h in true Cygwin programs.


More information about the Cygwin-developers mailing list