-
sof authored
Make the IO implementation work with WinSock once again. When creating sockets with WinSock, you don't get back a file descriptor, but a SOCKET (which just so happens to map to the same type as a 'normal' file descriptor). This SOCKET value cannot be used with the CRT ops read(), write(), close(), but you have to use the socket-specific operations (recv(), send(), and closesocket(), respectively) instead. To keep track of this distinction between file and socket file descriptors, the following changes were made: * a Handle__ has got a new field, haIsStream, which is True for sockets / streams. (this field is essentially unused in non-Win32 settings, but I decided not to conditionalise its presence). * PrelHandle.openFd now takes an extra (Maybe FDType) argument, which lets you force what type of FD we're converting into a Handle (this is crucial for WinSock SOCKETs, since we don't want to attempt fstat()ing them). Fixes breakage that was introduced with May 2001 (or earlier) rewrite of the IO layer. This commit build upon recent IO changes to HEAD, so merging it to STABLE will require importing those changes too (I'll let others be the judge whether this should be done or not).
9746e23a