WPILibC++ 2024.3.2
win.h
Go to the documentation of this file.
1/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to
5 * deal in the Software without restriction, including without limitation the
6 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 * sell copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19 * IN THE SOFTWARE.
20 */
21
22#ifndef _WIN32_WINNT
23# define _WIN32_WINNT 0x0A00
24#endif
25
26#if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED)
27typedef intptr_t ssize_t;
28# define SSIZE_MAX INTPTR_MAX
29# define _SSIZE_T_
30# define _SSIZE_T_DEFINED
31#endif
32
33#include <winsock2.h>
34
35#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
36typedef struct pollfd {
37 SOCKET fd;
38 short events;
39 short revents;
40} WSAPOLLFD, *PWSAPOLLFD, *LPWSAPOLLFD;
41#endif
42
43#ifndef LOCALE_INVARIANT
44# define LOCALE_INVARIANT 0x007f
45#endif
46
47#include <mswsock.h>
48// Disable the typedef in mstcpip.h of MinGW.
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
52#include <ws2tcpip.h>
53#undef _TCP_INITIAL_RTO_PARAMETERS
54#undef TCP_INITIAL_RTO_PARAMETERS
55#undef PTCP_INITIAL_RTO_PARAMETERS
56#include <windows.h>
57
58#include <process.h>
59#include <signal.h>
60#include <fcntl.h>
61#include <sys/stat.h>
62#include <stdint.h>
63
64#include "uv/tree.h"
65#include "uv/threadpool.h"
66
67#define MAX_PIPENAME_LEN 256
68
69#ifndef S_IFLNK
70# define S_IFLNK 0xA000
71#endif
72
73// Define missing in Windows Kit Include\{VERSION}\ucrt\sys\stat.h
74#if defined(_CRT_INTERNAL_NONSTDC_NAMES) && _CRT_INTERNAL_NONSTDC_NAMES && !defined(S_IFIFO)
75# define S_IFIFO _S_IFIFO
76#endif
77
78/* Additional signals supported by uv_signal and or uv_kill. The CRT defines
79 * the following signals already:
80 *
81 * #define SIGINT 2
82 * #define SIGILL 4
83 * #define SIGABRT_COMPAT 6
84 * #define SIGFPE 8
85 * #define SIGSEGV 11
86 * #define SIGTERM 15
87 * #define SIGBREAK 21
88 * #define SIGABRT 22
89 *
90 * The additional signals have values that are common on other Unix
91 * variants (Linux and Darwin)
92 */
93#define SIGHUP 1
94#define SIGKILL 9
95#define SIGWINCH 28
96
97/* Redefine NSIG to take SIGWINCH into consideration */
98#if defined(NSIG) && NSIG <= SIGWINCH
99# undef NSIG
100#endif
101#ifndef NSIG
102# define NSIG SIGWINCH + 1
103#endif
104
105/* The CRT defines SIGABRT_COMPAT as 6, which equals SIGABRT on many unix-like
106 * platforms. However MinGW doesn't define it, so we do. */
107#ifndef SIGABRT_COMPAT
108# define SIGABRT_COMPAT 6
109#endif
110
111/*
112 * Guids and typedefs for winsock extension functions
113 * Mingw32 doesn't have these :-(
114 */
115#ifndef WSAID_ACCEPTEX
116# define WSAID_ACCEPTEX \
117 {0xb5367df1, 0xcbac, 0x11cf, \
118 {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
119
120# define WSAID_CONNECTEX \
121 {0x25a207b9, 0xddf3, 0x4660, \
122 {0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}}
123
124# define WSAID_GETACCEPTEXSOCKADDRS \
125 {0xb5367df2, 0xcbac, 0x11cf, \
126 {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
127
128# define WSAID_DISCONNECTEX \
129 {0x7fda2e11, 0x8630, 0x436f, \
130 {0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}}
131
132# define WSAID_TRANSMITFILE \
133 {0xb5367df0, 0xcbac, 0x11cf, \
134 {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
135
136 typedef BOOL (PASCAL *LPFN_ACCEPTEX)
137 (SOCKET sListenSocket,
138 SOCKET sAcceptSocket,
139 PVOID lpOutputBuffer,
140 DWORD dwReceiveDataLength,
141 DWORD dwLocalAddressLength,
142 DWORD dwRemoteAddressLength,
143 LPDWORD lpdwBytesReceived,
144 LPOVERLAPPED lpOverlapped);
145
146 typedef BOOL (PASCAL *LPFN_CONNECTEX)
147 (SOCKET s,
148 const struct sockaddr* name,
149 int namelen,
150 PVOID lpSendBuffer,
151 DWORD dwSendDataLength,
152 LPDWORD lpdwBytesSent,
153 LPOVERLAPPED lpOverlapped);
154
155 typedef void (PASCAL *LPFN_GETACCEPTEXSOCKADDRS)
156 (PVOID lpOutputBuffer,
157 DWORD dwReceiveDataLength,
158 DWORD dwLocalAddressLength,
159 DWORD dwRemoteAddressLength,
160 LPSOCKADDR* LocalSockaddr,
161 LPINT LocalSockaddrLength,
162 LPSOCKADDR* RemoteSockaddr,
163 LPINT RemoteSockaddrLength);
164
165 typedef BOOL (PASCAL *LPFN_DISCONNECTEX)
166 (SOCKET hSocket,
167 LPOVERLAPPED lpOverlapped,
168 DWORD dwFlags,
169 DWORD reserved);
170
171 typedef BOOL (PASCAL *LPFN_TRANSMITFILE)
172 (SOCKET hSocket,
173 HANDLE hFile,
174 DWORD nNumberOfBytesToWrite,
175 DWORD nNumberOfBytesPerSend,
176 LPOVERLAPPED lpOverlapped,
177 LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers,
178 DWORD dwFlags);
179
180 typedef PVOID RTL_SRWLOCK;
182#endif
183
184typedef int (WSAAPI* LPFN_WSARECV)
185 (SOCKET socket,
186 LPWSABUF buffers,
187 DWORD buffer_count,
188 LPDWORD bytes,
189 LPDWORD flags,
190 LPWSAOVERLAPPED overlapped,
191 LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine);
192
193typedef int (WSAAPI* LPFN_WSARECVFROM)
194 (SOCKET socket,
195 LPWSABUF buffers,
196 DWORD buffer_count,
197 LPDWORD bytes,
198 LPDWORD flags,
199 struct sockaddr* addr,
200 LPINT addr_len,
201 LPWSAOVERLAPPED overlapped,
202 LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine);
203
204#pragma warning(push)
205#pragma warning(disable : 28251)
206
207#ifndef _NTDEF_
208 typedef LONG NTSTATUS;
210#endif
211
212#pragma warning(pop)
213
214#ifndef RTL_CONDITION_VARIABLE_INIT
216#endif
217
218typedef struct _AFD_POLL_HANDLE_INFO {
219 HANDLE Handle;
220 ULONG Events;
223
224typedef struct _AFD_POLL_INFO {
225 LARGE_INTEGER Timeout;
230
231#define UV_MSAFD_PROVIDER_COUNT 4
232
233
234/**
235 * It should be possible to cast uv_buf_t[] to WSABUF[]
236 * see http://msdn.microsoft.com/en-us/library/ms741542(v=vs.85).aspx
237 */
238typedef struct uv_buf_t {
239 ULONG len;
240 char* base;
242
243typedef int uv_file;
244typedef SOCKET uv_os_sock_t;
245typedef HANDLE uv_os_fd_t;
246typedef int uv_pid_t;
247
248typedef HANDLE uv_thread_t;
249
250typedef HANDLE uv_sem_t;
251
252typedef CRITICAL_SECTION uv_mutex_t;
253
254/* This condition variable implementation is based on the SetEvent solution
255 * (section 3.2) at http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
256 * We could not use the SignalObjectAndWait solution (section 3.4) because
257 * it want the 2nd argument (type uv_mutex_t) of uv_cond_wait() and
258 * uv_cond_timedwait() to be HANDLEs, but we use CRITICAL_SECTIONs.
259 */
260
261typedef union {
263 struct {
264 unsigned int waiters_count;
265 CRITICAL_SECTION waiters_count_lock;
268 } unused_; /* TODO: retained for ABI compatibility; remove me in v2.x. */
269} uv_cond_t;
270
271typedef struct {
273 /* TODO: retained for ABI compatibility; remove me in v2.x */
274#ifdef _WIN64
275 unsigned char padding_[72];
276#else
277 unsigned char padding_[44];
278#endif
280
281typedef struct {
282 unsigned threshold;
283 unsigned in;
285 /* TODO: in v2 make this a uv_cond_t, without unused_ */
287 unsigned out;
289
290typedef struct {
292} uv_key_t;
293
294#define UV_ONCE_INIT { 0, NULL }
295
296typedef struct uv_once_s {
297 unsigned char ran;
298 HANDLE event;
300
301/* Platform-specific definitions for uv_spawn support. */
302typedef unsigned char uv_uid_t;
303typedef unsigned char uv_gid_t;
304
305typedef struct uv__dirent_s {
307 char d_name[1];
309
310#define UV_DIR_PRIVATE_FIELDS \
311 HANDLE dir_handle; \
312 WIN32_FIND_DATAW find_data; \
313 BOOL need_find_call;
314
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
323
324/* Platform-specific definitions for uv_dlopen support. */
325#define UV_DYNAMIC FAR WINAPI
326typedef struct {
327 HMODULE handle;
328 char* errmsg;
329} uv_lib_t;
330
331#define UV_LOOP_PRIVATE_FIELDS \
332 /* The loop's I/O completion port */ \
333 HANDLE iocp; \
334 /* The current time according to the event loop. in msecs. */ \
335 uint64_t time; \
336 /* Tail of a single-linked circular queue of pending reqs. If the queue */ \
337 /* is empty, tail_ is NULL. If there is only one item, */ \
338 /* tail_->next_req == tail_ */ \
339 uv_req_t* pending_reqs_tail; \
340 /* Head of a single-linked list of closed handles */ \
341 uv_handle_t* endgame_handles; \
342 /* TODO(bnoordhuis) Stop heap-allocating |timer_heap| in libuv v2.x. */ \
343 void* timer_heap; \
344 /* Lists of active loop (prepare / check / idle) watchers */ \
345 uv_prepare_t* prepare_handles; \
346 uv_check_t* check_handles; \
347 uv_idle_t* idle_handles; \
348 /* This pointer will refer to the prepare/check/idle handle whose */ \
349 /* callback is scheduled to be called next. This is needed to allow */ \
350 /* safe removal from one of the lists above while that list being */ \
351 /* iterated over. */ \
352 uv_prepare_t* next_prepare_handle; \
353 uv_check_t* next_check_handle; \
354 uv_idle_t* next_idle_handle; \
355 /* This handle holds the peer sockets for the fast variant of uv_poll_t */ \
356 SOCKET poll_peer_sockets[UV_MSAFD_PROVIDER_COUNT]; \
357 /* No longer used. */ \
358 unsigned int active_tcp_streams; \
359 /* No longer used. */ \
360 unsigned int active_udp_streams; \
361 /* Counter to started timer */ \
362 uint64_t timer_counter; \
363 /* Threadpool */ \
364 struct uv__queue wq; \
365 uv_mutex_t wq_mutex; \
366 uv_async_t wq_async;
367
368#define UV_REQ_TYPE_PRIVATE \
369 /* TODO: remove the req suffix */ \
370 UV_ACCEPT, \
371 UV_FS_EVENT_REQ, \
372 UV_POLL_REQ, \
373 UV_PROCESS_EXIT, \
374 UV_READ, \
375 UV_UDP_RECV, \
376 UV_WAKEUP, \
377 UV_SIGNAL_REQ,
378
379#define UV_REQ_PRIVATE_FIELDS \
380 union { \
381 /* Used by I/O operations */ \
382 struct { \
383 OVERLAPPED overlapped; \
384 size_t queued_bytes; \
385 } io; \
386 /* in v2, we can move these to the UV_CONNECT_PRIVATE_FIELDS */ \
387 struct { \
388 ULONG_PTR result; /* overlapped.Internal is reused to hold the result */\
389 HANDLE pipeHandle; \
390 DWORD duplex_flags; \
391 WCHAR* name; \
392 } connect; \
393 } u; \
394 struct uv_req_s* next_req;
395
396#define UV_WRITE_PRIVATE_FIELDS \
397 int coalesced; \
398 uv_buf_t write_buffer; \
399 HANDLE event_handle; \
400 HANDLE wait_handle;
401
402#define UV_CONNECT_PRIVATE_FIELDS \
403 /* empty */
404
405#define UV_SHUTDOWN_PRIVATE_FIELDS \
406 /* empty */
407
408#define UV_UDP_SEND_PRIVATE_FIELDS \
409 /* empty */
410
411#define UV_PRIVATE_REQ_TYPES \
412 typedef struct uv_pipe_accept_s { \
413 UV_REQ_FIELDS \
414 HANDLE pipeHandle; \
415 struct uv_pipe_accept_s* next_pending; \
416 } uv_pipe_accept_t; \
417 \
418 typedef struct uv_tcp_accept_s { \
419 UV_REQ_FIELDS \
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; \
425 } uv_tcp_accept_t; \
426 \
427 typedef struct uv_read_s { \
428 UV_REQ_FIELDS \
429 HANDLE event_handle; \
430 HANDLE wait_handle; \
431 } uv_read_t;
432
433#define uv_stream_connection_fields \
434 unsigned int write_reqs_pending; \
435 uv_shutdown_t* shutdown_req;
436
437#define uv_stream_server_fields \
438 uv_connection_cb connection_cb;
439
440#define UV_STREAM_PRIVATE_FIELDS \
441 unsigned int reqs_pending; \
442 int activecnt; \
443 uv_read_t read_req; \
444 union { \
445 struct { uv_stream_connection_fields } conn; \
446 struct { uv_stream_server_fields } serv; \
447 } stream;
448
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;
454
455#define uv_tcp_connection_fields \
456 uv_buf_t read_buffer; \
457 LPFN_CONNECTEX func_connectex;
458
459#define UV_TCP_PRIVATE_FIELDS \
460 SOCKET socket; \
461 int delayed_error; \
462 union { \
463 struct { uv_tcp_server_fields } serv; \
464 struct { uv_tcp_connection_fields } conn; \
465 } tcp;
466
467#define UV_UDP_PRIVATE_FIELDS \
468 SOCKET socket; \
469 unsigned int reqs_pending; \
470 int activecnt; \
471 uv_req_t recv_req; \
472 uv_buf_t recv_buffer; \
473 struct sockaddr_storage recv_from; \
474 int recv_from_len; \
475 uv_udp_recv_cb recv_cb; \
476 uv_alloc_cb alloc_cb; \
477 LPFN_WSARECV func_wsarecv; \
478 LPFN_WSARECVFROM func_wsarecvfrom;
479
480#define uv_pipe_server_fields \
481 int pending_instances; \
482 uv_pipe_accept_t* accept_reqs; \
483 uv_pipe_accept_t* pending_accepts;
484
485#define uv_pipe_connection_fields \
486 uv_timer_t* eof_timer; \
487 uv_write_t dummy; /* TODO: retained for ABI compat; remove this in v2.x. */ \
488 DWORD ipc_remote_pid; \
489 union { \
490 uint32_t payload_remaining; \
491 uint64_t dummy; /* TODO: retained for ABI compat; remove this in v2.x. */ \
492 } ipc_data_frame; \
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;
498
499#define UV_PIPE_PRIVATE_FIELDS \
500 HANDLE handle; \
501 WCHAR* name; \
502 union { \
503 struct { uv_pipe_server_fields } serv; \
504 struct { uv_pipe_connection_fields } conn; \
505 } pipe;
506
507/* TODO: put the parser states in a union - TTY handles are always half-duplex
508 * so read-state can safely overlap write-state. */
509#define UV_TTY_PRIVATE_FIELDS \
510 HANDLE handle; \
511 union { \
512 struct { \
513 /* Used for readable TTY handles */ \
514 /* TODO: remove me in v2.x. */ \
515 HANDLE unused_; \
516 uv_buf_t read_line_buffer; \
517 HANDLE read_raw_wait; \
518 /* Fields used for translating win keystrokes into vt100 characters */ \
519 char last_key[8]; \
520 unsigned char last_key_offset; \
521 unsigned char last_key_len; \
522 WCHAR last_utf16_high_surrogate; \
523 INPUT_RECORD last_input_record; \
524 } rd; \
525 struct { \
526 /* Used for writable TTY handles */ \
527 /* utf8-to-utf16 conversion state */ \
528 unsigned int utf8_codepoint; \
529 unsigned char utf8_bytes_left; \
530 /* eol conversion state */ \
531 unsigned char previous_eol; \
532 /* ansi parser state */ \
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; \
538 } wr; \
539 } tty;
540
541#define UV_POLL_PRIVATE_FIELDS \
542 SOCKET socket; \
543 /* Used in fast mode */ \
544 SOCKET peer_socket; \
545 AFD_POLL_INFO afd_poll_info_1; \
546 AFD_POLL_INFO afd_poll_info_2; \
547 /* Used in fast and slow mode. */ \
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;
555
556#define UV_TIMER_PRIVATE_FIELDS \
557 void* heap_node[3]; \
558 int unused; \
559 uint64_t timeout; \
560 uint64_t repeat; \
561 uint64_t start_id; \
562 uv_timer_cb timer_cb;
563
564#define UV_ASYNC_PRIVATE_FIELDS \
565 struct uv_req_s async_req; \
566 uv_async_cb async_cb; \
567 /* char to avoid alignment issues */ \
568 char volatile async_sent;
569
570#define UV_PREPARE_PRIVATE_FIELDS \
571 uv_prepare_t* prepare_prev; \
572 uv_prepare_t* prepare_next; \
573 uv_prepare_cb prepare_cb;
574
575#define UV_CHECK_PRIVATE_FIELDS \
576 uv_check_t* check_prev; \
577 uv_check_t* check_next; \
578 uv_check_cb check_cb;
579
580#define UV_IDLE_PRIVATE_FIELDS \
581 uv_idle_t* idle_prev; \
582 uv_idle_t* idle_next; \
583 uv_idle_cb idle_cb;
584
585#define UV_HANDLE_PRIVATE_FIELDS \
586 uv_handle_t* endgame_next; \
587 unsigned int flags;
588
589#define UV_GETADDRINFO_PRIVATE_FIELDS \
590 struct uv__work work_req; \
591 uv_getaddrinfo_cb getaddrinfo_cb; \
592 void* alloc; \
593 WCHAR* node; \
594 WCHAR* service; \
595 /* The addrinfoW field is used to store a pointer to the hints, and */ \
596 /* later on to store the result of GetAddrInfoW. The final result will */ \
597 /* be converted to struct addrinfo* and stored in the addrinfo field. */ \
598 struct addrinfoW* addrinfow; \
599 struct addrinfo* addrinfo; \
600 int retcode;
601
602#define UV_GETNAMEINFO_PRIVATE_FIELDS \
603 struct uv__work work_req; \
604 uv_getnameinfo_cb getnameinfo_cb; \
605 struct sockaddr_storage storage; \
606 int flags; \
607 char host[NI_MAXHOST]; \
608 char service[NI_MAXSERV]; \
609 int retcode;
610
611#define UV_PROCESS_PRIVATE_FIELDS \
612 struct uv_process_exit_s { \
613 UV_REQ_FIELDS \
614 } exit_req; \
615 void* unused; /* TODO: retained for ABI compat; remove this in v2.x. */ \
616 int exit_signal; \
617 HANDLE wait_handle; \
618 HANDLE process_handle; \
619 volatile char exit_cb_pending;
620
621#define UV_FS_PRIVATE_FIELDS \
622 struct uv__work work_req; \
623 int flags; \
624 DWORD sys_errno_; \
625 union { \
626 /* TODO: remove me in 0.9. */ \
627 WCHAR* pathw; \
628 int fd; \
629 } file; \
630 union { \
631 struct { \
632 int mode; \
633 WCHAR* new_pathw; \
634 int file_flags; \
635 int fd_out; \
636 unsigned int nbufs; \
637 uv_buf_t* bufs; \
638 int64_t offset; \
639 uv_buf_t bufsml[4]; \
640 } info; \
641 struct { \
642 double atime; \
643 double mtime; \
644 } time; \
645 } fs;
646
647#define UV_WORK_PRIVATE_FIELDS \
648 struct uv__work work_req;
649
650#define UV_FS_EVENT_PRIVATE_FIELDS \
651 struct uv_fs_event_req_s { \
652 UV_REQ_FIELDS \
653 } req; \
654 HANDLE dir_handle; \
655 int req_pending; \
656 uv_fs_event_cb cb; \
657 WCHAR* filew; \
658 WCHAR* short_filew; \
659 WCHAR* dirw; \
660 char* buffer;
661
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;
666
667#ifndef F_OK
668#define F_OK 0
669#endif
670#ifndef R_OK
671#define R_OK 4
672#endif
673#ifndef W_OK
674#define W_OK 2
675#endif
676#ifndef X_OK
677#define X_OK 1
678#endif
679
680/* fs open() flags supported on this platform: */
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
693
694/* fs open() flags supported on other platforms (or mapped on this platform): */
695#define UV_FS_O_DIRECT 0x02000000 /* FILE_FLAG_NO_BUFFERING */
696#define UV_FS_O_DIRECTORY 0
697#define UV_FS_O_DSYNC 0x04000000 /* FILE_FLAG_WRITE_THROUGH */
698#define UV_FS_O_EXLOCK 0x10000000 /* EXCLUSIVE SHARING MODE */
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 /* FILE_FLAG_WRITE_THROUGH */
Definition: format.h:4134
constexpr const char * name(const T &)
Definition: win.h:218
HANDLE Handle
Definition: win.h:219
ULONG Events
Definition: win.h:220
NTSTATUS Status
Definition: win.h:221
Definition: win.h:224
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
Definition: win.h:305
int d_type
Definition: win.h:306
char d_name[1]
Definition: win.h:307
Definition: unix.h:145
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
Definition: unix.h:207
HMODULE handle
Definition: win.h:327
Definition: win.h:296
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