Calling GetLastError() on Windows for socket IO (trac issue #12012)
authorARJANEN Loïc Jean David <arjanen.loic@gmail.com>
Mon, 14 May 2018 20:38:21 +0000 (16:38 -0400)
committerBen Gamari <ben@smart-cactus.org>
Tue, 15 May 2018 14:45:40 +0000 (10:45 -0400)
commit01b15b88639443bec12415b6b0d906261bd6c047
treeca0dac6cbec67f5142eb334c4f8b8df9bb9ee10d
parentaf986f9dfb49db5544e4d670cde9a9a70a9a1223
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
libraries/base/GHC/IO/FD.hs