23# define _WIN32_WINNT 0x0A00
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
67#define MAX_PIPENAME_LEN 256
70# define S_IFLNK 0xA000
74#if defined(_CRT_INTERNAL_NONSTDC_NAMES) && _CRT_INTERNAL_NONSTDC_NAMES && !defined(S_IFIFO)
75# define S_IFIFO _S_IFIFO
98#if defined(NSIG) && NSIG <= SIGWINCH
102# define NSIG SIGWINCH + 1
107#ifndef SIGABRT_COMPAT
108# define SIGABRT_COMPAT 6
115#ifndef WSAID_ACCEPTEX
116# define WSAID_ACCEPTEX \
117 {0xb5367df1, 0xcbac, 0x11cf, \
118 {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
120# define WSAID_CONNECTEX \
121 {0x25a207b9, 0xddf3, 0x4660, \
122 {0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}}
124# define WSAID_GETACCEPTEXSOCKADDRS \
125 {0xb5367df2, 0xcbac, 0x11cf, \
126 {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
128# define WSAID_DISCONNECTEX \
129 {0x7fda2e11, 0x8630, 0x436f, \
130 {0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}}
132# define WSAID_TRANSMITFILE \
133 {0xb5367df0, 0xcbac, 0x11cf, \
134 {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
137 (SOCKET sListenSocket,
138 SOCKET sAcceptSocket,
139 PVOID lpOutputBuffer,
140 DWORD dwReceiveDataLength,
141 DWORD dwLocalAddressLength,
142 DWORD dwRemoteAddressLength,
143 LPDWORD lpdwBytesReceived,
144 LPOVERLAPPED lpOverlapped);
148 const struct sockaddr*
name,
151 DWORD dwSendDataLength,
152 LPDWORD lpdwBytesSent,
153 LPOVERLAPPED lpOverlapped);
156 (PVOID lpOutputBuffer,
157 DWORD dwReceiveDataLength,
158 DWORD dwLocalAddressLength,
159 DWORD dwRemoteAddressLength,
160 LPSOCKADDR* LocalSockaddr,
161 LPINT LocalSockaddrLength,
162 LPSOCKADDR* RemoteSockaddr,
163 LPINT RemoteSockaddrLength);
167 LPOVERLAPPED lpOverlapped,
174 DWORD nNumberOfBytesToWrite,
175 DWORD nNumberOfBytesPerSend,
176 LPOVERLAPPED lpOverlapped,
177 LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers,
190 LPWSAOVERLAPPED overlapped,
191 LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine);
199 struct sockaddr* addr,
201 LPWSAOVERLAPPED overlapped,
202 LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine);
205#pragma warning(disable : 28251)
214#ifndef RTL_CONDITION_VARIABLE_INIT
231#define UV_MSAFD_PROVIDER_COUNT 4
275 unsigned char padding_[72];
277 unsigned char padding_[44];
294#define UV_ONCE_INIT { 0, NULL }
310#define UV_DIR_PRIVATE_FIELDS \
312 WIN32_FIND_DATAW find_data; \
315#define HAVE_DIRENT_TYPES
316#define UV__DT_DIR UV_DIRENT_DIR
317#define UV__DT_FILE UV_DIRENT_FILE
318#define UV__DT_LINK UV_DIRENT_LINK
319#define UV__DT_FIFO UV_DIRENT_FIFO
320#define UV__DT_SOCKET UV_DIRENT_SOCKET
321#define UV__DT_CHAR UV_DIRENT_CHAR
322#define UV__DT_BLOCK UV_DIRENT_BLOCK
325#define UV_DYNAMIC FAR WINAPI
331#define UV_LOOP_PRIVATE_FIELDS \
339 uv_req_t* pending_reqs_tail; \
341 uv_handle_t* endgame_handles; \
345 uv_prepare_t* prepare_handles; \
346 uv_check_t* check_handles; \
347 uv_idle_t* idle_handles; \
352 uv_prepare_t* next_prepare_handle; \
353 uv_check_t* next_check_handle; \
354 uv_idle_t* next_idle_handle; \
356 SOCKET poll_peer_sockets[UV_MSAFD_PROVIDER_COUNT]; \
358 unsigned int active_tcp_streams; \
360 unsigned int active_udp_streams; \
362 uint64_t timer_counter; \
364 struct uv__queue wq; \
365 uv_mutex_t wq_mutex; \
368#define UV_REQ_TYPE_PRIVATE \
379#define UV_REQ_PRIVATE_FIELDS \
383 OVERLAPPED overlapped; \
384 size_t queued_bytes; \
390 DWORD duplex_flags; \
394 struct uv_req_s* next_req;
396#define UV_WRITE_PRIVATE_FIELDS \
398 uv_buf_t write_buffer; \
399 HANDLE event_handle; \
402#define UV_CONNECT_PRIVATE_FIELDS \
405#define UV_SHUTDOWN_PRIVATE_FIELDS \
408#define UV_UDP_SEND_PRIVATE_FIELDS \
411#define UV_PRIVATE_REQ_TYPES \
412 typedef struct uv_pipe_accept_s { \
415 struct uv_pipe_accept_s* next_pending; \
416 } uv_pipe_accept_t; \
418 typedef struct uv_tcp_accept_s { \
420 SOCKET accept_socket; \
421 char accept_buffer[sizeof(struct sockaddr_storage) * 2 + 32]; \
422 HANDLE event_handle; \
423 HANDLE wait_handle; \
424 struct uv_tcp_accept_s* next_pending; \
427 typedef struct uv_read_s { \
429 HANDLE event_handle; \
430 HANDLE wait_handle; \
433#define uv_stream_connection_fields \
434 unsigned int write_reqs_pending; \
435 uv_shutdown_t* shutdown_req;
437#define uv_stream_server_fields \
438 uv_connection_cb connection_cb;
440#define UV_STREAM_PRIVATE_FIELDS \
441 unsigned int reqs_pending; \
443 uv_read_t read_req; \
445 struct { uv_stream_connection_fields } conn; \
446 struct { uv_stream_server_fields } serv; \
449#define uv_tcp_server_fields \
450 uv_tcp_accept_t* accept_reqs; \
451 unsigned int processed_accepts; \
452 uv_tcp_accept_t* pending_accepts; \
453 LPFN_ACCEPTEX func_acceptex;
455#define uv_tcp_connection_fields \
456 uv_buf_t read_buffer; \
457 LPFN_CONNECTEX func_connectex;
459#define UV_TCP_PRIVATE_FIELDS \
463 struct { uv_tcp_server_fields } serv; \
464 struct { uv_tcp_connection_fields } conn; \
467#define UV_UDP_PRIVATE_FIELDS \
469 unsigned int reqs_pending; \
472 uv_buf_t recv_buffer; \
473 struct sockaddr_storage recv_from; \
475 uv_udp_recv_cb recv_cb; \
476 uv_alloc_cb alloc_cb; \
477 LPFN_WSARECV func_wsarecv; \
478 LPFN_WSARECVFROM func_wsarecvfrom;
480#define uv_pipe_server_fields \
481 int pending_instances; \
482 uv_pipe_accept_t* accept_reqs; \
483 uv_pipe_accept_t* pending_accepts;
485#define uv_pipe_connection_fields \
486 uv_timer_t* eof_timer; \
488 DWORD ipc_remote_pid; \
490 uint32_t payload_remaining; \
493 struct uv__queue ipc_xfer_queue; \
494 int ipc_xfer_queue_length; \
495 uv_write_t* non_overlapped_writes_tail; \
496 CRITICAL_SECTION readfile_thread_lock; \
497 volatile HANDLE readfile_thread_handle;
499#define UV_PIPE_PRIVATE_FIELDS \
503 struct { uv_pipe_server_fields } serv; \
504 struct { uv_pipe_connection_fields } conn; \
509#define UV_TTY_PRIVATE_FIELDS \
516 uv_buf_t read_line_buffer; \
517 HANDLE read_raw_wait; \
520 unsigned char last_key_offset; \
521 unsigned char last_key_len; \
522 WCHAR last_utf16_high_surrogate; \
523 INPUT_RECORD last_input_record; \
528 unsigned int utf8_codepoint; \
529 unsigned char utf8_bytes_left; \
531 unsigned char previous_eol; \
533 unsigned short ansi_parser_state; \
534 unsigned char ansi_csi_argc; \
535 unsigned short ansi_csi_argv[4]; \
536 COORD saved_position; \
537 WORD saved_attributes; \
541#define UV_POLL_PRIVATE_FIELDS \
544 SOCKET peer_socket; \
545 AFD_POLL_INFO afd_poll_info_1; \
546 AFD_POLL_INFO afd_poll_info_2; \
548 uv_req_t poll_req_1; \
549 uv_req_t poll_req_2; \
550 unsigned char submitted_events_1; \
551 unsigned char submitted_events_2; \
552 unsigned char mask_events_1; \
553 unsigned char mask_events_2; \
554 unsigned char events;
556#define UV_TIMER_PRIVATE_FIELDS \
557 void* heap_node[3]; \
562 uv_timer_cb timer_cb;
564#define UV_ASYNC_PRIVATE_FIELDS \
565 struct uv_req_s async_req; \
566 uv_async_cb async_cb; \
568 char volatile async_sent;
570#define UV_PREPARE_PRIVATE_FIELDS \
571 uv_prepare_t* prepare_prev; \
572 uv_prepare_t* prepare_next; \
573 uv_prepare_cb prepare_cb;
575#define UV_CHECK_PRIVATE_FIELDS \
576 uv_check_t* check_prev; \
577 uv_check_t* check_next; \
578 uv_check_cb check_cb;
580#define UV_IDLE_PRIVATE_FIELDS \
581 uv_idle_t* idle_prev; \
582 uv_idle_t* idle_next; \
585#define UV_HANDLE_PRIVATE_FIELDS \
586 uv_handle_t* endgame_next; \
589#define UV_GETADDRINFO_PRIVATE_FIELDS \
590 struct uv__work work_req; \
591 uv_getaddrinfo_cb getaddrinfo_cb; \
598 struct addrinfoW* addrinfow; \
599 struct addrinfo* addrinfo; \
602#define UV_GETNAMEINFO_PRIVATE_FIELDS \
603 struct uv__work work_req; \
604 uv_getnameinfo_cb getnameinfo_cb; \
605 struct sockaddr_storage storage; \
607 char host[NI_MAXHOST]; \
608 char service[NI_MAXSERV]; \
611#define UV_PROCESS_PRIVATE_FIELDS \
612 struct uv_process_exit_s { \
617 HANDLE wait_handle; \
618 HANDLE process_handle; \
619 volatile char exit_cb_pending;
621#define UV_FS_PRIVATE_FIELDS \
622 struct uv__work work_req; \
636 unsigned int nbufs; \
639 uv_buf_t bufsml[4]; \
647#define UV_WORK_PRIVATE_FIELDS \
648 struct uv__work work_req;
650#define UV_FS_EVENT_PRIVATE_FIELDS \
651 struct uv_fs_event_req_s { \
658 WCHAR* short_filew; \
662#define UV_SIGNAL_PRIVATE_FIELDS \
663 RB_ENTRY(uv_signal_s) tree_entry; \
664 struct uv_req_s signal_req; \
665 unsigned long pending_signum;
681#define UV_FS_O_APPEND _O_APPEND
682#define UV_FS_O_CREAT _O_CREAT
683#define UV_FS_O_EXCL _O_EXCL
684#define UV_FS_O_FILEMAP 0x20000000
685#define UV_FS_O_RANDOM _O_RANDOM
686#define UV_FS_O_RDONLY _O_RDONLY
687#define UV_FS_O_RDWR _O_RDWR
688#define UV_FS_O_SEQUENTIAL _O_SEQUENTIAL
689#define UV_FS_O_SHORT_LIVED _O_SHORT_LIVED
690#define UV_FS_O_TEMPORARY _O_TEMPORARY
691#define UV_FS_O_TRUNC _O_TRUNC
692#define UV_FS_O_WRONLY _O_WRONLY
695#define UV_FS_O_DIRECT 0x02000000
696#define UV_FS_O_DIRECTORY 0
697#define UV_FS_O_DSYNC 0x04000000
698#define UV_FS_O_EXLOCK 0x10000000
699#define UV_FS_O_NOATIME 0
700#define UV_FS_O_NOCTTY 0
701#define UV_FS_O_NOFOLLOW 0
702#define UV_FS_O_NONBLOCK 0
703#define UV_FS_O_SYMLINK 0
704#define UV_FS_O_SYNC 0x08000000
Definition: format.h:4134
constexpr const char * name(const T &)
HANDLE Handle
Definition: win.h:219
ULONG Events
Definition: win.h:220
NTSTATUS Status
Definition: win.h:221
LARGE_INTEGER Timeout
Definition: win.h:225
ULONG NumberOfHandles
Definition: win.h:226
ULONG Exclusive
Definition: win.h:227
AFD_POLL_HANDLE_INFO Handles[1]
Definition: win.h:228
int d_type
Definition: win.h:306
char d_name[1]
Definition: win.h:307
unsigned threshold
Definition: win.h:282
uv_mutex_t mutex
Definition: win.h:284
unsigned out
Definition: win.h:287
CONDITION_VARIABLE cond
Definition: win.h:286
unsigned in
Definition: win.h:283
It should be possible to cast uv_buf_t[] to WSABUF[] see http://msdn.microsoft.com/en-us/library/ms74...
Definition: unix.h:112
char * base
Definition: unix.h:113
ULONG len
Definition: win.h:239
DWORD tls_index
Definition: win.h:291
HMODULE handle
Definition: win.h:327
HANDLE event
Definition: win.h:298
unsigned char ran
Definition: win.h:297
SRWLOCK read_write_lock_
Definition: win.h:272
CONDITION_VARIABLE cond_var
Definition: win.h:262
CRITICAL_SECTION waiters_count_lock
Definition: win.h:265
unsigned int waiters_count
Definition: win.h:264
HANDLE signal_event
Definition: win.h:266
HANDLE broadcast_event
Definition: win.h:267
pthread_cond_t uv_cond_t
Definition: unix.h:129
pthread_rwlock_t uv_rwlock_t
Definition: unix.h:127
pthread_key_t uv_key_t
Definition: unix.h:130
pthread_mutex_t uv_mutex_t
Definition: unix.h:126
BOOL(PASCAL * LPFN_DISCONNECTEX)(SOCKET hSocket, LPOVERLAPPED lpOverlapped, DWORD dwFlags, DWORD reserved)
Definition: win.h:166
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:156
struct _AFD_POLL_INFO * PAFD_POLL_INFO
int uv_pid_t
Definition: win.h:246
BOOL(PASCAL * LPFN_TRANSMITFILE)(SOCKET hSocket, HANDLE hFile, DWORD nNumberOfBytesToWrite, DWORD nNumberOfBytesPerSend, LPOVERLAPPED lpOverlapped, LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers, DWORD dwFlags)
Definition: win.h:172
HANDLE uv_os_fd_t
Definition: win.h:245
RTL_SRWLOCK * PSRWLOCK
Definition: win.h:181
BOOL(PASCAL * LPFN_ACCEPTEX)(SOCKET sListenSocket, SOCKET sAcceptSocket, PVOID lpOutputBuffer, DWORD dwReceiveDataLength, DWORD dwLocalAddressLength, DWORD dwRemoteAddressLength, LPDWORD lpdwBytesReceived, LPOVERLAPPED lpOverlapped)
Definition: win.h:137
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:147
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:185
int uv_file
Definition: win.h:243
struct _AFD_POLL_INFO AFD_POLL_INFO
SOCKET uv_os_sock_t
Definition: win.h:244
LONG NTSTATUS
Definition: win.h:208
CRITICAL_SECTION uv_mutex_t
Definition: win.h:252
unsigned char uv_uid_t
Definition: win.h:302
PVOID CONDITION_VARIABLE
Definition: win.h:215
RTL_SRWLOCK SRWLOCK
Definition: win.h:181
PVOID RTL_SRWLOCK
Definition: win.h:180
HANDLE uv_sem_t
Definition: win.h:250
struct uv_once_s uv_once_t
unsigned char uv_gid_t
Definition: win.h:303
NTSTATUS * PNTSTATUS
Definition: win.h:209
HANDLE uv_thread_t
Definition: win.h:248
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:194
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:215