This comment has been minimized.

I'm only using "#if defined()" in win32unix/socket.c, and that's
just because I took the code from unix/socket.c...

you change a lot of includes; apparently, it seems that you want
"unixsupport.h" to be now included before <windows.h>; is there a reason for
that too?

"unixsupport.h" used to include <winsock.h>, and I've changed it
to include <winsock2.h> instead. As <winsock2.h> needs to be
included before <windows.h>, I had to change a lot of includes...

An alternative would have been to remove the inclusion of
<winsock.h> from "unixsupport.h" and instead include <winsock2.h>
only when necessary. This seems to involve more changes: there are
more files that involve sockets than files that include <windows.h>.

Another alternative would be to move the inclusion of <windows.h> to
"unixsupport.h". That might be cleaner in the long run (in particular,
we avoid the hack in "winworker.h" mentioned below), but is more
invasive: <windows.h> would be included a lot more often.

you sometimes remove the "unixsupport.h" header completely from
the includes list, e.g. in "startup.c" -- is that part of a general
cleanup?

In "winworker.h", <winsock2.h> needs to be included between
#define _WIN32_WINNT 0x0400
and
#include <windows.h>

So, I have moved the inclusion of "unixsupport.h" there and
removed it from the files that include "winworker.h".

why did you add <alloc.h> to times.c?

There were some missing includes, including this one. Indeed,
this is not IPv6 related...

Here, times.c uses function alloc_small which is declared in <alloc.h>.

there's an extra set_close_on_exec that appeared in open_connection;
I'm very much afraid that this will be a surprise for some people...

A set_close_on_exec was added in unix/unix.ml in revision 6420
(Sat Jun 19 15:33:53 2004 UTC (8 years ago) by xleroy). Indeed,
file descriptors handled through in/out_channel are expected to be
'close_on_exec' by default.

It seems more coherent to have it as well under Windows.

Do you want separate patches for the additional includes (such as
<alloc.h> in times.c) and for the extra set_close_on_exec, or is that
good enough?