WPILibC++ 2023.4.3-108-ge5452e3
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 0x0600
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
63#include <stdint.h>
64
65#include "uv/tree.h"
66#include "uv/threadpool.h"
67
68#define MAX_PIPENAME_LEN 256
69
70#ifndef S_IFLNK
71# define S_IFLNK 0xA000
72#endif
73
74/* Additional signals supported by uv_signal and or uv_kill. The CRT defines
75 * the following signals already:
76 *
77 * #define SIGINT 2
78 * #define SIGILL 4
79 * #define SIGABRT_COMPAT 6
80 * #define SIGFPE 8
81 * #define SIGSEGV 11
82 * #define SIGTERM 15
83 * #define SIGBREAK 21
84 * #define SIGABRT 22
85 *
86 * The additional signals have values that are common on other Unix
87 * variants (Linux and Darwin)
88 */
89#define SIGHUP 1
90#define SIGKILL 9
91#define SIGWINCH 28
92
93/* Redefine NSIG to take SIGWINCH into consideration */
94#if defined(NSIG) && NSIG <= SIGWINCH
95# undef NSIG
96#endif
97#ifndef NSIG
98# define NSIG SIGWINCH + 1
99#endif
100
101/* The CRT defines SIGABRT_COMPAT as 6, which equals SIGABRT on many unix-like
102 * platforms. However MinGW doesn't define it, so we do. */
103#ifndef SIGABRT_COMPAT
104# define SIGABRT_COMPAT 6
105#endif
106
107/*
108 * Guids and typedefs for winsock extension functions
109 * Mingw32 doesn't have these :-(
110 */
111#ifndef WSAID_ACCEPTEX
112# define WSAID_ACCEPTEX \
113 {0xb5367df1, 0xcbac, 0x11cf, \
114 {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
115
116# define WSAID_CONNECTEX \
117 {0x25a207b9, 0xddf3, 0x4660, \
118 {0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}}
119
120# define WSAID_GETACCEPTEXSOCKADDRS \
121 {0xb5367df2, 0xcbac, 0x11cf, \
122 {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
123
124# define WSAID_DISCONNECTEX \
125 {0x7fda2e11, 0x8630, 0x436f, \
126 {0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}}
127
128# define WSAID_TRANSMITFILE \
129 {0xb5367df0, 0xcbac, 0x11cf, \
130 {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
131
132 typedef BOOL (PASCAL *LPFN_ACCEPTEX)
133 (SOCKET sListenSocket,
134 SOCKET sAcceptSocket,
135 PVOID lpOutputBuffer,
136 DWORD dwReceiveDataLength,
137 DWORD dwLocalAddressLength,
138 DWORD dwRemoteAddressLength,
139 LPDWORD lpdwBytesReceived,
140 LPOVERLAPPED lpOverlapped);
141
142 typedef BOOL (PASCAL *LPFN_CONNECTEX)
143 (SOCKET s,
144 const struct sockaddr* name,
145 int namelen,
146 PVOID lpSendBuffer,
147 DWORD dwSendDataLength,
148 LPDWORD lpdwBytesSent,
149 LPOVERLAPPED lpOverlapped);
150
151 typedef void (PASCAL *LPFN_GETACCEPTEXSOCKADDRS)
152 (PVOID lpOutputBuffer,
153 DWORD dwReceiveDataLength,
154 DWORD dwLocalAddressLength,
155 DWORD dwRemoteAddressLength,
156 LPSOCKADDR* LocalSockaddr,
157 LPINT LocalSockaddrLength,
158 LPSOCKADDR* RemoteSockaddr,
159 LPINT RemoteSockaddrLength);
160
161 typedef BOOL (PASCAL *LPFN_DISCONNECTEX)
162 (SOCKET hSocket,
163 LPOVERLAPPED lpOverlapped,
164 DWORD dwFlags,
165 DWORD reserved);
166
167 typedef BOOL (PASCAL *LPFN_TRANSMITFILE)
168 (SOCKET hSocket,
169 HANDLE hFile,
170 DWORD nNumberOfBytesToWrite,
171 DWORD nNumberOfBytesPerSend,
172 LPOVERLAPPED lpOverlapped,
173 LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers,
174 DWORD dwFlags);
175
176 typedef PVOID RTL_SRWLOCK;
178#endif
179
180typedef int (WSAAPI* LPFN_WSARECV)
181 (SOCKET socket,
182 LPWSABUF buffers,
183 DWORD buffer_count,
184 LPDWORD bytes,
185 LPDWORD flags,
186 LPWSAOVERLAPPED overlapped,
187 LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine);
188
189typedef int (WSAAPI* LPFN_WSARECVFROM)
190 (SOCKET socket,
191 LPWSABUF buffers,
192 DWORD buffer_count,
193 LPDWORD bytes,
194 LPDWORD flags,
195 struct sockaddr* addr,
196 LPINT addr_len,
197 LPWSAOVERLAPPED overlapped,
198 LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine);
199
200#pragma warning(push)
201#pragma warning(disable : 28251)
202
203#ifndef _NTDEF_
204 typedef LONG NTSTATUS;
206#endif
207
208#pragma warning(pop)
209
210#ifndef RTL_CONDITION_VARIABLE_INIT
212#endif
213
214typedef struct _AFD_POLL_HANDLE_INFO {
215 HANDLE Handle;
216 ULONG Events;
219
220typedef struct _AFD_POLL_INFO {
221 LARGE_INTEGER Timeout;
226
227#define UV_MSAFD_PROVIDER_COUNT 4
228
229
230/**
231 * It should be possible to cast uv_buf_t[] to WSABUF[]
232 * see http://msdn.microsoft.com/en-us/library/ms741542(v=vs.85).aspx
233 */
234typedef struct uv_buf_t {
235 ULONG len;
236 char* base;
238
239typedef int uv_file;
240typedef SOCKET uv_os_sock_t;
241typedef HANDLE uv_os_fd_t;
242typedef int uv_pid_t;
243
244typedef HANDLE uv_thread_t;
245
246typedef HANDLE uv_sem_t;
247
248typedef CRITICAL_SECTION uv_mutex_t;
249
250/* This condition variable implementation is based on the SetEvent solution
251 * (section 3.2) at http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
252 * We could not use the SignalObjectAndWait solution (section 3.4) because
253 * it want the 2nd argument (type uv_mutex_t) of uv_cond_wait() and
254 * uv_cond_timedwait() to be HANDLEs, but we use CRITICAL_SECTIONs.
255 */
256
257typedef union {
259 struct {
260 unsigned int waiters_count;
261 CRITICAL_SECTION waiters_count_lock;
264 } unused_; /* TODO: retained for ABI compatibility; remove me in v2.x. */
265} uv_cond_t;
266
267typedef struct {
269 /* TODO: retained for ABI compatibility; remove me in v2.x */
270#ifdef _WIN64
271 unsigned char padding_[72];
272#else
273 unsigned char padding_[44];
274#endif
276
277typedef struct {
278 unsigned int n;
279 unsigned int count;
284
285typedef struct {
287} uv_key_t;
288
289#define UV_ONCE_INIT { 0, NULL }
290
291typedef struct uv_once_s {
292 unsigned char ran;
293 HANDLE event;
295
296/* Platform-specific definitions for uv_spawn support. */
297typedef unsigned char uv_uid_t;
298typedef unsigned char uv_gid_t;
299
300typedef struct uv__dirent_s {
302 char d_name[1];
304
305#define UV_DIR_PRIVATE_FIELDS \
306 HANDLE dir_handle; \
307 WIN32_FIND_DATAW find_data; \
308 BOOL need_find_call;
309
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
318
319/* Platform-specific definitions for uv_dlopen support. */
320#define UV_DYNAMIC FAR WINAPI
321typedef struct {
322 HMODULE handle;
323 char* errmsg;
324} uv_lib_t;
325
326#define UV_LOOP_PRIVATE_FIELDS \
327 /* The loop's I/O completion port */ \
328 HANDLE iocp; \
329 /* The current time according to the event loop. in msecs. */ \
330 uint64_t time; \
331 /* Tail of a single-linked circular queue of pending reqs. If the queue */ \
332 /* is empty, tail_ is NULL. If there is only one item, */ \
333 /* tail_->next_req == tail_ */ \
334 uv_req_t* pending_reqs_tail; \
335 /* Head of a single-linked list of closed handles */ \
336 uv_handle_t* endgame_handles; \
337 /* TODO(bnoordhuis) Stop heap-allocating |timer_heap| in libuv v2.x. */ \
338 void* timer_heap; \
339 /* Lists of active loop (prepare / check / idle) watchers */ \
340 uv_prepare_t* prepare_handles; \
341 uv_check_t* check_handles; \
342 uv_idle_t* idle_handles; \
343 /* This pointer will refer to the prepare/check/idle handle whose */ \
344 /* callback is scheduled to be called next. This is needed to allow */ \
345 /* safe removal from one of the lists above while that list being */ \
346 /* iterated over. */ \
347 uv_prepare_t* next_prepare_handle; \
348 uv_check_t* next_check_handle; \
349 uv_idle_t* next_idle_handle; \
350 /* This handle holds the peer sockets for the fast variant of uv_poll_t */ \
351 SOCKET poll_peer_sockets[UV_MSAFD_PROVIDER_COUNT]; \
352 /* Counter to keep track of active tcp streams */ \
353 unsigned int active_tcp_streams; \
354 /* Counter to keep track of active udp streams */ \
355 unsigned int active_udp_streams; \
356 /* Counter to started timer */ \
357 uint64_t timer_counter; \
358 /* Threadpool */ \
359 void* wq[2]; \
360 uv_mutex_t wq_mutex; \
361 uv_async_t wq_async;
362
363#define UV_REQ_TYPE_PRIVATE \
364 /* TODO: remove the req suffix */ \
365 UV_ACCEPT, \
366 UV_FS_EVENT_REQ, \
367 UV_POLL_REQ, \
368 UV_PROCESS_EXIT, \
369 UV_READ, \
370 UV_UDP_RECV, \
371 UV_WAKEUP, \
372 UV_SIGNAL_REQ,
373
374#define UV_REQ_PRIVATE_FIELDS \
375 union { \
376 /* Used by I/O operations */ \
377 struct { \
378 OVERLAPPED overlapped; \
379 size_t queued_bytes; \
380 } io; \
381 /* in v2, we can move these to the UV_CONNECT_PRIVATE_FIELDS */ \
382 struct { \
383 ULONG_PTR result; /* overlapped.Internal is reused to hold the result */\
384 HANDLE pipeHandle; \
385 DWORD duplex_flags; \
386 } connect; \
387 } u; \
388 struct uv_req_s* next_req;
389
390#define UV_WRITE_PRIVATE_FIELDS \
391 int coalesced; \
392 uv_buf_t write_buffer; \
393 HANDLE event_handle; \
394 HANDLE wait_handle;
395
396#define UV_CONNECT_PRIVATE_FIELDS \
397 /* empty */
398
399#define UV_SHUTDOWN_PRIVATE_FIELDS \
400 /* empty */
401
402#define UV_UDP_SEND_PRIVATE_FIELDS \
403 /* empty */
404
405#define UV_PRIVATE_REQ_TYPES \
406 typedef struct uv_pipe_accept_s { \
407 UV_REQ_FIELDS \
408 HANDLE pipeHandle; \
409 struct uv_pipe_accept_s* next_pending; \
410 } uv_pipe_accept_t; \
411 \
412 typedef struct uv_tcp_accept_s { \
413 UV_REQ_FIELDS \
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; \
419 } uv_tcp_accept_t; \
420 \
421 typedef struct uv_read_s { \
422 UV_REQ_FIELDS \
423 HANDLE event_handle; \
424 HANDLE wait_handle; \
425 } uv_read_t;
426
427#define uv_stream_connection_fields \
428 unsigned int write_reqs_pending; \
429 uv_shutdown_t* shutdown_req;
430
431#define uv_stream_server_fields \
432 uv_connection_cb connection_cb;
433
434#define UV_STREAM_PRIVATE_FIELDS \
435 unsigned int reqs_pending; \
436 int activecnt; \
437 uv_read_t read_req; \
438 union { \
439 struct { uv_stream_connection_fields } conn; \
440 struct { uv_stream_server_fields } serv; \
441 } stream;
442
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;
448
449#define uv_tcp_connection_fields \
450 uv_buf_t read_buffer; \
451 LPFN_CONNECTEX func_connectex;
452
453#define UV_TCP_PRIVATE_FIELDS \
454 SOCKET socket; \
455 int delayed_error; \
456 union { \
457 struct { uv_tcp_server_fields } serv; \
458 struct { uv_tcp_connection_fields } conn; \
459 } tcp;
460
461#define UV_UDP_PRIVATE_FIELDS \
462 SOCKET socket; \
463 unsigned int reqs_pending; \
464 int activecnt; \
465 uv_req_t recv_req; \
466 uv_buf_t recv_buffer; \
467 struct sockaddr_storage recv_from; \
468 int recv_from_len; \
469 uv_udp_recv_cb recv_cb; \
470 uv_alloc_cb alloc_cb; \
471 LPFN_WSARECV func_wsarecv; \
472 LPFN_WSARECVFROM func_wsarecvfrom;
473
474#define uv_pipe_server_fields \
475 int pending_instances; \
476 uv_pipe_accept_t* accept_reqs; \
477 uv_pipe_accept_t* pending_accepts;
478
479#define uv_pipe_connection_fields \
480 uv_timer_t* eof_timer; \
481 uv_write_t dummy; /* TODO: retained for ABI compat; remove this in v2.x. */ \
482 DWORD ipc_remote_pid; \
483 union { \
484 uint32_t payload_remaining; \
485 uint64_t dummy; /* TODO: retained for ABI compat; remove this in v2.x. */ \
486 } ipc_data_frame; \
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;
492
493#define UV_PIPE_PRIVATE_FIELDS \
494 HANDLE handle; \
495 WCHAR* name; \
496 union { \
497 struct { uv_pipe_server_fields } serv; \
498 struct { uv_pipe_connection_fields } conn; \
499 } pipe;
500
501/* TODO: put the parser states in an union - TTY handles are always half-duplex
502 * so read-state can safely overlap write-state. */
503#define UV_TTY_PRIVATE_FIELDS \
504 HANDLE handle; \
505 union { \
506 struct { \
507 /* Used for readable TTY handles */ \
508 /* TODO: remove me in v2.x. */ \
509 HANDLE unused_; \
510 uv_buf_t read_line_buffer; \
511 HANDLE read_raw_wait; \
512 /* Fields used for translating win keystrokes into vt100 characters */ \
513 char last_key[8]; \
514 unsigned char last_key_offset; \
515 unsigned char last_key_len; \
516 WCHAR last_utf16_high_surrogate; \
517 INPUT_RECORD last_input_record; \
518 } rd; \
519 struct { \
520 /* Used for writable TTY handles */ \
521 /* utf8-to-utf16 conversion state */ \
522 unsigned int utf8_codepoint; \
523 unsigned char utf8_bytes_left; \
524 /* eol conversion state */ \
525 unsigned char previous_eol; \
526 /* ansi parser state */ \
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; \
532 } wr; \
533 } tty;
534
535#define UV_POLL_PRIVATE_FIELDS \
536 SOCKET socket; \
537 /* Used in fast mode */ \
538 SOCKET peer_socket; \
539 AFD_POLL_INFO afd_poll_info_1; \
540 AFD_POLL_INFO afd_poll_info_2; \
541 /* Used in fast and slow mode. */ \
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;
549
550#define UV_TIMER_PRIVATE_FIELDS \
551 void* heap_node[3]; \
552 int unused; \
553 uint64_t timeout; \
554 uint64_t repeat; \
555 uint64_t start_id; \
556 uv_timer_cb timer_cb;
557
558#define UV_ASYNC_PRIVATE_FIELDS \
559 struct uv_req_s async_req; \
560 uv_async_cb async_cb; \
561 /* char to avoid alignment issues */ \
562 char volatile async_sent;
563
564#define UV_PREPARE_PRIVATE_FIELDS \
565 uv_prepare_t* prepare_prev; \
566 uv_prepare_t* prepare_next; \
567 uv_prepare_cb prepare_cb;
568
569#define UV_CHECK_PRIVATE_FIELDS \
570 uv_check_t* check_prev; \
571 uv_check_t* check_next; \
572 uv_check_cb check_cb;
573
574#define UV_IDLE_PRIVATE_FIELDS \
575 uv_idle_t* idle_prev; \
576 uv_idle_t* idle_next; \
577 uv_idle_cb idle_cb;
578
579#define UV_HANDLE_PRIVATE_FIELDS \
580 uv_handle_t* endgame_next; \
581 unsigned int flags;
582
583#define UV_GETADDRINFO_PRIVATE_FIELDS \
584 struct uv__work work_req; \
585 uv_getaddrinfo_cb getaddrinfo_cb; \
586 void* alloc; \
587 WCHAR* node; \
588 WCHAR* service; \
589 /* The addrinfoW field is used to store a pointer to the hints, and */ \
590 /* later on to store the result of GetAddrInfoW. The final result will */ \
591 /* be converted to struct addrinfo* and stored in the addrinfo field. */ \
592 struct addrinfoW* addrinfow; \
593 struct addrinfo* addrinfo; \
594 int retcode;
595
596#define UV_GETNAMEINFO_PRIVATE_FIELDS \
597 struct uv__work work_req; \
598 uv_getnameinfo_cb getnameinfo_cb; \
599 struct sockaddr_storage storage; \
600 int flags; \
601 char host[NI_MAXHOST]; \
602 char service[NI_MAXSERV]; \
603 int retcode;
604
605#define UV_PROCESS_PRIVATE_FIELDS \
606 struct uv_process_exit_s { \
607 UV_REQ_FIELDS \
608 } exit_req; \
609 BYTE* child_stdio_buffer; \
610 int exit_signal; \
611 HANDLE wait_handle; \
612 HANDLE process_handle; \
613 volatile char exit_cb_pending;
614
615#define UV_FS_PRIVATE_FIELDS \
616 struct uv__work work_req; \
617 int flags; \
618 DWORD sys_errno_; \
619 union { \
620 /* TODO: remove me in 0.9. */ \
621 WCHAR* pathw; \
622 int fd; \
623 } file; \
624 union { \
625 struct { \
626 int mode; \
627 WCHAR* new_pathw; \
628 int file_flags; \
629 int fd_out; \
630 unsigned int nbufs; \
631 uv_buf_t* bufs; \
632 int64_t offset; \
633 uv_buf_t bufsml[4]; \
634 } info; \
635 struct { \
636 double atime; \
637 double mtime; \
638 } time; \
639 } fs;
640
641#define UV_WORK_PRIVATE_FIELDS \
642 struct uv__work work_req;
643
644#define UV_FS_EVENT_PRIVATE_FIELDS \
645 struct uv_fs_event_req_s { \
646 UV_REQ_FIELDS \
647 } req; \
648 HANDLE dir_handle; \
649 int req_pending; \
650 uv_fs_event_cb cb; \
651 WCHAR* filew; \
652 WCHAR* short_filew; \
653 WCHAR* dirw; \
654 char* buffer;
655
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;
660
661#ifndef F_OK
662#define F_OK 0
663#endif
664#ifndef R_OK
665#define R_OK 4
666#endif
667#ifndef W_OK
668#define W_OK 2
669#endif
670#ifndef X_OK
671#define X_OK 1
672#endif
673
674/* fs open() flags supported on this platform: */
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
687
688/* fs open() flags supported on other platforms (or mapped on this platform): */
689#define UV_FS_O_DIRECT 0x02000000 /* FILE_FLAG_NO_BUFFERING */
690#define UV_FS_O_DIRECTORY 0
691#define UV_FS_O_DSYNC 0x04000000 /* FILE_FLAG_WRITE_THROUGH */
692#define UV_FS_O_EXLOCK 0x10000000 /* EXCLUSIVE SHARING MODE */
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 /* FILE_FLAG_WRITE_THROUGH */
Definition: format.h:3856
flags
Definition: http_parser.h:206
Definition: win.h:214
HANDLE Handle
Definition: win.h:215
ULONG Events
Definition: win.h:216
NTSTATUS Status
Definition: win.h:217
Definition: win.h:220
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
Definition: win.h:300
int d_type
Definition: win.h:301
char d_name[1]
Definition: win.h:302
Definition: unix.h:146
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: unix.h:113
char * base
Definition: unix.h:114
ULONG len
Definition: win.h:235
DWORD tls_index
Definition: win.h:286
Definition: unix.h:208
HMODULE handle
Definition: win.h:322
Definition: win.h:291
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
UV_PLATFORM_SEM_T uv_sem_t
Definition: unix.h:129
pthread_rwlock_t uv_rwlock_t
Definition: unix.h:128
pthread_key_t uv_key_t
Definition: unix.h:131
pthread_mutex_t uv_mutex_t
Definition: unix.h:127
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