cvs commit: fptools/ghc/lib/std PrelHandle.hs PrelIO.hs
PrelIOBase.lhs fptools/ghc/lib/std/cbits HsStd.h PrelIOUtils.c
Mon, 26 Nov 2001 12:04:01 -0800
sof 2001/11/26 12:04:00 PST
ghc/lib/std PrelHandle.hs PrelIO.hs PrelIOBase.lhs
ghc/lib/std/cbits HsStd.h PrelIOUtils.c PrelIOUtils.h
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(),
To keep track of this distinction between file and
socket file descriptors, the following changes were
* 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).
Revision Changes Path
1.4 +45 -32 fptools/ghc/lib/std/PrelHandle.hs
1.4 +12 -12 fptools/ghc/lib/std/PrelIO.hs
1.45 +2 -1 fptools/ghc/lib/std/PrelIOBase.lhs
1.5 +4 -1 fptools/ghc/lib/std/cbits/HsStd.h
1.5 +13 -2 fptools/ghc/lib/std/cbits/PrelIOUtils.c
1.4 +2 -2 fptools/ghc/lib/std/cbits/PrelIOUtils.h