ext/asyncengine/libuv/include/uv-private/uv-win.h in asyncengine-0.0.1.testing1 vs ext/asyncengine/libuv/include/uv-private/uv-win.h in asyncengine-0.0.2.alpha1
- old
+ new
@@ -30,13 +30,18 @@
#include <ws2tcpip.h>
#include <windows.h>
#include <sys/stat.h>
#include "tree.h"
+#include "ngx-queue.h"
#define MAX_PIPENAME_LEN 256
+#ifndef S_IFLNK
+# define S_IFLNK 0xA000
+#endif
+
/*
* Guids and typedefs for winsock extension functions
* Mingw32 doesn't have these :-(
*/
#ifndef WSAID_ACCEPTEX
@@ -113,12 +118,11 @@
LPWSABUF buffers,
DWORD buffer_count,
LPDWORD bytes,
LPDWORD flags,
LPWSAOVERLAPPED overlapped,
- LPWSAOVERLAPPED_COMPLETION_ROUTINE
- completion_routine);
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine);
typedef int (WSAAPI* LPFN_WSARECVFROM)
(SOCKET socket,
LPWSABUF buffers,
DWORD buffer_count,
@@ -127,11 +131,31 @@
struct sockaddr* addr,
LPINT addr_len,
LPWSAOVERLAPPED overlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine);
+#ifndef _NTDEF_
+ typedef LONG NTSTATUS;
+ typedef NTSTATUS *PNTSTATUS;
+#endif
+typedef struct _AFD_POLL_HANDLE_INFO {
+ HANDLE Handle;
+ ULONG Events;
+ NTSTATUS Status;
+} AFD_POLL_HANDLE_INFO, *PAFD_POLL_HANDLE_INFO;
+
+typedef struct _AFD_POLL_INFO {
+ LARGE_INTEGER Timeout;
+ ULONG NumberOfHandles;
+ ULONG Exclusive;
+ AFD_POLL_HANDLE_INFO Handles[1];
+} AFD_POLL_INFO, *PAFD_POLL_INFO;
+
+#define UV_MSAFD_PROVIDER_COUNT 3
+
+
/**
* It should be possible to cast uv_buf_t[] to WSABUF[]
* see http://msdn.microsoft.com/en-us/library/ms741542(v=vs.85).aspx
*/
typedef struct uv_buf_t {
@@ -139,12 +163,18 @@
char* base;
} uv_buf_t;
typedef int uv_file;
+typedef struct _stati64 uv_statbuf_t;
+
+typedef SOCKET uv_os_sock_t;
+
typedef HANDLE uv_thread_t;
+typedef HANDLE uv_sem_t;
+
typedef CRITICAL_SECTION uv_mutex_t;
typedef union {
/* srwlock_ has type SRWLOCK, but not all toolchains define this type in */
/* windows.h. */
@@ -164,21 +194,26 @@
/* practice it might overlap padding a little. */
HANDLE event;
HANDLE padding;
} uv_once_t;
+/* Platform-specific definitions for uv_spawn support. */
+typedef unsigned char uv_uid_t;
+typedef unsigned char uv_gid_t;
+
/* Platform-specific definitions for uv_dlopen support. */
-typedef HMODULE uv_lib_t;
#define UV_DYNAMIC FAR WINAPI
+typedef struct {
+ HMODULE handle;
+ char* errmsg;
+} uv_lib_t;
RB_HEAD(uv_timer_tree_s, uv_timer_s);
#define UV_LOOP_PRIVATE_FIELDS \
/* The loop's I/O completion port */ \
HANDLE iocp; \
- /* Reference count that keeps the event loop alive */ \
- int refs; \
/* The current time according to the event loop. in msecs. */ \
int64_t time; \
/* Tail of a single-linked circular queue of pending reqs. If the queue */ \
/* is empty, tail_ is NULL. If there is only one item, */ \
/* tail_->next_req == tail_ */ \
@@ -196,28 +231,22 @@
/* safe removal from one of the lists above while that list being */ \
/* iterated over. */ \
uv_prepare_t* next_prepare_handle; \
uv_check_t* next_check_handle; \
uv_idle_t* next_idle_handle; \
- ares_channel ares_chan; \
- int ares_active_sockets; \
- uv_timer_t ares_polling_timer; \
+ /* This handle holds the peer sockets for the fast variant of uv_poll_t */ \
+ SOCKET poll_peer_sockets[UV_MSAFD_PROVIDER_COUNT]; \
/* Counter to keep track of active tcp streams */ \
unsigned int active_tcp_streams; \
/* Counter to keep track of active udp streams */ \
unsigned int active_udp_streams;
-#define UV_HANDLE_TYPE_PRIVATE \
- UV_ARES_EVENT,
-
#define UV_REQ_TYPE_PRIVATE \
/* TODO: remove the req suffix */ \
UV_ACCEPT, \
- UV_ARES_EVENT_REQ, \
- UV_ARES_CLEANUP_REQ, \
UV_FS_EVENT_REQ, \
- UV_GETADDRINFO_REQ, \
+ UV_POLL_REQ, \
UV_PROCESS_EXIT, \
UV_PROCESS_CLOSE, \
UV_READ, \
UV_UDP_RECV, \
UV_WAKEUP,
@@ -276,10 +305,11 @@
#define uv_stream_server_fields \
uv_connection_cb connection_cb;
#define UV_STREAM_PRIVATE_FIELDS \
unsigned int reqs_pending; \
+ int activecnt; \
uv_read_t read_req; \
union { \
struct { uv_stream_connection_fields }; \
struct { uv_stream_server_fields }; \
};
@@ -303,10 +333,11 @@
};
#define UV_UDP_PRIVATE_FIELDS \
SOCKET socket; \
unsigned int reqs_pending; \
+ int activecnt; \
uv_req_t recv_req; \
uv_buf_t recv_buffer; \
struct sockaddr_storage recv_from; \
int recv_from_len; \
uv_udp_recv_cb recv_cb; \
@@ -322,10 +353,11 @@
#define uv_pipe_connection_fields \
uv_timer_t* eof_timer; \
uv_write_t ipc_header_write_req; \
int ipc_pid; \
uint64_t remaining_ipc_rawdata_bytes; \
+ unsigned char reserved[sizeof(void*)]; \
struct { \
WSAPROTOCOL_INFOW* socket_info; \
int tcp_connection; \
} pending_ipc_info; \
uv_write_t* non_overlapped_writes_tail;
@@ -363,10 +395,25 @@
unsigned char ansi_csi_argc; \
unsigned short ansi_csi_argv[4]; \
COORD saved_position; \
WORD saved_attributes;
+#define UV_POLL_PRIVATE_FIELDS \
+ SOCKET socket; \
+ /* Used in fast mode */ \
+ SOCKET peer_socket; \
+ AFD_POLL_INFO afd_poll_info_1; \
+ AFD_POLL_INFO afd_poll_info_2; \
+ /* Used in fast and slow mode. */ \
+ uv_req_t poll_req_1; \
+ uv_req_t poll_req_2; \
+ unsigned char submitted_events_1; \
+ unsigned char submitted_events_2; \
+ unsigned char mask_events_1; \
+ unsigned char mask_events_2; \
+ unsigned char events;
+
#define UV_TIMER_PRIVATE_FIELDS \
RB_ENTRY(uv_timer_s) tree_entry; \
int64_t due; \
int64_t repeat; \
uv_timer_cb timer_cb;
@@ -395,11 +442,10 @@
#define UV_HANDLE_PRIVATE_FIELDS \
uv_handle_t* endgame_next; \
unsigned int flags;
#define UV_GETADDRINFO_PRIVATE_FIELDS \
- struct uv_req_s getadddrinfo_req; \
uv_getaddrinfo_cb getaddrinfo_cb; \
void* alloc; \
wchar_t* node; \
wchar_t* service; \
struct addrinfoW* hints; \
@@ -411,31 +457,37 @@
UV_REQ_FIELDS \
} exit_req; \
struct uv_process_close_s { \
UV_REQ_FIELDS \
} close_req; \
- HANDLE child_stdio[3]; \
+ BYTE* child_stdio_buffer; \
int exit_signal; \
DWORD spawn_errno; \
HANDLE wait_handle; \
HANDLE process_handle; \
HANDLE close_handle;
#define UV_FS_PRIVATE_FIELDS \
- wchar_t* pathw; \
int flags; \
DWORD sys_errno_; \
- struct _stati64 stat; \
- void* arg0; \
union { \
+ wchar_t* pathw; \
+ int file; \
+ }; \
+ union { \
struct { \
- void* arg1; \
- void* arg2; \
- void* arg3; \
+ int mode; \
+ wchar_t* new_pathw; \
+ int file_flags; \
+ int file_out; \
+ void* buf; \
+ size_t length; \
+ int64_t offset; \
}; \
+ struct _stati64 stat; \
struct { \
- ssize_t arg4; \
- ssize_t arg5; \
+ double atime; \
+ double mtime; \
}; \
};
#define UV_WORK_PRIVATE_FIELDS \