Guard the O_SYNC flag usage in mapFileFlags() with a preprocessor conditional to fix compilation on Windows where this constant is not defined. Additionally, add the required Windows socket and system libraries (ws2_32, iphlpapi, psapi, userenv) to LIBUV_LIBS when building under mingw32, replacing the Linux-specific pthread and rt libraries.