23# define _WIN32_WINNT 0x0600
26#if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED)
28# define SSIZE_MAX INTPTR_MAX
30# define _SSIZE_T_DEFINED
35#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
36typedef struct pollfd {
40} WSAPOLLFD, *PWSAPOLLFD, *LPWSAPOLLFD;
43#ifndef LOCALE_INVARIANT
44# define LOCALE_INVARIANT 0x007f
49#define _TCP_INITIAL_RTO_PARAMETERS _TCP_INITIAL_RTO_PARAMETERS__AVOID
50#define TCP_INITIAL_RTO_PARAMETERS TCP_INITIAL_RTO_PARAMETERS__AVOID
51#define PTCP_INITIAL_RTO_PARAMETERS PTCP_INITIAL_RTO_PARAMETERS__AVOID
53#undef _TCP_INITIAL_RTO_PARAMETERS
54#undef TCP_INITIAL_RTO_PARAMETERS
55#undef PTCP_INITIAL_RTO_PARAMETERS
68#define MAX_PIPENAME_LEN 256
71# define S_IFLNK 0xA000
94#if defined(NSIG) && NSIG <= SIGWINCH
98# define NSIG SIGWINCH + 1
103#ifndef SIGABRT_COMPAT
104# define SIGABRT_COMPAT 6
111#ifndef WSAID_ACCEPTEX
112# define WSAID_ACCEPTEX \
113 {0xb5367df1, 0xcbac, 0x11cf, \
114 {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
116# define WSAID_CONNECTEX \
117 {0x25a207b9, 0xddf3, 0x4660, \
118 {0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}}
120# define WSAID_GETACCEPTEXSOCKADDRS \
121 {0xb5367df2, 0xcbac, 0x11cf, \
122 {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
124# define WSAID_DISCONNECTEX \
125 {0x7fda2e11, 0x8630, 0x436f, \
126 {0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}}
128# define WSAID_TRANSMITFILE \
129 {0xb5367df0, 0xcbac, 0x11cf, \
130 {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
133 (SOCKET sListenSocket,
134 SOCKET sAcceptSocket,
135 PVOID lpOutputBuffer,
136 DWORD dwReceiveDataLength,
137 DWORD dwLocalAddressLength,
138 DWORD dwRemoteAddressLength,
139 LPDWORD lpdwBytesReceived,
140 LPOVERLAPPED lpOverlapped);
144 const struct sockaddr*
name,
147 DWORD dwSendDataLength,
148 LPDWORD lpdwBytesSent,
149 LPOVERLAPPED lpOverlapped);
152 (PVOID lpOutputBuffer,
153 DWORD dwReceiveDataLength,
154 DWORD dwLocalAddressLength,
155 DWORD dwRemoteAddressLength,
156 LPSOCKADDR* LocalSockaddr,
157 LPINT LocalSockaddrLength,
158 LPSOCKADDR* RemoteSockaddr,
159 LPINT RemoteSockaddrLength);
163 LPOVERLAPPED lpOverlapped,
170 DWORD nNumberOfBytesToWrite,
171 DWORD nNumberOfBytesPerSend,
172 LPOVERLAPPED lpOverlapped,
173 LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers,
186 LPWSAOVERLAPPED overlapped,
187 LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine);
195 struct sockaddr* addr,
197 LPWSAOVERLAPPED overlapped,
198 LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine);
201#pragma warning(disable : 28251)
210#ifndef RTL_CONDITION_VARIABLE_INIT
227#define UV_MSAFD_PROVIDER_COUNT 4
271 unsigned char padding_[72];
273 unsigned char padding_[44];
289#define UV_ONCE_INIT { 0, NULL }
305#define UV_DIR_PRIVATE_FIELDS \
307 WIN32_FIND_DATAW find_data; \
310#define HAVE_DIRENT_TYPES
311#define UV__DT_DIR UV_DIRENT_DIR
312#define UV__DT_FILE UV_DIRENT_FILE
313#define UV__DT_LINK UV_DIRENT_LINK
314#define UV__DT_FIFO UV_DIRENT_FIFO
315#define UV__DT_SOCKET UV_DIRENT_SOCKET
316#define UV__DT_CHAR UV_DIRENT_CHAR
317#define UV__DT_BLOCK UV_DIRENT_BLOCK
320#define UV_DYNAMIC FAR WINAPI
326#define UV_LOOP_PRIVATE_FIELDS \
334 uv_req_t* pending_reqs_tail; \
336 uv_handle_t* endgame_handles; \
340 uv_prepare_t* prepare_handles; \
341 uv_check_t* check_handles; \
342 uv_idle_t* idle_handles; \
347 uv_prepare_t* next_prepare_handle; \
348 uv_check_t* next_check_handle; \
349 uv_idle_t* next_idle_handle; \
351 SOCKET poll_peer_sockets[UV_MSAFD_PROVIDER_COUNT]; \
353 unsigned int active_tcp_streams; \
355 unsigned int active_udp_streams; \
357 uint64_t timer_counter; \
360 uv_mutex_t wq_mutex; \
363#define UV_REQ_TYPE_PRIVATE \
374#define UV_REQ_PRIVATE_FIELDS \
378 OVERLAPPED overlapped; \
379 size_t queued_bytes; \
385 DWORD duplex_flags; \
388 struct uv_req_s* next_req;
390#define UV_WRITE_PRIVATE_FIELDS \
392 uv_buf_t write_buffer; \
393 HANDLE event_handle; \
396#define UV_CONNECT_PRIVATE_FIELDS \
399#define UV_SHUTDOWN_PRIVATE_FIELDS \
402#define UV_UDP_SEND_PRIVATE_FIELDS \
405#define UV_PRIVATE_REQ_TYPES \
406 typedef struct uv_pipe_accept_s { \
409 struct uv_pipe_accept_s* next_pending; \
410 } uv_pipe_accept_t; \
412 typedef struct uv_tcp_accept_s { \
414 SOCKET accept_socket; \
415 char accept_buffer[sizeof(struct sockaddr_storage) * 2 + 32]; \
416 HANDLE event_handle; \
417 HANDLE wait_handle; \
418 struct uv_tcp_accept_s* next_pending; \
421 typedef struct uv_read_s { \
423 HANDLE event_handle; \
424 HANDLE wait_handle; \
427#define uv_stream_connection_fields \
428 unsigned int write_reqs_pending; \
429 uv_shutdown_t* shutdown_req;
431#define uv_stream_server_fields \
432 uv_connection_cb connection_cb;
434#define UV_STREAM_PRIVATE_FIELDS \
435 unsigned int reqs_pending; \
437 uv_read_t read_req; \
439 struct { uv_stream_connection_fields } conn; \
440 struct { uv_stream_server_fields } serv; \
443#define uv_tcp_server_fields \
444 uv_tcp_accept_t* accept_reqs; \
445 unsigned int processed_accepts; \
446 uv_tcp_accept_t* pending_accepts; \
447 LPFN_ACCEPTEX func_acceptex;
449#define uv_tcp_connection_fields \
450 uv_buf_t read_buffer; \
451 LPFN_CONNECTEX func_connectex;
453#define UV_TCP_PRIVATE_FIELDS \
457 struct { uv_tcp_server_fields } serv; \
458 struct { uv_tcp_connection_fields } conn; \
461#define UV_UDP_PRIVATE_FIELDS \
463 unsigned int reqs_pending; \
466 uv_buf_t recv_buffer; \
467 struct sockaddr_storage recv_from; \
469 uv_udp_recv_cb recv_cb; \
470 uv_alloc_cb alloc_cb; \
471 LPFN_WSARECV func_wsarecv; \
472 LPFN_WSARECVFROM func_wsarecvfrom;
474#define uv_pipe_server_fields \
475 int pending_instances; \
476 uv_pipe_accept_t* accept_reqs; \
477 uv_pipe_accept_t* pending_accepts;
479#define uv_pipe_connection_fields \
480 uv_timer_t* eof_timer; \
482 DWORD ipc_remote_pid; \
484 uint32_t payload_remaining; \
487 void* ipc_xfer_queue[2]; \
488 int ipc_xfer_queue_length; \
489 uv_write_t* non_overlapped_writes_tail; \
490 CRITICAL_SECTION readfile_thread_lock; \
491 volatile HANDLE readfile_thread_handle;
493#define UV_PIPE_PRIVATE_FIELDS \
497 struct { uv_pipe_server_fields } serv; \
498 struct { uv_pipe_connection_fields } conn; \
503#define UV_TTY_PRIVATE_FIELDS \
510 uv_buf_t read_line_buffer; \
511 HANDLE read_raw_wait; \
514 unsigned char last_key_offset; \
515 unsigned char last_key_len; \
516 WCHAR last_utf16_high_surrogate; \
517 INPUT_RECORD last_input_record; \
522 unsigned int utf8_codepoint; \
523 unsigned char utf8_bytes_left; \
525 unsigned char previous_eol; \
527 unsigned short ansi_parser_state; \
528 unsigned char ansi_csi_argc; \
529 unsigned short ansi_csi_argv[4]; \
530 COORD saved_position; \
531 WORD saved_attributes; \
535#define UV_POLL_PRIVATE_FIELDS \
538 SOCKET peer_socket; \
539 AFD_POLL_INFO afd_poll_info_1; \
540 AFD_POLL_INFO afd_poll_info_2; \
542 uv_req_t poll_req_1; \
543 uv_req_t poll_req_2; \
544 unsigned char submitted_events_1; \
545 unsigned char submitted_events_2; \
546 unsigned char mask_events_1; \
547 unsigned char mask_events_2; \
548 unsigned char events;
550#define UV_TIMER_PRIVATE_FIELDS \
551 void* heap_node[3]; \
556 uv_timer_cb timer_cb;
558#define UV_ASYNC_PRIVATE_FIELDS \
559 struct uv_req_s async_req; \
560 uv_async_cb async_cb; \
562 char volatile async_sent;
564#define UV_PREPARE_PRIVATE_FIELDS \
565 uv_prepare_t* prepare_prev; \
566 uv_prepare_t* prepare_next; \
567 uv_prepare_cb prepare_cb;
569#define UV_CHECK_PRIVATE_FIELDS \
570 uv_check_t* check_prev; \
571 uv_check_t* check_next; \
572 uv_check_cb check_cb;
574#define UV_IDLE_PRIVATE_FIELDS \
575 uv_idle_t* idle_prev; \
576 uv_idle_t* idle_next; \
579#define UV_HANDLE_PRIVATE_FIELDS \
580 uv_handle_t* endgame_next; \
583#define UV_GETADDRINFO_PRIVATE_FIELDS \
584 struct uv__work work_req; \
585 uv_getaddrinfo_cb getaddrinfo_cb; \
592 struct addrinfoW* addrinfow; \
593 struct addrinfo* addrinfo; \
596#define UV_GETNAMEINFO_PRIVATE_FIELDS \
597 struct uv__work work_req; \
598 uv_getnameinfo_cb getnameinfo_cb; \
599 struct sockaddr_storage storage; \
601 char host[NI_MAXHOST]; \
602 char service[NI_MAXSERV]; \
605#define UV_PROCESS_PRIVATE_FIELDS \
606 struct uv_process_exit_s { \
609 BYTE* child_stdio_buffer; \
611 HANDLE wait_handle; \
612 HANDLE process_handle; \
613 volatile char exit_cb_pending;
615#define UV_FS_PRIVATE_FIELDS \
616 struct uv__work work_req; \
630 unsigned int nbufs; \
633 uv_buf_t bufsml[4]; \
641#define UV_WORK_PRIVATE_FIELDS \
642 struct uv__work work_req;
644#define UV_FS_EVENT_PRIVATE_FIELDS \
645 struct uv_fs_event_req_s { \
652 WCHAR* short_filew; \
656#define UV_SIGNAL_PRIVATE_FIELDS \
657 RB_ENTRY(uv_signal_s) tree_entry; \
658 struct uv_req_s signal_req; \
659 unsigned long pending_signum;
675#define UV_FS_O_APPEND _O_APPEND
676#define UV_FS_O_CREAT _O_CREAT
677#define UV_FS_O_EXCL _O_EXCL
678#define UV_FS_O_FILEMAP 0x20000000
679#define UV_FS_O_RANDOM _O_RANDOM
680#define UV_FS_O_RDONLY _O_RDONLY
681#define UV_FS_O_RDWR _O_RDWR
682#define UV_FS_O_SEQUENTIAL _O_SEQUENTIAL
683#define UV_FS_O_SHORT_LIVED _O_SHORT_LIVED
684#define UV_FS_O_TEMPORARY _O_TEMPORARY
685#define UV_FS_O_TRUNC _O_TRUNC
686#define UV_FS_O_WRONLY _O_WRONLY
689#define UV_FS_O_DIRECT 0x02000000
690#define UV_FS_O_DIRECTORY 0
691#define UV_FS_O_DSYNC 0x04000000
692#define UV_FS_O_EXLOCK 0x10000000
693#define UV_FS_O_NOATIME 0
694#define UV_FS_O_NOCTTY 0
695#define UV_FS_O_NOFOLLOW 0
696#define UV_FS_O_NONBLOCK 0
697#define UV_FS_O_SYMLINK 0
698#define UV_FS_O_SYNC 0x08000000
Definition: format.h:3841
flags
Definition: http_parser.h:206
HANDLE Handle
Definition: win.h:215
ULONG Events
Definition: win.h:216
NTSTATUS Status
Definition: win.h:217
LARGE_INTEGER Timeout
Definition: win.h:221
ULONG NumberOfHandles
Definition: win.h:222
ULONG Exclusive
Definition: win.h:223
AFD_POLL_HANDLE_INFO Handles[1]
Definition: win.h:224
int d_type
Definition: win.h:301
char d_name[1]
Definition: win.h:302
unsigned int n
Definition: win.h:278
uv_mutex_t mutex
Definition: win.h:280
uv_sem_t turnstile2
Definition: win.h:282
unsigned int count
Definition: win.h:279
uv_sem_t turnstile1
Definition: win.h:281
It should be possible to cast uv_buf_t[] to WSABUF[] see http://msdn.microsoft.com/en-us/library/ms74...
Definition: win.h:234
char * base
Definition: win.h:236
ULONG len
Definition: win.h:235
DWORD tls_index
Definition: win.h:286
char * errmsg
Definition: win.h:323
HMODULE handle
Definition: win.h:322
HANDLE event
Definition: win.h:293
unsigned char ran
Definition: win.h:292
SRWLOCK read_write_lock_
Definition: win.h:268
CONDITION_VARIABLE cond_var
Definition: win.h:258
CRITICAL_SECTION waiters_count_lock
Definition: win.h:261
unsigned int waiters_count
Definition: win.h:260
HANDLE signal_event
Definition: win.h:262
HANDLE broadcast_event
Definition: win.h:263
pthread_cond_t uv_cond_t
Definition: unix.h:130
pthread_rwlock_t uv_rwlock_t
Definition: unix.h:128
pthread_key_t uv_key_t
Definition: unix.h:131
BOOL(PASCAL * LPFN_DISCONNECTEX)(SOCKET hSocket, LPOVERLAPPED lpOverlapped, DWORD dwFlags, DWORD reserved)
Definition: win.h:162
struct _AFD_POLL_HANDLE_INFO AFD_POLL_HANDLE_INFO
void(PASCAL * LPFN_GETACCEPTEXSOCKADDRS)(PVOID lpOutputBuffer, DWORD dwReceiveDataLength, DWORD dwLocalAddressLength, DWORD dwRemoteAddressLength, LPSOCKADDR *LocalSockaddr, LPINT LocalSockaddrLength, LPSOCKADDR *RemoteSockaddr, LPINT RemoteSockaddrLength)
Definition: win.h:152
struct _AFD_POLL_INFO * PAFD_POLL_INFO
int uv_pid_t
Definition: win.h:242
BOOL(PASCAL * LPFN_TRANSMITFILE)(SOCKET hSocket, HANDLE hFile, DWORD nNumberOfBytesToWrite, DWORD nNumberOfBytesPerSend, LPOVERLAPPED lpOverlapped, LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers, DWORD dwFlags)
Definition: win.h:168
HANDLE uv_os_fd_t
Definition: win.h:241
RTL_SRWLOCK * PSRWLOCK
Definition: win.h:177
BOOL(PASCAL * LPFN_ACCEPTEX)(SOCKET sListenSocket, SOCKET sAcceptSocket, PVOID lpOutputBuffer, DWORD dwReceiveDataLength, DWORD dwLocalAddressLength, DWORD dwRemoteAddressLength, LPDWORD lpdwBytesReceived, LPOVERLAPPED lpOverlapped)
Definition: win.h:133
struct uv_buf_t uv_buf_t
It should be possible to cast uv_buf_t[] to WSABUF[] see http://msdn.microsoft.com/en-us/library/ms74...
BOOL(PASCAL * LPFN_CONNECTEX)(SOCKET s, const struct sockaddr *name, int namelen, PVOID lpSendBuffer, DWORD dwSendDataLength, LPDWORD lpdwBytesSent, LPOVERLAPPED lpOverlapped)
Definition: win.h:143
int(WSAAPI * LPFN_WSARECV)(SOCKET socket, LPWSABUF buffers, DWORD buffer_count, LPDWORD bytes, LPDWORD flags, LPWSAOVERLAPPED overlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine)
Definition: win.h:181
int uv_file
Definition: win.h:239
struct _AFD_POLL_INFO AFD_POLL_INFO
SOCKET uv_os_sock_t
Definition: win.h:240
LONG NTSTATUS
Definition: win.h:204
CRITICAL_SECTION uv_mutex_t
Definition: win.h:248
unsigned char uv_uid_t
Definition: win.h:297
PVOID CONDITION_VARIABLE
Definition: win.h:211
RTL_SRWLOCK SRWLOCK
Definition: win.h:177
PVOID RTL_SRWLOCK
Definition: win.h:176
HANDLE uv_sem_t
Definition: win.h:246
struct uv_once_s uv_once_t
unsigned char uv_gid_t
Definition: win.h:298
NTSTATUS * PNTSTATUS
Definition: win.h:205
HANDLE uv_thread_t
Definition: win.h:244
int(WSAAPI * LPFN_WSARECVFROM)(SOCKET socket, LPWSABUF buffers, DWORD buffer_count, LPDWORD bytes, LPDWORD flags, struct sockaddr *addr, LPINT addr_len, LPWSAOVERLAPPED overlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine)
Definition: win.h:190
struct uv__dirent_s uv__dirent_t
intptr_t ssize_t
Definition: win.h:27
struct _AFD_POLL_HANDLE_INFO * PAFD_POLL_HANDLE_INFO
PVOID * PCONDITION_VARIABLE
Definition: win.h:211