PageRenderTime 50ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/deps/uv/include/uv-win.h

https://gitlab.com/GeekSir/node
C Header | 647 lines | 503 code | 84 blank | 60 comment | 3 complexity | 55e6d2edf77245805d7761d7d2498752 MD5 | raw file
Possible License(s): 0BSD, Apache-2.0, MPL-2.0-no-copyleft-exception, JSON, WTFPL, CC-BY-SA-3.0, Unlicense, ISC, BSD-3-Clause, MIT, AGPL-3.0
  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. #ifndef _WIN32_WINNT
  22. # define _WIN32_WINNT 0x0502
  23. #endif
  24. #if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED)
  25. typedef intptr_t ssize_t;
  26. # define _SSIZE_T_
  27. # define _SSIZE_T_DEFINED
  28. #endif
  29. #include <winsock2.h>
  30. #if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
  31. typedef struct pollfd {
  32. SOCKET fd;
  33. short events;
  34. short revents;
  35. } WSAPOLLFD, *PWSAPOLLFD, *LPWSAPOLLFD;
  36. #endif
  37. #ifndef LOCALE_INVARIANT
  38. # define LOCALE_INVARIANT 0x007f
  39. #endif
  40. #include <mswsock.h>
  41. #include <ws2tcpip.h>
  42. #include <windows.h>
  43. #include <process.h>
  44. #include <signal.h>
  45. #include <sys/stat.h>
  46. #if defined(_MSC_VER) && _MSC_VER < 1600
  47. # include "stdint-msvc2008.h"
  48. #else
  49. # include <stdint.h>
  50. #endif
  51. #include "tree.h"
  52. #include "uv-threadpool.h"
  53. #define MAX_PIPENAME_LEN 256
  54. #ifndef S_IFLNK
  55. # define S_IFLNK 0xA000
  56. #endif
  57. /* Additional signals supported by uv_signal and or uv_kill. The CRT defines
  58. * the following signals already:
  59. *
  60. * #define SIGINT 2
  61. * #define SIGILL 4
  62. * #define SIGABRT_COMPAT 6
  63. * #define SIGFPE 8
  64. * #define SIGSEGV 11
  65. * #define SIGTERM 15
  66. * #define SIGBREAK 21
  67. * #define SIGABRT 22
  68. *
  69. * The additional signals have values that are common on other Unix
  70. * variants (Linux and Darwin)
  71. */
  72. #define SIGHUP 1
  73. #define SIGKILL 9
  74. #define SIGWINCH 28
  75. /* The CRT defines SIGABRT_COMPAT as 6, which equals SIGABRT on many */
  76. /* unix-like platforms. However MinGW doesn't define it, so we do. */
  77. #ifndef SIGABRT_COMPAT
  78. # define SIGABRT_COMPAT 6
  79. #endif
  80. /*
  81. * Guids and typedefs for winsock extension functions
  82. * Mingw32 doesn't have these :-(
  83. */
  84. #ifndef WSAID_ACCEPTEX
  85. # define WSAID_ACCEPTEX \
  86. {0xb5367df1, 0xcbac, 0x11cf, \
  87. {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
  88. # define WSAID_CONNECTEX \
  89. {0x25a207b9, 0xddf3, 0x4660, \
  90. {0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}}
  91. # define WSAID_GETACCEPTEXSOCKADDRS \
  92. {0xb5367df2, 0xcbac, 0x11cf, \
  93. {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
  94. # define WSAID_DISCONNECTEX \
  95. {0x7fda2e11, 0x8630, 0x436f, \
  96. {0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}}
  97. # define WSAID_TRANSMITFILE \
  98. {0xb5367df0, 0xcbac, 0x11cf, \
  99. {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
  100. typedef BOOL PASCAL (*LPFN_ACCEPTEX)
  101. (SOCKET sListenSocket,
  102. SOCKET sAcceptSocket,
  103. PVOID lpOutputBuffer,
  104. DWORD dwReceiveDataLength,
  105. DWORD dwLocalAddressLength,
  106. DWORD dwRemoteAddressLength,
  107. LPDWORD lpdwBytesReceived,
  108. LPOVERLAPPED lpOverlapped);
  109. typedef BOOL PASCAL (*LPFN_CONNECTEX)
  110. (SOCKET s,
  111. const struct sockaddr* name,
  112. int namelen,
  113. PVOID lpSendBuffer,
  114. DWORD dwSendDataLength,
  115. LPDWORD lpdwBytesSent,
  116. LPOVERLAPPED lpOverlapped);
  117. typedef void PASCAL (*LPFN_GETACCEPTEXSOCKADDRS)
  118. (PVOID lpOutputBuffer,
  119. DWORD dwReceiveDataLength,
  120. DWORD dwLocalAddressLength,
  121. DWORD dwRemoteAddressLength,
  122. LPSOCKADDR* LocalSockaddr,
  123. LPINT LocalSockaddrLength,
  124. LPSOCKADDR* RemoteSockaddr,
  125. LPINT RemoteSockaddrLength);
  126. typedef BOOL PASCAL (*LPFN_DISCONNECTEX)
  127. (SOCKET hSocket,
  128. LPOVERLAPPED lpOverlapped,
  129. DWORD dwFlags,
  130. DWORD reserved);
  131. typedef BOOL PASCAL (*LPFN_TRANSMITFILE)
  132. (SOCKET hSocket,
  133. HANDLE hFile,
  134. DWORD nNumberOfBytesToWrite,
  135. DWORD nNumberOfBytesPerSend,
  136. LPOVERLAPPED lpOverlapped,
  137. LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers,
  138. DWORD dwFlags);
  139. typedef PVOID RTL_SRWLOCK;
  140. typedef RTL_SRWLOCK SRWLOCK, *PSRWLOCK;
  141. #endif
  142. typedef int (WSAAPI* LPFN_WSARECV)
  143. (SOCKET socket,
  144. LPWSABUF buffers,
  145. DWORD buffer_count,
  146. LPDWORD bytes,
  147. LPDWORD flags,
  148. LPWSAOVERLAPPED overlapped,
  149. LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine);
  150. typedef int (WSAAPI* LPFN_WSARECVFROM)
  151. (SOCKET socket,
  152. LPWSABUF buffers,
  153. DWORD buffer_count,
  154. LPDWORD bytes,
  155. LPDWORD flags,
  156. struct sockaddr* addr,
  157. LPINT addr_len,
  158. LPWSAOVERLAPPED overlapped,
  159. LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine);
  160. #ifndef _NTDEF_
  161. typedef LONG NTSTATUS;
  162. typedef NTSTATUS *PNTSTATUS;
  163. #endif
  164. #ifndef RTL_CONDITION_VARIABLE_INIT
  165. typedef PVOID CONDITION_VARIABLE, *PCONDITION_VARIABLE;
  166. #endif
  167. typedef struct _AFD_POLL_HANDLE_INFO {
  168. HANDLE Handle;
  169. ULONG Events;
  170. NTSTATUS Status;
  171. } AFD_POLL_HANDLE_INFO, *PAFD_POLL_HANDLE_INFO;
  172. typedef struct _AFD_POLL_INFO {
  173. LARGE_INTEGER Timeout;
  174. ULONG NumberOfHandles;
  175. ULONG Exclusive;
  176. AFD_POLL_HANDLE_INFO Handles[1];
  177. } AFD_POLL_INFO, *PAFD_POLL_INFO;
  178. #define UV_MSAFD_PROVIDER_COUNT 3
  179. /**
  180. * It should be possible to cast uv_buf_t[] to WSABUF[]
  181. * see http://msdn.microsoft.com/en-us/library/ms741542(v=vs.85).aspx
  182. */
  183. typedef struct uv_buf_t {
  184. ULONG len;
  185. char* base;
  186. } uv_buf_t;
  187. typedef int uv_file;
  188. typedef SOCKET uv_os_sock_t;
  189. typedef HANDLE uv_os_fd_t;
  190. typedef HANDLE uv_thread_t;
  191. typedef HANDLE uv_sem_t;
  192. typedef CRITICAL_SECTION uv_mutex_t;
  193. /* This condition variable implementation is based on the SetEvent solution
  194. * (section 3.2) at http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
  195. * We could not use the SignalObjectAndWait solution (section 3.4) because
  196. * it want the 2nd argument (type uv_mutex_t) of uv_cond_wait() and
  197. * uv_cond_timedwait() to be HANDLEs, but we use CRITICAL_SECTIONs.
  198. */
  199. typedef union {
  200. CONDITION_VARIABLE cond_var;
  201. struct {
  202. unsigned int waiters_count;
  203. CRITICAL_SECTION waiters_count_lock;
  204. HANDLE signal_event;
  205. HANDLE broadcast_event;
  206. } fallback;
  207. } uv_cond_t;
  208. typedef union {
  209. /* srwlock_ has type SRWLOCK, but not all toolchains define this type in */
  210. /* windows.h. */
  211. SRWLOCK srwlock_;
  212. struct {
  213. uv_mutex_t read_mutex_;
  214. uv_mutex_t write_mutex_;
  215. unsigned int num_readers_;
  216. } fallback_;
  217. } uv_rwlock_t;
  218. typedef struct {
  219. unsigned int n;
  220. unsigned int count;
  221. uv_mutex_t mutex;
  222. uv_sem_t turnstile1;
  223. uv_sem_t turnstile2;
  224. } uv_barrier_t;
  225. typedef struct {
  226. DWORD tls_index;
  227. } uv_key_t;
  228. #define UV_ONCE_INIT { 0, NULL }
  229. typedef struct uv_once_s {
  230. unsigned char ran;
  231. HANDLE event;
  232. } uv_once_t;
  233. /* Platform-specific definitions for uv_spawn support. */
  234. typedef unsigned char uv_uid_t;
  235. typedef unsigned char uv_gid_t;
  236. typedef struct uv__dirent_s {
  237. int d_type;
  238. char d_name[1];
  239. } uv__dirent_t;
  240. #define HAVE_DIRENT_TYPES
  241. #define UV__DT_DIR UV_DIRENT_DIR
  242. #define UV__DT_FILE UV_DIRENT_FILE
  243. #define UV__DT_LINK UV_DIRENT_LINK
  244. #define UV__DT_FIFO UV_DIRENT_FIFO
  245. #define UV__DT_SOCKET UV_DIRENT_SOCKET
  246. #define UV__DT_CHAR UV_DIRENT_CHAR
  247. #define UV__DT_BLOCK UV_DIRENT_BLOCK
  248. /* Platform-specific definitions for uv_dlopen support. */
  249. #define UV_DYNAMIC FAR WINAPI
  250. typedef struct {
  251. HMODULE handle;
  252. char* errmsg;
  253. } uv_lib_t;
  254. RB_HEAD(uv_timer_tree_s, uv_timer_s);
  255. #define UV_LOOP_PRIVATE_FIELDS \
  256. /* The loop's I/O completion port */ \
  257. HANDLE iocp; \
  258. /* The current time according to the event loop. in msecs. */ \
  259. uint64_t time; \
  260. /* Tail of a single-linked circular queue of pending reqs. If the queue */ \
  261. /* is empty, tail_ is NULL. If there is only one item, */ \
  262. /* tail_->next_req == tail_ */ \
  263. uv_req_t* pending_reqs_tail; \
  264. /* Head of a single-linked list of closed handles */ \
  265. uv_handle_t* endgame_handles; \
  266. /* The head of the timers tree */ \
  267. struct uv_timer_tree_s timers; \
  268. /* Lists of active loop (prepare / check / idle) watchers */ \
  269. uv_prepare_t* prepare_handles; \
  270. uv_check_t* check_handles; \
  271. uv_idle_t* idle_handles; \
  272. /* This pointer will refer to the prepare/check/idle handle whose */ \
  273. /* callback is scheduled to be called next. This is needed to allow */ \
  274. /* safe removal from one of the lists above while that list being */ \
  275. /* iterated over. */ \
  276. uv_prepare_t* next_prepare_handle; \
  277. uv_check_t* next_check_handle; \
  278. uv_idle_t* next_idle_handle; \
  279. /* This handle holds the peer sockets for the fast variant of uv_poll_t */ \
  280. SOCKET poll_peer_sockets[UV_MSAFD_PROVIDER_COUNT]; \
  281. /* Counter to keep track of active tcp streams */ \
  282. unsigned int active_tcp_streams; \
  283. /* Counter to keep track of active udp streams */ \
  284. unsigned int active_udp_streams; \
  285. /* Counter to started timer */ \
  286. uint64_t timer_counter; \
  287. /* Threadpool */ \
  288. void* wq[2]; \
  289. uv_mutex_t wq_mutex; \
  290. uv_async_t wq_async;
  291. #define UV_REQ_TYPE_PRIVATE \
  292. /* TODO: remove the req suffix */ \
  293. UV_ACCEPT, \
  294. UV_FS_EVENT_REQ, \
  295. UV_POLL_REQ, \
  296. UV_PROCESS_EXIT, \
  297. UV_READ, \
  298. UV_UDP_RECV, \
  299. UV_WAKEUP, \
  300. UV_SIGNAL_REQ,
  301. #define UV_REQ_PRIVATE_FIELDS \
  302. union { \
  303. /* Used by I/O operations */ \
  304. struct { \
  305. OVERLAPPED overlapped; \
  306. size_t queued_bytes; \
  307. } io; \
  308. } u; \
  309. struct uv_req_s* next_req;
  310. #define UV_WRITE_PRIVATE_FIELDS \
  311. int ipc_header; \
  312. uv_buf_t write_buffer; \
  313. HANDLE event_handle; \
  314. HANDLE wait_handle;
  315. #define UV_CONNECT_PRIVATE_FIELDS \
  316. /* empty */
  317. #define UV_SHUTDOWN_PRIVATE_FIELDS \
  318. /* empty */
  319. #define UV_UDP_SEND_PRIVATE_FIELDS \
  320. /* empty */
  321. #define UV_PRIVATE_REQ_TYPES \
  322. typedef struct uv_pipe_accept_s { \
  323. UV_REQ_FIELDS \
  324. HANDLE pipeHandle; \
  325. struct uv_pipe_accept_s* next_pending; \
  326. } uv_pipe_accept_t; \
  327. \
  328. typedef struct uv_tcp_accept_s { \
  329. UV_REQ_FIELDS \
  330. SOCKET accept_socket; \
  331. char accept_buffer[sizeof(struct sockaddr_storage) * 2 + 32]; \
  332. HANDLE event_handle; \
  333. HANDLE wait_handle; \
  334. struct uv_tcp_accept_s* next_pending; \
  335. } uv_tcp_accept_t; \
  336. \
  337. typedef struct uv_read_s { \
  338. UV_REQ_FIELDS \
  339. HANDLE event_handle; \
  340. HANDLE wait_handle; \
  341. } uv_read_t;
  342. #define uv_stream_connection_fields \
  343. unsigned int write_reqs_pending; \
  344. uv_shutdown_t* shutdown_req;
  345. #define uv_stream_server_fields \
  346. uv_connection_cb connection_cb;
  347. #define UV_STREAM_PRIVATE_FIELDS \
  348. unsigned int reqs_pending; \
  349. int activecnt; \
  350. uv_read_t read_req; \
  351. union { \
  352. struct { uv_stream_connection_fields } conn; \
  353. struct { uv_stream_server_fields } serv; \
  354. } stream;
  355. #define uv_tcp_server_fields \
  356. uv_tcp_accept_t* accept_reqs; \
  357. unsigned int processed_accepts; \
  358. uv_tcp_accept_t* pending_accepts; \
  359. LPFN_ACCEPTEX func_acceptex;
  360. #define uv_tcp_connection_fields \
  361. uv_buf_t read_buffer; \
  362. LPFN_CONNECTEX func_connectex;
  363. #define UV_TCP_PRIVATE_FIELDS \
  364. SOCKET socket; \
  365. int delayed_error; \
  366. union { \
  367. struct { uv_tcp_server_fields } serv; \
  368. struct { uv_tcp_connection_fields } conn; \
  369. } tcp;
  370. #define UV_UDP_PRIVATE_FIELDS \
  371. SOCKET socket; \
  372. unsigned int reqs_pending; \
  373. int activecnt; \
  374. uv_req_t recv_req; \
  375. uv_buf_t recv_buffer; \
  376. struct sockaddr_storage recv_from; \
  377. int recv_from_len; \
  378. uv_udp_recv_cb recv_cb; \
  379. uv_alloc_cb alloc_cb; \
  380. LPFN_WSARECV func_wsarecv; \
  381. LPFN_WSARECVFROM func_wsarecvfrom;
  382. #define uv_pipe_server_fields \
  383. int pending_instances; \
  384. uv_pipe_accept_t* accept_reqs; \
  385. uv_pipe_accept_t* pending_accepts;
  386. #define uv_pipe_connection_fields \
  387. uv_timer_t* eof_timer; \
  388. uv_write_t ipc_header_write_req; \
  389. int ipc_pid; \
  390. uint64_t remaining_ipc_rawdata_bytes; \
  391. struct { \
  392. void* queue[2]; \
  393. int queue_len; \
  394. } pending_ipc_info; \
  395. uv_write_t* non_overlapped_writes_tail; \
  396. uv_mutex_t readfile_mutex; \
  397. volatile HANDLE readfile_thread;
  398. #define UV_PIPE_PRIVATE_FIELDS \
  399. HANDLE handle; \
  400. WCHAR* name; \
  401. union { \
  402. struct { uv_pipe_server_fields } serv; \
  403. struct { uv_pipe_connection_fields } conn; \
  404. } pipe;
  405. /* TODO: put the parser states in an union - TTY handles are always */
  406. /* half-duplex so read-state can safely overlap write-state. */
  407. #define UV_TTY_PRIVATE_FIELDS \
  408. HANDLE handle; \
  409. union { \
  410. struct { \
  411. /* Used for readable TTY handles */ \
  412. HANDLE read_line_handle; \
  413. uv_buf_t read_line_buffer; \
  414. HANDLE read_raw_wait; \
  415. /* Fields used for translating win keystrokes into vt100 characters */ \
  416. char last_key[8]; \
  417. unsigned char last_key_offset; \
  418. unsigned char last_key_len; \
  419. WCHAR last_utf16_high_surrogate; \
  420. INPUT_RECORD last_input_record; \
  421. } rd; \
  422. struct { \
  423. /* Used for writable TTY handles */ \
  424. /* utf8-to-utf16 conversion state */ \
  425. unsigned int utf8_codepoint; \
  426. unsigned char utf8_bytes_left; \
  427. /* eol conversion state */ \
  428. unsigned char previous_eol; \
  429. /* ansi parser state */ \
  430. unsigned char ansi_parser_state; \
  431. unsigned char ansi_csi_argc; \
  432. unsigned short ansi_csi_argv[4]; \
  433. COORD saved_position; \
  434. WORD saved_attributes; \
  435. } wr; \
  436. } tty;
  437. #define UV_POLL_PRIVATE_FIELDS \
  438. SOCKET socket; \
  439. /* Used in fast mode */ \
  440. SOCKET peer_socket; \
  441. AFD_POLL_INFO afd_poll_info_1; \
  442. AFD_POLL_INFO afd_poll_info_2; \
  443. /* Used in fast and slow mode. */ \
  444. uv_req_t poll_req_1; \
  445. uv_req_t poll_req_2; \
  446. unsigned char submitted_events_1; \
  447. unsigned char submitted_events_2; \
  448. unsigned char mask_events_1; \
  449. unsigned char mask_events_2; \
  450. unsigned char events;
  451. #define UV_TIMER_PRIVATE_FIELDS \
  452. RB_ENTRY(uv_timer_s) tree_entry; \
  453. uint64_t due; \
  454. uint64_t repeat; \
  455. uint64_t start_id; \
  456. uv_timer_cb timer_cb;
  457. #define UV_ASYNC_PRIVATE_FIELDS \
  458. struct uv_req_s async_req; \
  459. uv_async_cb async_cb; \
  460. /* char to avoid alignment issues */ \
  461. char volatile async_sent;
  462. #define UV_PREPARE_PRIVATE_FIELDS \
  463. uv_prepare_t* prepare_prev; \
  464. uv_prepare_t* prepare_next; \
  465. uv_prepare_cb prepare_cb;
  466. #define UV_CHECK_PRIVATE_FIELDS \
  467. uv_check_t* check_prev; \
  468. uv_check_t* check_next; \
  469. uv_check_cb check_cb;
  470. #define UV_IDLE_PRIVATE_FIELDS \
  471. uv_idle_t* idle_prev; \
  472. uv_idle_t* idle_next; \
  473. uv_idle_cb idle_cb;
  474. #define UV_HANDLE_PRIVATE_FIELDS \
  475. uv_handle_t* endgame_next; \
  476. unsigned int flags;
  477. #define UV_GETADDRINFO_PRIVATE_FIELDS \
  478. struct uv__work work_req; \
  479. uv_getaddrinfo_cb getaddrinfo_cb; \
  480. void* alloc; \
  481. WCHAR* node; \
  482. WCHAR* service; \
  483. /* The addrinfoW field is used to store a pointer to the hints, and */ \
  484. /* later on to store the result of GetAddrInfoW. The final result will */ \
  485. /* be converted to struct addrinfo* and stored in the addrinfo field. */ \
  486. struct addrinfoW* addrinfow; \
  487. struct addrinfo* addrinfo; \
  488. int retcode;
  489. #define UV_GETNAMEINFO_PRIVATE_FIELDS \
  490. struct uv__work work_req; \
  491. uv_getnameinfo_cb getnameinfo_cb; \
  492. struct sockaddr_storage storage; \
  493. int flags; \
  494. char host[NI_MAXHOST]; \
  495. char service[NI_MAXSERV]; \
  496. int retcode;
  497. #define UV_PROCESS_PRIVATE_FIELDS \
  498. struct uv_process_exit_s { \
  499. UV_REQ_FIELDS \
  500. } exit_req; \
  501. BYTE* child_stdio_buffer; \
  502. int exit_signal; \
  503. HANDLE wait_handle; \
  504. HANDLE process_handle; \
  505. volatile char exit_cb_pending;
  506. #define UV_FS_PRIVATE_FIELDS \
  507. struct uv__work work_req; \
  508. int flags; \
  509. DWORD sys_errno_; \
  510. union { \
  511. /* TODO: remove me in 0.9. */ \
  512. WCHAR* pathw; \
  513. int fd; \
  514. } file; \
  515. union { \
  516. struct { \
  517. int mode; \
  518. WCHAR* new_pathw; \
  519. int file_flags; \
  520. int fd_out; \
  521. unsigned int nbufs; \
  522. uv_buf_t* bufs; \
  523. int64_t offset; \
  524. uv_buf_t bufsml[4]; \
  525. } info; \
  526. struct { \
  527. double atime; \
  528. double mtime; \
  529. } time; \
  530. } fs;
  531. #define UV_WORK_PRIVATE_FIELDS \
  532. struct uv__work work_req;
  533. #define UV_FS_EVENT_PRIVATE_FIELDS \
  534. struct uv_fs_event_req_s { \
  535. UV_REQ_FIELDS \
  536. } req; \
  537. HANDLE dir_handle; \
  538. int req_pending; \
  539. uv_fs_event_cb cb; \
  540. WCHAR* filew; \
  541. WCHAR* short_filew; \
  542. WCHAR* dirw; \
  543. char* buffer;
  544. #define UV_SIGNAL_PRIVATE_FIELDS \
  545. RB_ENTRY(uv_signal_s) tree_entry; \
  546. struct uv_req_s signal_req; \
  547. unsigned long pending_signum;
  548. int uv_utf16_to_utf8(const WCHAR* utf16Buffer, size_t utf16Size,
  549. char* utf8Buffer, size_t utf8Size);
  550. int uv_utf8_to_utf16(const char* utf8Buffer, WCHAR* utf16Buffer,
  551. size_t utf16Size);
  552. #ifndef F_OK
  553. #define F_OK 0
  554. #endif
  555. #ifndef R_OK
  556. #define R_OK 4
  557. #endif
  558. #ifndef W_OK
  559. #define W_OK 2
  560. #endif
  561. #ifndef X_OK
  562. #define X_OK 1
  563. #endif