Calling GetLastError() on Windows for socket IO (trac issue #12012)
Calling GetLastError() on Windows for socket IO (trac issue #12012)

For the threaded RTS, putting a private copy of the throwErrno
series in GHC.IO.FD which gets if the operation was on a socket,
so that we can call c_maperrno if need be.
For the non-threaded RTS, if memory serves we call GetLastError()
in case of an error on socket IO. However, we don't do the translation
ErrCode ↔ Errno currently (and besides, it's a primop) so we do it if
needed through c_maperrno_func in the asynchronous read/write
functions.

Signed-off-by: ARJANEN Loïc Jean David <arjanen.loic@gmail.com>

Reviewers: ekmett, hvr, bgamari

Reviewed By: bgamari

Subscribers: thomie, carter

GHC Trac Issues: #12012

Differential Revision: https://phabricator.haskell.org/D4639

sdiehl/ghc,sdiehl/ghc,sdiehl/ghc,sdiehl/ghc,sdiehl/ghc,sdiehl/ghc,sdiehl/ghc