1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* win32/win32.c (map_errno): support winsock error.

* win32/win32.c (pipe_exec, CreateChild, poll_child_status, waitpid,
  kill, link, rb_w32_rename, unixtime_to_filetime, rb_w32_utime):
  pass errno to map_errno().

* win32/win32.c (rb_w32_select, rb_w32_accept, rb_w32_bind,
  rb_w32_connect, rb_w32_getpeername, rb_w32_getsockname,
  rb_w32_getsockopt, rb_w32_ioctlsocket, rb_w32_listen, rb_w32_recv,
  rb_w32_recvfrom, rb_w32_send, rb_w32_sendto, rb_w32_setsockopt,
  rb_w32_shutdown, rb_w32_socket, rb_w32_gethostbyaddr,
  rb_w32_gethostbyname, rb_w32_gethostname, rb_w32_getprotobyname,
  rb_w32_getprotobynumber, rb_w32_getservbyname, rb_w32_getservbyport,
  rb_w32_fclose, rb_w32_close): use map_errno().

* win32/win32.h: add winsock errors.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2003-08-26 20:17:18 +00:00
parent 1cece7f80f
commit 92dbabb0a4
3 changed files with 107 additions and 48 deletions

View file

@ -1,3 +1,22 @@
Wed Aug 27 05:10:15 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.c (map_errno): support winsock error.
* win32/win32.c (pipe_exec, CreateChild, poll_child_status, waitpid,
kill, link, rb_w32_rename, unixtime_to_filetime, rb_w32_utime):
pass errno to map_errno().
* win32/win32.c (rb_w32_select, rb_w32_accept, rb_w32_bind,
rb_w32_connect, rb_w32_getpeername, rb_w32_getsockname,
rb_w32_getsockopt, rb_w32_ioctlsocket, rb_w32_listen, rb_w32_recv,
rb_w32_recvfrom, rb_w32_send, rb_w32_sendto, rb_w32_setsockopt,
rb_w32_shutdown, rb_w32_socket, rb_w32_gethostbyaddr,
rb_w32_gethostbyname, rb_w32_gethostname, rb_w32_getprotobyname,
rb_w32_getprotobynumber, rb_w32_getservbyname, rb_w32_getservbyport,
rb_w32_fclose, rb_w32_close): use map_errno().
* win32/win32.h: add winsock errors.
Tue Aug 26 23:53:23 2003 Yukihiro Matsumoto <matz@ruby-lang.org> Tue Aug 26 23:53:23 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/ostruct.rb (OpenStruct::method_missing): prohibit modifying * lib/ostruct.rb (OpenStruct::method_missing): prohibit modifying

View file

@ -180,24 +180,28 @@ static struct {
{ ERROR_FILENAME_EXCED_RANGE, ENOENT }, { ERROR_FILENAME_EXCED_RANGE, ENOENT },
{ ERROR_NESTING_NOT_ALLOWED, EAGAIN }, { ERROR_NESTING_NOT_ALLOWED, EAGAIN },
{ ERROR_NOT_ENOUGH_QUOTA, ENOMEM }, { ERROR_NOT_ENOUGH_QUOTA, ENOMEM },
{ 0, 0 } { WSAENAMETOOLONG, ENAMETOOLONG },
{ WSAENOTEMPTY, ENOTEMPTY }
}; };
static int map_errno(void) static int
map_errno(DWORD winerr)
{ {
DWORD winerr = GetLastError();
int i; int i;
if (winerr == 0) { if (winerr == 0) {
return 0; return 0;
} }
for (i = 0; errmap[i].winerr; i++) { for (i = 0; i < sizeof(errmap) / sizeof(*errmap); i++) {
if (errmap[i].winerr == winerr) { if (errmap[i].winerr == winerr) {
return errmap[i].err; return errmap[i].err;
} }
} }
if (winerr >= WSABASEERR) {
return winerr;
}
return EINVAL; return EINVAL;
} }
@ -594,12 +598,12 @@ pipe_exec(char *cmd, int mode, FILE **fpr, FILE **fpw)
if (reading) { if (reading) {
fRet = CreatePipe(&hReadIn, &hReadOut, &sa, 2048L); fRet = CreatePipe(&hReadIn, &hReadOut, &sa, 2048L);
if (!fRet) { if (!fRet) {
errno = map_errno(); errno = map_errno(GetLastError());
break; break;
} }
if (!DuplicateHandle(hCurProc, hReadIn, hCurProc, &hDupInFile, 0, if (!DuplicateHandle(hCurProc, hReadIn, hCurProc, &hDupInFile, 0,
FALSE, DUPLICATE_SAME_ACCESS)) { FALSE, DUPLICATE_SAME_ACCESS)) {
errno = map_errno(); errno = map_errno(GetLastError());
CloseHandle(hReadIn); CloseHandle(hReadIn);
CloseHandle(hReadOut); CloseHandle(hReadOut);
CloseHandle(hCurProc); CloseHandle(hCurProc);
@ -610,7 +614,7 @@ pipe_exec(char *cmd, int mode, FILE **fpr, FILE **fpw)
if (writing) { if (writing) {
fRet = CreatePipe(&hWriteIn, &hWriteOut, &sa, 2048L); fRet = CreatePipe(&hWriteIn, &hWriteOut, &sa, 2048L);
if (!fRet) { if (!fRet) {
errno = map_errno(); errno = map_errno(GetLastError());
write_pipe_failed: write_pipe_failed:
if (reading) { if (reading) {
CloseHandle(hDupInFile); CloseHandle(hDupInFile);
@ -620,7 +624,7 @@ pipe_exec(char *cmd, int mode, FILE **fpr, FILE **fpw)
} }
if (!DuplicateHandle(hCurProc, hWriteOut, hCurProc, &hDupOutFile, 0, if (!DuplicateHandle(hCurProc, hWriteOut, hCurProc, &hDupOutFile, 0,
FALSE, DUPLICATE_SAME_ACCESS)) { FALSE, DUPLICATE_SAME_ACCESS)) {
errno = map_errno(); errno = map_errno(GetLastError());
CloseHandle(hWriteIn); CloseHandle(hWriteIn);
CloseHandle(hWriteOut); CloseHandle(hWriteOut);
CloseHandle(hCurProc); CloseHandle(hCurProc);
@ -900,7 +904,7 @@ CreateChild(char *cmd, char *prog, SECURITY_ATTRIBUTES *psa, HANDLE hInput, HAND
fRet = CreateProcess(shell, cmd, psa, psa, fRet = CreateProcess(shell, cmd, psa, psa,
psa->bInheritHandle, dwCreationFlags, NULL, NULL, psa->bInheritHandle, dwCreationFlags, NULL, NULL,
&aStartupInfo, &aProcessInformation); &aStartupInfo, &aProcessInformation);
errno = map_errno(); errno = map_errno(GetLastError());
}); });
if (!fRet) { if (!fRet) {
@ -1820,7 +1824,7 @@ rb_w32_select (int nfds, fd_set *rd, fd_set *wr, fd_set *ex,
RUBY_CRITICAL({ RUBY_CRITICAL({
r = select(nfds, rd, wr, ex, timeout); r = select(nfds, rd, wr, ex, timeout);
if (r == SOCKET_ERROR) { if (r == SOCKET_ERROR) {
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
} }
}); });
return r; return r;
@ -1886,7 +1890,7 @@ rb_w32_accept(int s, struct sockaddr *addr, int *addrlen)
RUBY_CRITICAL({ RUBY_CRITICAL({
r = accept(TO_SOCKET(s), addr, addrlen); r = accept(TO_SOCKET(s), addr, addrlen);
if (r == INVALID_SOCKET) { if (r == INVALID_SOCKET) {
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
s = -1; s = -1;
} }
else { else {
@ -1909,7 +1913,7 @@ rb_w32_bind(int s, struct sockaddr *addr, int addrlen)
RUBY_CRITICAL({ RUBY_CRITICAL({
r = bind(TO_SOCKET(s), addr, addrlen); r = bind(TO_SOCKET(s), addr, addrlen);
if (r == SOCKET_ERROR) if (r == SOCKET_ERROR)
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
}); });
return r; return r;
} }
@ -1926,7 +1930,7 @@ rb_w32_connect(int s, struct sockaddr *addr, int addrlen)
RUBY_CRITICAL({ RUBY_CRITICAL({
r = connect(TO_SOCKET(s), addr, addrlen); r = connect(TO_SOCKET(s), addr, addrlen);
if (r == SOCKET_ERROR) if (r == SOCKET_ERROR)
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
}); });
return r; return r;
} }
@ -1944,7 +1948,7 @@ rb_w32_getpeername(int s, struct sockaddr *addr, int *addrlen)
RUBY_CRITICAL({ RUBY_CRITICAL({
r = getpeername(TO_SOCKET(s), addr, addrlen); r = getpeername(TO_SOCKET(s), addr, addrlen);
if (r == SOCKET_ERROR) if (r == SOCKET_ERROR)
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
}); });
return r; return r;
} }
@ -1961,7 +1965,7 @@ rb_w32_getsockname(int s, struct sockaddr *addr, int *addrlen)
RUBY_CRITICAL({ RUBY_CRITICAL({
r = getsockname(TO_SOCKET(s), addr, addrlen); r = getsockname(TO_SOCKET(s), addr, addrlen);
if (r == SOCKET_ERROR) if (r == SOCKET_ERROR)
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
}); });
return r; return r;
} }
@ -1976,7 +1980,7 @@ rb_w32_getsockopt(int s, int level, int optname, char *optval, int *optlen)
RUBY_CRITICAL({ RUBY_CRITICAL({
r = getsockopt(TO_SOCKET(s), level, optname, optval, optlen); r = getsockopt(TO_SOCKET(s), level, optname, optval, optlen);
if (r == SOCKET_ERROR) if (r == SOCKET_ERROR)
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
}); });
return r; return r;
} }
@ -1993,7 +1997,7 @@ rb_w32_ioctlsocket(int s, long cmd, u_long *argp)
RUBY_CRITICAL({ RUBY_CRITICAL({
r = ioctlsocket(TO_SOCKET(s), cmd, argp); r = ioctlsocket(TO_SOCKET(s), cmd, argp);
if (r == SOCKET_ERROR) if (r == SOCKET_ERROR)
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
}); });
return r; return r;
} }
@ -2010,7 +2014,7 @@ rb_w32_listen(int s, int backlog)
RUBY_CRITICAL({ RUBY_CRITICAL({
r = listen(TO_SOCKET(s), backlog); r = listen(TO_SOCKET(s), backlog);
if (r == SOCKET_ERROR) if (r == SOCKET_ERROR)
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
}); });
return r; return r;
} }
@ -2027,7 +2031,7 @@ rb_w32_recv(int s, char *buf, int len, int flags)
RUBY_CRITICAL({ RUBY_CRITICAL({
r = recv(TO_SOCKET(s), buf, len, flags); r = recv(TO_SOCKET(s), buf, len, flags);
if (r == SOCKET_ERROR) if (r == SOCKET_ERROR)
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
}); });
return r; return r;
} }
@ -2045,7 +2049,7 @@ rb_w32_recvfrom(int s, char *buf, int len, int flags,
RUBY_CRITICAL({ RUBY_CRITICAL({
r = recvfrom(TO_SOCKET(s), buf, len, flags, from, fromlen); r = recvfrom(TO_SOCKET(s), buf, len, flags, from, fromlen);
if (r == SOCKET_ERROR) if (r == SOCKET_ERROR)
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
}); });
return r; return r;
} }
@ -2062,7 +2066,7 @@ rb_w32_send(int s, char *buf, int len, int flags)
RUBY_CRITICAL({ RUBY_CRITICAL({
r = send(TO_SOCKET(s), buf, len, flags); r = send(TO_SOCKET(s), buf, len, flags);
if (r == SOCKET_ERROR) if (r == SOCKET_ERROR)
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
}); });
return r; return r;
} }
@ -2080,7 +2084,7 @@ rb_w32_sendto(int s, char *buf, int len, int flags,
RUBY_CRITICAL({ RUBY_CRITICAL({
r = sendto(TO_SOCKET(s), buf, len, flags, to, tolen); r = sendto(TO_SOCKET(s), buf, len, flags, to, tolen);
if (r == SOCKET_ERROR) if (r == SOCKET_ERROR)
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
}); });
return r; return r;
} }
@ -2097,7 +2101,7 @@ rb_w32_setsockopt(int s, int level, int optname, char *optval, int optlen)
RUBY_CRITICAL({ RUBY_CRITICAL({
r = setsockopt(TO_SOCKET(s), level, optname, optval, optlen); r = setsockopt(TO_SOCKET(s), level, optname, optval, optlen);
if (r == SOCKET_ERROR) if (r == SOCKET_ERROR)
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
}); });
return r; return r;
} }
@ -2114,7 +2118,7 @@ rb_w32_shutdown(int s, int how)
RUBY_CRITICAL({ RUBY_CRITICAL({
r = shutdown(TO_SOCKET(s), how); r = shutdown(TO_SOCKET(s), how);
if (r == SOCKET_ERROR) if (r == SOCKET_ERROR)
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
}); });
return r; return r;
} }
@ -2133,7 +2137,7 @@ rb_w32_socket(int af, int type, int protocol)
RUBY_CRITICAL({ RUBY_CRITICAL({
s = socket(af, type, protocol); s = socket(af, type, protocol);
if (s == INVALID_SOCKET) { if (s == INVALID_SOCKET) {
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
fd = -1; fd = -1;
} }
else { else {
@ -2155,7 +2159,7 @@ rb_w32_gethostbyaddr (char *addr, int len, int type)
RUBY_CRITICAL({ RUBY_CRITICAL({
r = gethostbyaddr(addr, len, type); r = gethostbyaddr(addr, len, type);
if (r == NULL) if (r == NULL)
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
}); });
return r; return r;
} }
@ -2172,7 +2176,7 @@ rb_w32_gethostbyname (char *name)
RUBY_CRITICAL({ RUBY_CRITICAL({
r = gethostbyname(name); r = gethostbyname(name);
if (r == NULL) if (r == NULL)
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
}); });
return r; return r;
} }
@ -2189,7 +2193,7 @@ rb_w32_gethostname (char *name, int len)
RUBY_CRITICAL({ RUBY_CRITICAL({
r = gethostname(name, len); r = gethostname(name, len);
if (r == SOCKET_ERROR) if (r == SOCKET_ERROR)
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
}); });
return r; return r;
} }
@ -2206,7 +2210,7 @@ rb_w32_getprotobyname (char *name)
RUBY_CRITICAL({ RUBY_CRITICAL({
r = getprotobyname(name); r = getprotobyname(name);
if (r == NULL) if (r == NULL)
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
}); });
return r; return r;
} }
@ -2223,7 +2227,7 @@ rb_w32_getprotobynumber (int num)
RUBY_CRITICAL({ RUBY_CRITICAL({
r = getprotobynumber(num); r = getprotobynumber(num);
if (r == NULL) if (r == NULL)
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
}); });
return r; return r;
} }
@ -2240,7 +2244,7 @@ rb_w32_getservbyname (char *name, char *proto)
RUBY_CRITICAL({ RUBY_CRITICAL({
r = getservbyname(name, proto); r = getservbyname(name, proto);
if (r == NULL) if (r == NULL)
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
}); });
return r; return r;
} }
@ -2257,7 +2261,7 @@ rb_w32_getservbyport (int port, char *proto)
RUBY_CRITICAL({ RUBY_CRITICAL({
r = getservbyport(port, proto); r = getservbyport(port, proto);
if (r == NULL) if (r == NULL)
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
}); });
return r; return r;
} }
@ -2305,7 +2309,7 @@ poll_child_status(struct ChildRecord *child, int *stat_loc)
if (err == ERROR_INVALID_PARAMETER) if (err == ERROR_INVALID_PARAMETER)
errno = ECHILD; errno = ECHILD;
else else
errno = map_errno(); errno = map_errno(GetLastError());
CloseChildHandle(child); CloseChildHandle(child);
return -1; return -1;
} }
@ -2354,7 +2358,7 @@ waitpid (pid_t pid, int *stat_loc, int options)
return -1; return -1;
} }
if (ret > count) { if (ret > count) {
errno = map_errno(); errno = map_errno(GetLastError());
return -1; return -1;
} }
@ -2482,7 +2486,7 @@ kill(int pid, int sig)
if ((err = GetLastError()) == 0) if ((err = GetLastError()) == 0)
errno = EPERM; errno = EPERM;
else else
errno = map_errno(); errno = map_errno(GetLastError());
ret = -1; ret = -1;
} }
}); });
@ -2532,12 +2536,12 @@ link(char *from, char *to)
if (hKernel) { if (hKernel) {
pCreateHardLink = (BOOL (WINAPI *)(LPCTSTR, LPCTSTR, LPSECURITY_ATTRIBUTES))GetProcAddress(hKernel, "CreateHardLinkA"); pCreateHardLink = (BOOL (WINAPI *)(LPCTSTR, LPCTSTR, LPSECURITY_ATTRIBUTES))GetProcAddress(hKernel, "CreateHardLinkA");
if (!pCreateHardLink) { if (!pCreateHardLink) {
myerrno = map_errno(); myerrno = map_errno(GetLastError());
} }
CloseHandle(hKernel); CloseHandle(hKernel);
} }
else { else {
myerrno = map_errno(); myerrno = map_errno(GetLastError());
} }
} }
if (!pCreateHardLink) { if (!pCreateHardLink) {
@ -2546,7 +2550,7 @@ link(char *from, char *to)
} }
if (!pCreateHardLink(to, from, NULL)) { if (!pCreateHardLink(to, from, NULL)) {
errno = map_errno(); errno = map_errno(GetLastError());
return -1; return -1;
} }
@ -2597,7 +2601,7 @@ rb_w32_rename(const char *oldpath, const char *newpath)
newatts = GetFileAttributes(newpath); newatts = GetFileAttributes(newpath);
if (oldatts == -1) { if (oldatts == -1) {
errno = map_errno(); errno = map_errno(GetLastError());
return -1; return -1;
} }
@ -2629,7 +2633,7 @@ rb_w32_rename(const char *oldpath, const char *newpath)
} }
if (res) if (res)
errno = map_errno(); errno = map_errno(GetLastError());
else else
SetFileAttributes(newpath, oldatts); SetFileAttributes(newpath, oldatts);
}); });
@ -3127,7 +3131,7 @@ rb_w32_fclose(FILE *fp)
_set_osfhnd(fd, (SOCKET)INVALID_HANDLE_VALUE); _set_osfhnd(fd, (SOCKET)INVALID_HANDLE_VALUE);
fclose(fp); fclose(fp);
if (closesocket(sock) == SOCKET_ERROR) { if (closesocket(sock) == SOCKET_ERROR) {
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
return -1; return -1;
} }
return 0; return 0;
@ -3143,7 +3147,7 @@ rb_w32_close(int fd)
return _close(fd); return _close(fd);
} }
if (closesocket(sock) == SOCKET_ERROR) { if (closesocket(sock) == SOCKET_ERROR) {
errno = WSAGetLastError() - WSABASEERR; errno = map_errno(WSAGetLastError());
return -1; return -1;
} }
return 0; return 0;
@ -3165,7 +3169,7 @@ unixtime_to_filetime(time_t time, FILETIME *ft)
st.wSecond = tm->tm_sec; st.wSecond = tm->tm_sec;
st.wMilliseconds = 0; st.wMilliseconds = 0;
if (!SystemTimeToFileTime(&st, ft)) { if (!SystemTimeToFileTime(&st, ft)) {
errno = map_errno(); errno = map_errno(GetLastError());
return -1; return -1;
} }
return 0; return 0;
@ -3200,12 +3204,12 @@ rb_w32_utime(const char *path, struct utimbuf *times)
hFile = CreateFile(path, GENERIC_WRITE, 0, 0, OPEN_EXISTING, hFile = CreateFile(path, GENERIC_WRITE, 0, 0, OPEN_EXISTING,
IsWin95() ? 0 : FILE_FLAG_BACKUP_SEMANTICS, 0); IsWin95() ? 0 : FILE_FLAG_BACKUP_SEMANTICS, 0);
if (hFile == INVALID_HANDLE_VALUE) { if (hFile == INVALID_HANDLE_VALUE) {
errno = map_errno(); errno = map_errno(GetLastError());
ret = -1; ret = -1;
} }
else { else {
if (!SetFileTime(hFile, NULL, &atime, &mtime)) { if (!SetFileTime(hFile, NULL, &atime, &mtime)) {
errno = map_errno(); errno = map_errno(GetLastError());
ret = -1; ret = -1;
} }
CloseHandle(hFile); CloseHandle(hFile);

View file

@ -261,9 +261,6 @@ extern char *rb_w32_strerror(int);
#define LOCK_EX 2 #define LOCK_EX 2
#define LOCK_NB 4 #define LOCK_NB 4
#define LOCK_UN 8 #define LOCK_UN 8
#ifndef EWOULDBLOCK
#define EWOULDBLOCK 10035 /* EBASEERR + 35 (winsock.h) */
#endif
#ifndef SIGINT #ifndef SIGINT
@ -277,6 +274,45 @@ extern char *rb_w32_strerror(int);
/* #undef va_start */ /* #undef va_start */
/* #undef va_end */ /* #undef va_end */
/* winsock error map */
#define EWOULDBLOCK WSAEWOULDBLOCK
#define EINPROGRESS WSAEINPROGRESS
#define EALREADY WSAEALREADY
#define ENOTSOCK WSAENOTSOCK
#define EDESTADDRREQ WSAEDESTADDRREQ
#define EMSGSIZE WSAEMSGSIZE
#define EPROTOTYPE WSAEPROTOTYPE
#define ENOPROTOOPT WSAENOPROTOOPT
#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
#define EOPNOTSUPP WSAEOPNOTSUPP
#define EPFNOSUPPORT WSAEPFNOSUPPORT
#define EAFNOSUPPORT WSAEAFNOSUPPORT
#define EADDRINUSE WSAEADDRINUSE
#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
#define ENETDOWN WSAENETDOWN
#define ENETUNREACH WSAENETUNREACH
#define ENETRESET WSAENETRESET
#define ECONNABORTED WSAECONNABORTED
#define ECONNRESET WSAECONNRESET
#define ENOBUFS WSAENOBUFS
#define EISCONN WSAEISCONN
#define ENOTCONN WSAENOTCONN
#define ESHUTDOWN WSAESHUTDOWN
#define ETOOMANYREFS WSAETOOMANYREFS
#define ETIMEDOUT WSAETIMEDOUT
#define ECONNREFUSED WSAECONNREFUSED
#define ELOOP WSAELOOP
/*#define ENAMETOOLONG WSAENAMETOOLONG*/
#define EHOSTDOWN WSAEHOSTDOWN
#define EHOSTUNREACH WSAEHOSTUNREACH
/*#define ENOTEMPTY WSAENOTEMPTY*/
#define EPROCLIM WSAEPROCLIM
#define EUSERS WSAEUSERS
#define EDQUOT WSAEDQUOT
#define ESTALE WSAESTALE
#define EREMOTE WSAEREMOTE
#ifdef accept #ifdef accept
#undef accept #undef accept
#endif #endif