File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 37
37
#include < unistd.h>
38
38
#endif
39
39
40
+ // We map Linux / BSD error functions and codes, to the equivalent
41
+ // Windows definitions, and use the WSA* names throughout our code.
42
+ // Note that glibc defines EWOULDBLOCK as EAGAIN (see errno.h).
40
43
#ifndef WIN32
41
44
typedef unsigned int SOCKET;
42
- #include < errno.h >
45
+ #include < cerrno >
43
46
#define WSAGetLastError () errno
44
47
#define WSAEINVAL EINVAL
45
48
#define WSAEWOULDBLOCK EWOULDBLOCK
@@ -51,14 +54,13 @@ typedef unsigned int SOCKET;
51
54
#define INVALID_SOCKET (SOCKET)(~0 )
52
55
#define SOCKET_ERROR -1
53
56
#else
54
- # ifndef WSAEAGAIN
57
+ // WSAEAGAIN doesn't exist on Windows
55
58
#ifdef EAGAIN
56
59
#define WSAEAGAIN EAGAIN
57
60
#else
58
61
#define WSAEAGAIN WSAEWOULDBLOCK
59
62
#endif
60
63
#endif
61
- #endif
62
64
63
65
// Windows doesn't define S_IRUSR or S_IWUSR. We define both
64
66
// here, with the same values as glibc (see stat.h).
You can’t perform that action at this time.
0 commit comments