Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

,,

  • Loading branch information...
piscisaureus committed Apr 24, 2013
1 parent ffe2ef0 commit c93cccb8d26816fc9343ae2d97d8ab0ecbcd7f01
Showing with 20,854 additions and 0 deletions.
  1. +139 −0 0001-win-sort-error-code-mappings.patch
  2. +32 −0 0001-win-tcp-don-t-enable-iocp-sync-bypass-when-iocp-emul.patch
  3. +33 −0 0002-win-add-error-mappings-related-to-unsupported-protoc.patch
  4. +111 −0 0003-win-fix-uv_winsock_init-crash-when-no-IPv4-stack-pre.patch
  5. +191 −0 0004-win-tcp-make-uv_tcp_set_socket-set-UV_HANDLE_IPV6.patch
  6. +193 −0 0005-win-udp-make-uv_tcp_set_socket-set-UV_HANDLE_IPV6.patch
  7. +25 −0 0006-win-udp-fix-bug-in-getsockopt-return-value-check.patch
  8. +70 −0 0007-win-get-rid-of-early-ipv6-support-detection.patch
  9. 0 Changelo.txt
  10. 0 a.doc
  11. +53 −0 config-mingw.mk.BACKUP.20344.mk
  12. +53 −0 config-mingw.mk.BACKUP.7224.mk
  13. +61 −0 config-mingw.mk.BASE.20344.mk
  14. +61 −0 config-mingw.mk.BASE.7224.mk
  15. +48 −0 config-mingw.mk.LOCAL.20344.mk
  16. +48 −0 config-mingw.mk.LOCAL.7224.mk
  17. +61 −0 config-mingw.mk.REMOTE.20344.mk
  18. +61 −0 config-mingw.mk.REMOTE.7224.mk
  19. +106 −0 demo/demo.c
  20. BIN foo.exe
  21. BIN libuv-v0.10.2.tar.gz
  22. BIN libuv-v0.10.3.tar.gz
  23. +1 −0 mailmap
  24. BIN run-benchmarks121126.vsp
  25. 0 src/Nieuw tekstdocument.txt
  26. +179 −0 src/threadpool.c
  27. +65 −0 src/version.c.BACKUP.5664.c
  28. +60 −0 src/version.c.BASE.5664.c
  29. +60 −0 src/version.c.LOCAL.5664.c
  30. +60 −0 src/version.c.REMOTE.5664.c
  31. +56 −0 src/win/__history/atomicops-inl.h.~1~
  32. +56 −0 src/win/__history/atomicops-inl.h.~2~
  33. +77 −0 src/win/work.c
  34. +68 −0 test.c
  35. +1 −0 test.js
  36. 0 test/Nieuw tekstdocument.txt
  37. +160 −0 tools/lib/authors.js
  38. +73 −0 tools/lib/git.js
  39. +18 −0 tools/lib/pad.js
  40. +121 −0 tools/lib/relnotes.js
  41. +120 −0 tools/lib/tags.js
  42. +82 −0 tools/lib/version.js
  43. +613 −0 tools/lib/x
  44. +337 −0 tools/release.js
  45. 0 tools/undefined
  46. +17,301 −0 x
@@ -0,0 +1,139 @@
From 7a305a2a517b2e3aa7dcb572a1e8d699f06b6faa Mon Sep 17 00:00:00 2001
From: Bert Belder <bertbelder@gmail.com>
Date: Sat, 26 Jan 2013 02:46:25 +0100
Subject: [PATCH 1/7] win: sort error code mappings

---
src/win/error.c | 72 ++++++++++++++++++++++++++++-----------------------------
1 file changed, 36 insertions(+), 36 deletions(-)

diff --git a/src/win/error.c b/src/win/error.c
index ff79f9c..c72117f 100644
--- a/src/win/error.c
+++ b/src/win/error.c
@@ -66,31 +66,6 @@ void uv_fatal_error(const int errorno, const char* syscall) {
uv_err_code uv_translate_sys_error(int sys_errno) {
switch (sys_errno) {
case ERROR_SUCCESS: return UV_OK;
- case ERROR_BEGINNING_OF_MEDIA: return UV_EIO;
- case ERROR_BUS_RESET: return UV_EIO;
- case ERROR_CRC: return UV_EIO;
- case ERROR_DEVICE_DOOR_OPEN: return UV_EIO;
- case ERROR_DEVICE_REQUIRES_CLEANING: return UV_EIO;
- case ERROR_DISK_CORRUPT: return UV_EIO;
- case ERROR_EOM_OVERFLOW: return UV_EIO;
- case ERROR_FILEMARK_DETECTED: return UV_EIO;
- case ERROR_GEN_FAILURE: return UV_EIO;
- case ERROR_INVALID_BLOCK_LENGTH: return UV_EIO;
- case ERROR_IO_DEVICE: return UV_EIO;
- case ERROR_NO_DATA_DETECTED: return UV_EIO;
- case ERROR_NO_SIGNAL_SENT: return UV_EIO;
- case ERROR_OPEN_FAILED: return UV_EIO;
- case ERROR_SETMARK_DETECTED: return UV_EIO;
- case ERROR_SIGNAL_REFUSED: return UV_EIO;
- case ERROR_DIRECTORY: return UV_ENOENT;
- case ERROR_FILE_NOT_FOUND: return UV_ENOENT;
- case ERROR_INVALID_NAME: return UV_ENOENT;
- case ERROR_INVALID_REPARSE_DATA: return UV_ENOENT;
- case ERROR_MOD_NOT_FOUND: return UV_ENOENT;
- case ERROR_PATH_NOT_FOUND: return UV_ENOENT;
- case WSANO_DATA: return UV_ENOENT;
- case ERROR_ACCESS_DENIED: return UV_EPERM;
- case ERROR_PRIVILEGE_NOT_HELD: return UV_EPERM;
case ERROR_NOACCESS: return UV_EACCES;
case WSAEACCES: return UV_EACCES;
case ERROR_ADDRESS_ALREADY_ASSOCIATED: return UV_EADDRINUSE;
@@ -99,8 +74,14 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case WSAEAFNOSUPPORT: return UV_EAFNOSUPPORT;
case WSAEWOULDBLOCK: return UV_EAGAIN;
case WSAEALREADY: return UV_EALREADY;
+ case ERROR_INVALID_FLAGS: return UV_EBADF;
+ case ERROR_INVALID_HANDLE: return UV_EBADF;
case ERROR_LOCK_VIOLATION: return UV_EBUSY;
+ case ERROR_PIPE_BUSY: return UV_EBUSY;
case ERROR_SHARING_VIOLATION: return UV_EBUSY;
+ case ERROR_OPERATION_ABORTED: return UV_ECANCELED;
+ case WSAEINTR: return UV_ECANCELED;
+ case ERROR_NO_UNICODE_TRANSLATION: return UV_ECHARSET;
case ERROR_CONNECTION_ABORTED: return UV_ECONNABORTED;
case WSAECONNABORTED: return UV_ECONNABORTED;
case ERROR_CONNECTION_REFUSED: return UV_ECONNREFUSED;
@@ -113,11 +94,27 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case WSAEFAULT: return UV_EFAULT;
case ERROR_HOST_UNREACHABLE: return UV_EHOSTUNREACH;
case WSAEHOSTUNREACH: return UV_EHOSTUNREACH;
- case ERROR_OPERATION_ABORTED: return UV_ECANCELED;
- case WSAEINTR: return UV_ECANCELED;
+ case ERROR_INSUFFICIENT_BUFFER: return UV_EINVAL;
case ERROR_INVALID_DATA: return UV_EINVAL;
+ case ERROR_INVALID_PARAMETER: return UV_EINVAL;
case ERROR_SYMLINK_NOT_SUPPORTED: return UV_EINVAL;
case WSAEINVAL: return UV_EINVAL;
+ case ERROR_BEGINNING_OF_MEDIA: return UV_EIO;
+ case ERROR_BUS_RESET: return UV_EIO;
+ case ERROR_CRC: return UV_EIO;
+ case ERROR_DEVICE_DOOR_OPEN: return UV_EIO;
+ case ERROR_DEVICE_REQUIRES_CLEANING: return UV_EIO;
+ case ERROR_DISK_CORRUPT: return UV_EIO;
+ case ERROR_EOM_OVERFLOW: return UV_EIO;
+ case ERROR_FILEMARK_DETECTED: return UV_EIO;
+ case ERROR_GEN_FAILURE: return UV_EIO;
+ case ERROR_INVALID_BLOCK_LENGTH: return UV_EIO;
+ case ERROR_IO_DEVICE: return UV_EIO;
+ case ERROR_NO_DATA_DETECTED: return UV_EIO;
+ case ERROR_NO_SIGNAL_SENT: return UV_EIO;
+ case ERROR_OPEN_FAILED: return UV_EIO;
+ case ERROR_SETMARK_DETECTED: return UV_EIO;
+ case ERROR_SIGNAL_REFUSED: return UV_EIO;
case ERROR_CANT_RESOLVE_FILENAME: return UV_ELOOP;
case ERROR_TOO_MANY_OPEN_FILES: return UV_EMFILE;
case WSAEMFILE: return UV_EMFILE;
@@ -126,6 +123,14 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case ERROR_NETWORK_UNREACHABLE: return UV_ENETUNREACH;
case WSAENETUNREACH: return UV_ENETUNREACH;
case WSAENOBUFS: return UV_ENOBUFS;
+ case ERROR_DIRECTORY: return UV_ENOENT;
+ case ERROR_FILE_NOT_FOUND: return UV_ENOENT;
+ case ERROR_INVALID_NAME: return UV_ENOENT;
+ case ERROR_INVALID_REPARSE_DATA: return UV_ENOENT;
+ case ERROR_MOD_NOT_FOUND: return UV_ENOENT;
+ case ERROR_PATH_NOT_FOUND: return UV_ENOENT;
+ case WSAHOST_NOT_FOUND: return UV_ENOENT;
+ case WSANO_DATA: return UV_ENOENT;
case ERROR_NOT_ENOUGH_MEMORY: return UV_ENOMEM;
case ERROR_OUTOFMEMORY: return UV_ENOMEM;
case ERROR_CANNOT_MAKE: return UV_ENOSPC;
@@ -133,26 +138,21 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case ERROR_EA_TABLE_FULL: return UV_ENOSPC;
case ERROR_END_OF_MEDIA: return UV_ENOSPC;
case ERROR_HANDLE_DISK_FULL: return UV_ENOSPC;
- case ERROR_WRITE_PROTECT: return UV_EROFS;
case ERROR_NOT_CONNECTED: return UV_ENOTCONN;
case WSAENOTCONN: return UV_ENOTCONN;
case ERROR_DIR_NOT_EMPTY: return UV_ENOTEMPTY;
+ case WSAENOTSOCK: return UV_ENOTSOCK;
case ERROR_NOT_SUPPORTED: return UV_ENOTSUP;
- case ERROR_INSUFFICIENT_BUFFER: return UV_EINVAL;
- case ERROR_INVALID_FLAGS: return UV_EBADF;
- case ERROR_INVALID_HANDLE: return UV_EBADF;
- case ERROR_INVALID_PARAMETER: return UV_EINVAL;
- case ERROR_NO_UNICODE_TRANSLATION: return UV_ECHARSET;
case ERROR_BROKEN_PIPE: return UV_EOF;
+ case ERROR_ACCESS_DENIED: return UV_EPERM;
+ case ERROR_PRIVILEGE_NOT_HELD: return UV_EPERM;
case ERROR_BAD_PIPE: return UV_EPIPE;
case ERROR_NO_DATA: return UV_EPIPE;
case ERROR_PIPE_NOT_CONNECTED: return UV_EPIPE;
case WSAESHUTDOWN: return UV_EPIPE;
- case ERROR_PIPE_BUSY: return UV_EBUSY;
+ case ERROR_WRITE_PROTECT: return UV_EROFS;
case ERROR_SEM_TIMEOUT: return UV_ETIMEDOUT;
case WSAETIMEDOUT: return UV_ETIMEDOUT;
- case WSAHOST_NOT_FOUND: return UV_ENOENT;
- case WSAENOTSOCK: return UV_ENOTSOCK;
case ERROR_NOT_SAME_DEVICE: return UV_EXDEV;
default: return UV_UNKNOWN;
}
--
1.8.0.msysgit.0

@@ -0,0 +1,32 @@
From b9e9d4951c106d03f99352274c67d6891c2b5cff Mon Sep 17 00:00:00 2001
From: Bert Belder <bertbelder@gmail.com>
Date: Sat, 9 Mar 2013 20:19:28 +0100
Subject: [PATCH 1/1] win/tcp: don't enable iocp sync bypass when iocp
emulation is used

When iocp sync bypass is in use libuv doesn't expect the system to
generate events when an i/o operation completes synchronously. However
when iocp emulation is enabled an event will always be generated because
SetFileCompletionNotificationModes() doesn't stop OVERLAPPED.hEvent from
becoming signaled.
---
src/win/tcp.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/win/tcp.c b/src/win/tcp.c
index 7158216..c3ef653 100644
--- a/src/win/tcp.c
+++ b/src/win/tcp.c
@@ -113,7 +113,8 @@ static int uv_tcp_set_socket(uv_loop_t* loop, uv_tcp_t* handle,
non_ifs_lsp = uv_tcp_non_ifs_lsp_ipv4;
}

- if (pSetFileCompletionNotificationModes && !non_ifs_lsp) {
+ if (pSetFileCompletionNotificationModes &&
+ !(handle->flags & UV_HANDLE_EMULATE_IOCP) && !non_ifs_lsp) {
if (pSetFileCompletionNotificationModes((HANDLE) socket,
FILE_SKIP_SET_EVENT_ON_HANDLE |
FILE_SKIP_COMPLETION_PORT_ON_SUCCESS)) {
--
1.8.0.msysgit.0

@@ -0,0 +1,33 @@
From 391a3176217165dd26cd8c652491b350709299fb Mon Sep 17 00:00:00 2001
From: Bert Belder <bertbelder@gmail.com>
Date: Sat, 26 Jan 2013 02:46:51 +0100
Subject: [PATCH 2/7] win: add error mappings related to unsupported protocols

---
src/win/error.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/src/win/error.c b/src/win/error.c
index c72117f..40852cf 100644
--- a/src/win/error.c
+++ b/src/win/error.c
@@ -99,6 +99,8 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case ERROR_INVALID_PARAMETER: return UV_EINVAL;
case ERROR_SYMLINK_NOT_SUPPORTED: return UV_EINVAL;
case WSAEINVAL: return UV_EINVAL;
+ case WSAEPFNOSUPPORT: return UV_EINVAL;
+ case WSAESOCKTNOSUPPORT: return UV_EINVAL;
case ERROR_BEGINNING_OF_MEDIA: return UV_EIO;
case ERROR_BUS_RESET: return UV_EIO;
case ERROR_CRC: return UV_EIO;
@@ -150,6 +152,7 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case ERROR_NO_DATA: return UV_EPIPE;
case ERROR_PIPE_NOT_CONNECTED: return UV_EPIPE;
case WSAESHUTDOWN: return UV_EPIPE;
+ case WSAEPROTONOSUPPORT: return UV_EPROTONOSUPPORT;
case ERROR_WRITE_PROTECT: return UV_EROFS;
case ERROR_SEM_TIMEOUT: return UV_ETIMEDOUT;
case WSAETIMEDOUT: return UV_ETIMEDOUT;
--
1.8.0.msysgit.0

@@ -0,0 +1,111 @@
From 9d19cc838cb8854b113edc05e2e106ca98ac4dd4 Mon Sep 17 00:00:00 2001
From: Bert Belder <bertbelder@gmail.com>
Date: Sat, 26 Jan 2013 03:52:32 +0100
Subject: [PATCH 3/7] win: fix uv_winsock_init crash when no IPv4 stack
present

uv_winsock_init() tries to create an IPv4 socket in order to detect
if the system has any layered service providers (LSPs) installed.
When creating this socket failed it would call uv_fatal_error and exit
with the following message:

socket: (10047) An address incompatible with the requested protocol was used.

This patch fixes that. It also includes some minor style tweaks.
---
src/win/winsock.c | 54 +++++++++++++++++++++++++++++++-----------------------
1 file changed, 31 insertions(+), 23 deletions(-)

diff --git a/src/win/winsock.c b/src/win/winsock.c
index 2c3e49a..cbd25af 100644
--- a/src/win/winsock.c
+++ b/src/win/winsock.c
@@ -75,6 +75,12 @@ BOOL uv_get_connectex_function(SOCKET socket, LPFN_CONNECTEX* target) {
}


+static int error_means_no_support(DWORD error) {
+ return error == WSAEPROTONOSUPPORT || error == WSAESOCKTNOSUPPORT ||
+ error == WSAEPFNOSUPPORT || error == WSAEAFNOSUPPORT;
+}
+
+
void uv_winsock_init() {
const GUID wsaid_connectex = WSAID_CONNECTEX;
const GUID wsaid_acceptex = WSAID_ACCEPTEX;
@@ -100,29 +106,30 @@ void uv_winsock_init() {

/* Detect non-IFS LSPs */
dummy = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
- if (dummy == INVALID_SOCKET) {
- uv_fatal_error(WSAGetLastError(), "socket");
- }

- opt_len = (int) sizeof protocol_info;
- if (!getsockopt(dummy,
- SOL_SOCKET,
- SO_PROTOCOL_INFOW,
- (char*) &protocol_info,
- &opt_len) == SOCKET_ERROR) {
- uv_fatal_error(WSAGetLastError(), "socket");
- }
+ if (dummy != INVALID_SOCKET) {
+ opt_len = (int) sizeof protocol_info;
+ if (!getsockopt(dummy,
+ SOL_SOCKET,
+ SO_PROTOCOL_INFOW,
+ (char*) &protocol_info,
+ &opt_len) == SOCKET_ERROR)
+ uv_fatal_error(WSAGetLastError(), "getsockopt");

- if (!(protocol_info.dwServiceFlags1 & XP1_IFS_HANDLES)) {
- uv_tcp_non_ifs_lsp_ipv4 = 1;
- }
+ if (!(protocol_info.dwServiceFlags1 & XP1_IFS_HANDLES))
+ uv_tcp_non_ifs_lsp_ipv4 = 1;
+
+ if (closesocket(dummy) == SOCKET_ERROR)
+ uv_fatal_error(WSAGetLastError(), "closesocket");

- if (closesocket(dummy) == SOCKET_ERROR) {
- uv_fatal_error(WSAGetLastError(), "closesocket");
+ } else if (!error_means_no_support(WSAGetLastError())) {
+ /* Any error other than "socket type not supported" is fatal. */
+ uv_fatal_error(WSAGetLastError(), "socket");
}

/* Detect IPV6 support and non-IFS LSPs */
dummy = socket(AF_INET6, SOCK_STREAM, IPPROTO_IP);
+
if (dummy != INVALID_SOCKET) {
uv_allow_ipv6 = TRUE;

@@ -131,17 +138,18 @@ void uv_winsock_init() {
SOL_SOCKET,
SO_PROTOCOL_INFOW,
(char*) &protocol_info,
- &opt_len) == SOCKET_ERROR) {
- uv_fatal_error(WSAGetLastError(), "socket");
- }
+ &opt_len) == SOCKET_ERROR)
+ uv_fatal_error(WSAGetLastError(), "getsockopt");

- if (!(protocol_info.dwServiceFlags1 & XP1_IFS_HANDLES)) {
+ if (!(protocol_info.dwServiceFlags1 & XP1_IFS_HANDLES))
uv_tcp_non_ifs_lsp_ipv6 = 1;
- }

- if (closesocket(dummy) == SOCKET_ERROR) {
+ if (closesocket(dummy) == SOCKET_ERROR)
uv_fatal_error(WSAGetLastError(), "closesocket");
- }
+
+ } else if (!error_means_no_support(WSAGetLastError())) {
+ /* Any error other than "socket type not supported" is fatal. */
+ uv_fatal_error(WSAGetLastError(), "socket");
}
}

--
1.8.0.msysgit.0

0 comments on commit c93cccb

Please sign in to comment.
You can’t perform that action at this time.