1 module deimos.uv.win;
2 public import deimos.uv._d;
3 version(Windows):
4 extern(C):
5 pure:
6 nothrow:
7 @nogc:
8 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining a copy
11  * of this software and associated documentation files (the "Software"), to
12  * deal in the Software without restriction, including without limitation the
13  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
14  * sell copies of the Software, and to permit persons to whom the Software is
15  * furnished to do so, subject to the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be included in
18  * all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
26  * IN THE SOFTWARE.
27  */
28 enum _WIN32_WINNT = 0x0600;
29 /* include(winsock2.h); */
30 struct pollfd {
31 	SOCKET fd;
32 	short events;
33 	short revents;
34 };
35 alias WSAPOLLFD = pollfd ;
36 alias PWSAPOLLFD = pollfd* ;
37 alias LPWSAPOLLFD = pollfd* ;
38 enum LOCALE_INVARIANT = 0x007f;
39 /* include(mswsock.h); */
40 /* include(ws2tcpip.h); */
41 /* include(windows.h); */
42 /* include(process.h); */
43 /* include(signal.h); */
44 /* include(fcntl.h); */
45 /* include(sys/stat.h); */
46 /* include(uv/tree.h); */
47 package import deimos.uv.threadpool; /* include(uv/threadpool.h); */ 
48 enum MAX_PIPENAME_LEN = 256 ;
49 /* Additional signals supported by uv_signal and or uv_kill. The CRT defines
50  * the following signals already:
51  *
52  *   #define SIGINT           2
53  *   #define SIGILL           4
54  *   #define SIGABRT_COMPAT   6
55  *   #define SIGFPE           8
56  *   #define SIGSEGV         11
57  *   #define SIGTERM         15
58  *   #define SIGBREAK        21
59  *   #define SIGABRT         22
60  *
61  * The additional signals have values that are common on other Unix
62  * variants (Linux and Darwin)
63  */
64 enum S_IFLNK = 0xA000;
65 enum SIGHUP = 1 ;
66 enum SIGKILL = 9 ;
67 /* Redefine NSIG to take SIGWINCH into consideration */
68 enum SIGWINCH = 28 ;
69 /* The CRT defines SIGABRT_COMPAT as 6, which equals SIGABRT on many unix-like
70  * platforms. However MinGW doesn't define it, so we do. */
71 /*
72  * Guids and typedefs for winsock extension functions
73  * Mingw32 doesn't have these :-(
74  */
75 enum SIGABRT_COMPAT = 6;
76 enum GUID WSAID_ACCEPTEX = {0xb5367df1,0xcbac,0x11cf,[0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92]};
77 enum GUID WSAID_CONNECTEX = {0x25a207b9,0xddf3,0x4660,[0x8e,0xe9,0x76,0xe5,0x8c,0x74,0x06,0x3e]};
78 enum GUID WSAID_GETACCEPTEXSOCKADDRS = {0xb5367df2,0xcbac,0x11cf,[0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92]};
79 enum GUID WSAID_DISCONNECTEX = {0x7fda2e11,0x8630,0x436f,[0xa0,0x31,0xf5,0x36,0xa6,0xee,0xc1,0x57]};
80 enum GUID WSAID_TRANSMITFILE = {0xb5367df0,0xcbac,0x11cf,[0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92]};
81 alias LPFN_ACCEPTEX = ExternWindows!(BOOL function(SOCKET sListenSocket, SOCKET sAcceptSocket, PVOID lpOutputBuffer, DWORD dwReceiveDataLength, DWORD dwLocalAddressLength, DWORD dwRemoteAddressLength, LPDWORD lpdwBytesReceived, LPOVERLAPPED lpOverlapped)) ;
82 alias LPFN_CONNECTEX = ExternWindows!(BOOL function(SOCKET s, inout(sockaddr)* name, int namelen, PVOID lpSendBuffer, DWORD dwSendDataLength, LPDWORD lpdwBytesSent, LPOVERLAPPED lpOverlapped)) ;
83 alias LPFN_GETACCEPTEXSOCKADDRS = ExternWindows!(void function(PVOID lpOutputBuffer, DWORD dwReceiveDataLength, DWORD dwLocalAddressLength, DWORD dwRemoteAddressLength, LPSOCKADDR* LocalSockaddr, LPINT LocalSockaddrLength, LPSOCKADDR* RemoteSockaddr, LPINT RemoteSockaddrLength)) ;
84 alias LPFN_DISCONNECTEX = ExternWindows!(BOOL function(SOCKET hSocket, LPOVERLAPPED lpOverlapped, DWORD dwFlags, DWORD reserved)) ;
85 alias LPFN_TRANSMITFILE = ExternWindows!(BOOL function(SOCKET hSocket, HANDLE hFile, DWORD nNumberOfBytesToWrite, DWORD nNumberOfBytesPerSend, LPOVERLAPPED lpOverlapped, LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers, DWORD dwFlags)) ;
86 alias RTL_SRWLOCK = PVOID ;
87 alias SRWLOCK = RTL_SRWLOCK ;
88 alias PSRWLOCK = RTL_SRWLOCK* ;
89 alias LPFN_WSARECV = ExternWindows!(int function(SOCKET socket, LPWSABUF buffers, DWORD buffer_count, LPDWORD bytes, LPDWORD flags, LPWSAOVERLAPPED overlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine)) ;
90 alias LPFN_WSARECVFROM = ExternWindows!(int function(SOCKET socket, LPWSABUF buffers, DWORD buffer_count, LPDWORD bytes, LPDWORD flags, sockaddr* addr, LPINT addr_len, LPWSAOVERLAPPED overlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine)) ;
91 alias NTSTATUS = LONG ;
92 alias PNTSTATUS = NTSTATUS* ;
93 alias CONDITION_VARIABLE = PVOID ;
94 alias PCONDITION_VARIABLE = PVOID* ;
95 struct _AFD_POLL_HANDLE_INFO {
96 	HANDLE Handle;
97 	ULONG Events;
98 	NTSTATUS Status;
99 };
100 alias AFD_POLL_HANDLE_INFO = _AFD_POLL_HANDLE_INFO ;
101 alias PAFD_POLL_HANDLE_INFO = _AFD_POLL_HANDLE_INFO* ;
102 struct _AFD_POLL_INFO {
103 	LARGE_INTEGER Timeout;
104 	ULONG NumberOfHandles;
105 	ULONG Exclusive;
106 	AFD_POLL_HANDLE_INFO[1] Handles;
107 };
108 alias AFD_POLL_INFO = _AFD_POLL_INFO ;
109 alias PAFD_POLL_INFO = _AFD_POLL_INFO* ;
110 /**
111  * It should be possible to cast uv_buf_t[] to WSABUF[]
112  * see http://msdn.microsoft.com/en-us/library/ms741542(v=vs.85).aspx
113  */
114 enum UV_MSAFD_PROVIDER_COUNT = 3 ;
115 struct uv_buf_t {
116 	ULONG len;
117 	char* base;
118 };
119 alias uv_file = int ;
120 alias uv_os_sock_t = SOCKET ;
121 alias uv_os_fd_t = HANDLE ;
122 alias uv_pid_t = int ;
123 alias uv_thread_t = HANDLE ;
124 alias uv_sem_t = HANDLE ;
125 /* This condition variable implementation is based on the SetEvent solution
126  * (section 3.2) at http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
127  * We could not use the SignalObjectAndWait solution (section 3.4) because
128  * it want the 2nd argument (type uv_mutex_t) of uv_cond_wait() and
129  * uv_cond_timedwait() to be HANDLEs, but we use CRITICAL_SECTIONs.
130  */
131 alias uv_mutex_t = CRITICAL_SECTION ;
132 union uv_cond_t {
133 	CONDITION_VARIABLE cond_var;
134 	struct unused__s {
135 		uint waiters_count;
136 		CRITICAL_SECTION waiters_count_lock;
137 		HANDLE signal_event;
138 		HANDLE broadcast_event;
139 	};
140 	unused__s unused_;
141 	/* TODO: retained for ABI compatibility; remove me in v2.x. */
142 };
143 union uv_rwlock_t {
144 	struct state__s {
145 		uint num_readers_;
146 		CRITICAL_SECTION num_readers_lock_;
147 		HANDLE write_semaphore_;
148 	};
149 	state__s state_;
150 	/* TODO: remove me in v2.x. */
151 	struct unused1__s {
152 		SRWLOCK unused_;
153 	};
154 	unused1__s unused1_;
155 	/* TODO: remove me in v2.x. */
156 	struct unused2__s {
157 		uv_mutex_t unused1_;
158 		uv_mutex_t unused2_;
159 	};
160 	unused2__s unused2_;
161 };
162 struct uv_barrier_t {
163 	uint n;
164 	uint count;
165 	uv_mutex_t mutex;
166 	uv_sem_t turnstile1;
167 	uv_sem_t turnstile2;
168 };
169 struct uv_key_t {
170 	DWORD tls_index;
171 };
172 /* Platform-specific definitions for uv_spawn support. */
173 struct uv_once_s {
174 	ubyte ran;
175 	HANDLE event;
176 };
177 alias uv_once_t = uv_once_s ;
178 alias uv_uid_t = ubyte ;
179 alias uv_gid_t = ubyte ;
180 struct uv__dirent_s {
181 	int d_type;
182 	char[1] d_name;
183 };
184 alias uv__dirent_t = uv__dirent_s ;
185 template UV_DIR_PRIVATE_FIELDS() {
186 	HANDLE dir_handle;
187 	WIN32_FIND_DATAW find_data;
188 	BOOL need_find_call;
189 }
190 template HAVE_DIRENT_TYPES() {};
191 alias UV__DT_DIR = UV_DIRENT_DIR ;
192 alias UV__DT_FILE = UV_DIRENT_FILE ;
193 alias UV__DT_LINK = UV_DIRENT_LINK ;
194 alias UV__DT_FIFO = UV_DIRENT_FIFO ;
195 alias UV__DT_SOCKET = UV_DIRENT_SOCKET ;
196 alias UV__DT_CHAR = UV_DIRENT_CHAR ;
197 /* Platform-specific definitions for uv_dlopen support. */
198 alias UV__DT_BLOCK = UV_DIRENT_BLOCK ;
199 struct uv_lib_t {
200 	HMODULE handle;
201 	char* errmsg;
202 };
203 template UV_LOOP_PRIVATE_FIELDS() {
204 	HANDLE iocp;
205 	/* The current time according to the event loop. in msecs. */
206 	uint64_t time;
207 	/* Tail of a single-linked circular queue of pending reqs. If the queue */
208 	/* is empty, tail_ is NULL. If there is only one item, */
209 	/* tail_->next_req == tail_ */
210 	uv_req_t* pending_reqs_tail;
211 	/* Head of a single-linked list of closed handles */
212 	uv_handle_t* endgame_handles;
213 	/* TODO(bnoordhuis) Stop heap-allocating |timer_heap| in libuv v2.x. */
214 	void* timer_heap;
215 	/* Lists of active loop (prepare / check / idle) watchers */
216 	uv_prepare_t* prepare_handles;
217 	uv_check_t* check_handles;
218 	uv_idle_t* idle_handles;
219 	/* This pointer will refer to the prepare/check/idle handle whose */
220 	/* callback is scheduled to be called next. This is needed to allow */
221 	/* safe removal from one of the lists above while that list being */
222 	/* iterated over. */
223 	uv_prepare_t* next_prepare_handle;
224 	uv_check_t* next_check_handle;
225 	uv_idle_t* next_idle_handle;
226 	/* This handle holds the peer sockets for the fast variant of uv_poll_t */
227 	SOCKET[UV_MSAFD_PROVIDER_COUNT] poll_peer_sockets;
228 	/* Counter to keep track of active tcp streams */
229 	uint active_tcp_streams;
230 	/* Counter to keep track of active udp streams */
231 	uint active_udp_streams;
232 	/* Counter to started timer */
233 	uint64_t timer_counter;
234 	/* Threadpool */
235 	void*[2] wq;
236 	uv_mutex_t wq_mutex;
237 	uv_async_t wq_async;
238 }
239 enum UV_REQ_TYPE_PRIVATE = `UV_ACCEPT,UV_FS_EVENT_REQ,UV_POLL_REQ,UV_PROCESS_EXIT,UV_READ,UV_UDP_RECV,UV_WAKEUP,UV_SIGNAL_REQ,`;
240 template UV_REQ_PRIVATE_FIELDS() {
241 	union u_s {
242 		/* Used by I/O operations */
243 		struct io_s {
244 			OVERLAPPED overlapped;
245 			size_t queued_bytes;
246 		};
247 		io_s io;
248 	};
249 	u_s u;
250 	uv_req_s* next_req;
251 }
252 template UV_WRITE_PRIVATE_FIELDS() {
253 	int coalesced;
254 	uv_buf_t write_buffer;
255 	HANDLE event_handle;
256 	HANDLE wait_handle;
257 }
258 template UV_CONNECT_PRIVATE_FIELDS() {};
259 template UV_SHUTDOWN_PRIVATE_FIELDS() {};
260 template UV_UDP_SEND_PRIVATE_FIELDS() {};
261 template UV_PRIVATE_REQ_TYPES() {
262 	struct uv_pipe_accept_t {
263 		mixin UV_REQ_FIELDS;
264 		HANDLE pipeHandle;
265 		uv_pipe_accept_t* next_pending;
266 	};
267 	uv_pipe_accept_t uv_pipe_accept_s;
268 	struct uv_tcp_accept_t {
269 		mixin UV_REQ_FIELDS;
270 		SOCKET accept_socket;
271 		char[sockaddr_storage.sizeof*2+32] accept_buffer;
272 		HANDLE event_handle;
273 		HANDLE wait_handle;
274 		uv_tcp_accept_t* next_pending;
275 	};
276 	uv_tcp_accept_t uv_tcp_accept_s;
277 	struct uv_read_t {
278 		mixin UV_REQ_FIELDS;
279 		HANDLE event_handle;
280 		HANDLE wait_handle;
281 	};
282 	uv_read_t uv_read_s;
283 }
284 template uv_stream_connection_fields() {
285 	uint write_reqs_pending;
286 	uv_shutdown_t* shutdown_req;
287 }
288 template uv_stream_server_fields() {
289 	uv_connection_cb connection_cb;
290 }
291 template UV_STREAM_PRIVATE_FIELDS() {
292 	uint reqs_pending;
293 	int activecnt;
294 	uv_read_t read_req;
295 	union stream_s {
296 		struct conn_s {
297 			mixin uv_stream_connection_fields;
298 		};
299 		conn_s conn;
300 		struct serv_s {
301 			mixin uv_stream_server_fields;
302 		};
303 		serv_s serv;
304 	};
305 	stream_s stream;
306 }
307 template uv_tcp_server_fields() {
308 	uv_tcp_accept_t* accept_reqs;
309 	uint processed_accepts;
310 	uv_tcp_accept_t* pending_accepts;
311 	LPFN_ACCEPTEX func_acceptex;
312 }
313 template uv_tcp_connection_fields() {
314 	uv_buf_t read_buffer;
315 	LPFN_CONNECTEX func_connectex;
316 }
317 template UV_TCP_PRIVATE_FIELDS() {
318 	SOCKET socket;
319 	int delayed_error;
320 	union tcp_s {
321 		struct serv_s {
322 			mixin uv_tcp_server_fields;
323 		};
324 		serv_s serv;
325 		struct conn_s {
326 			mixin uv_tcp_connection_fields;
327 		};
328 		conn_s conn;
329 	};
330 	tcp_s tcp;
331 }
332 template UV_UDP_PRIVATE_FIELDS() {
333 	SOCKET socket;
334 	uint reqs_pending;
335 	int activecnt;
336 	uv_req_t recv_req;
337 	uv_buf_t recv_buffer;
338 	sockaddr_storage recv_from;
339 	int recv_from_len;
340 	uv_udp_recv_cb recv_cb;
341 	uv_alloc_cb alloc_cb;
342 	LPFN_WSARECV func_wsarecv;
343 	LPFN_WSARECVFROM func_wsarecvfrom;
344 }
345 template uv_pipe_server_fields() {
346 	int pending_instances;
347 	uv_pipe_accept_t* accept_reqs;
348 	uv_pipe_accept_t* pending_accepts;
349 }
350 template uv_pipe_connection_fields() {
351 	uv_timer_t* eof_timer;
352 	uv_write_t dummy;
353 	DWORD ipc_remote_pid;
354 	union ipc_data_frame_s {
355 		uint32_t payload_remaining;
356 		uint64_t dummy;
357 	};
358 	ipc_data_frame_s ipc_data_frame;
359 	void*[2] ipc_xfer_queue;
360 	int ipc_xfer_queue_length;
361 	uv_write_t* non_overlapped_writes_tail;
362 	CRITICAL_SECTION readfile_thread_lock;
363 	HANDLE readfile_thread_handle;
364 }
365 /* TODO: put the parser states in an union - TTY handles are always half-duplex
366  * so read-state can safely overlap write-state. */
367 template UV_PIPE_PRIVATE_FIELDS() {
368 	HANDLE handle;
369 	WCHAR* name;
370 	union pipe_s {
371 		struct serv_s {
372 			mixin uv_pipe_server_fields;
373 		};
374 		serv_s serv;
375 		struct conn_s {
376 			mixin uv_pipe_connection_fields;
377 		};
378 		conn_s conn;
379 	};
380 	pipe_s pipe;
381 }
382 template UV_TTY_PRIVATE_FIELDS() {
383 	HANDLE handle;
384 	union tty_s {
385 		struct rd_s {
386 			/* Used for readable TTY handles */
387 			/* TODO: remove me in v2.x. */
388 			HANDLE unused_;
389 			uv_buf_t read_line_buffer;
390 			HANDLE read_raw_wait;
391 			/* Fields used for translating win keystrokes into vt100 characters */
392 			char[8] last_key;
393 			ubyte last_key_offset;
394 			ubyte last_key_len;
395 			WCHAR last_utf16_high_surrogate;
396 			INPUT_RECORD last_input_record;
397 		};
398 		rd_s rd;
399 		struct wr_s {
400 			/* Used for writable TTY handles */
401 			/* utf8-to-utf16 conversion state */
402 			uint utf8_codepoint;
403 			ubyte utf8_bytes_left;
404 			/* eol conversion state */
405 			ubyte previous_eol;
406 			/* ansi parser state */
407 			ushort ansi_parser_state;
408 			ubyte ansi_csi_argc;
409 			ushort[4] ansi_csi_argv;
410 			COORD saved_position;
411 			WORD saved_attributes;
412 		};
413 		wr_s wr;
414 	};
415 	tty_s tty;
416 }
417 template UV_POLL_PRIVATE_FIELDS() {
418 	SOCKET socket;
419 	/* Used in fast mode */
420 	SOCKET peer_socket;
421 	AFD_POLL_INFO afd_poll_info_1;
422 	AFD_POLL_INFO afd_poll_info_2;
423 	/* Used in fast and slow mode. */
424 	uv_req_t poll_req_1;
425 	uv_req_t poll_req_2;
426 	ubyte submitted_events_1;
427 	ubyte submitted_events_2;
428 	ubyte mask_events_1;
429 	ubyte mask_events_2;
430 	ubyte events;
431 }
432 template UV_TIMER_PRIVATE_FIELDS() {
433 	void*[3] heap_node;
434 	int unused;
435 	uint64_t timeout;
436 	uint64_t repeat;
437 	uint64_t start_id;
438 	uv_timer_cb timer_cb;
439 }
440 template UV_ASYNC_PRIVATE_FIELDS() {
441 	uv_req_s async_req;
442 	uv_async_cb async_cb;
443 	/* char to avoid alignment issues */
444 	char async_sent;
445 }
446 template UV_PREPARE_PRIVATE_FIELDS() {
447 	uv_prepare_t* prepare_prev;
448 	uv_prepare_t* prepare_next;
449 	uv_prepare_cb prepare_cb;
450 }
451 template UV_CHECK_PRIVATE_FIELDS() {
452 	uv_check_t* check_prev;
453 	uv_check_t* check_next;
454 	uv_check_cb check_cb;
455 }
456 template UV_IDLE_PRIVATE_FIELDS() {
457 	uv_idle_t* idle_prev;
458 	uv_idle_t* idle_next;
459 	uv_idle_cb idle_cb;
460 }
461 template UV_HANDLE_PRIVATE_FIELDS() {
462 	uv_handle_t* endgame_next;
463 	uint flags;
464 }
465 template UV_GETADDRINFO_PRIVATE_FIELDS() {
466 	uv__work work_req;
467 	uv_getaddrinfo_cb getaddrinfo_cb;
468 	void* alloc;
469 	WCHAR* node;
470 	WCHAR* service;
471 	/* The addrinfoW field is used to store a pointer to the hints, and    */
472 	/* later on to store the result of GetAddrInfoW. The final result will */
473 	/* be converted to struct addrinfo* and stored in the addrinfo field.  */
474 	addrinfoW* addrinfow;
475 	addrinfo* addrinfo_;
476 	int retcode;
477 }
478 template UV_GETNAMEINFO_PRIVATE_FIELDS() {
479 	uv__work work_req;
480 	uv_getnameinfo_cb getnameinfo_cb;
481 	sockaddr_storage storage;
482 	int flags;
483 	char[NI_MAXHOST] host;
484 	char[NI_MAXSERV] service;
485 	int retcode;
486 }
487 template UV_PROCESS_PRIVATE_FIELDS() {
488 	struct exit_req_s {
489 		mixin UV_REQ_FIELDS;
490 	};
491 	exit_req_s exit_req;
492 	BYTE* child_stdio_buffer;
493 	int exit_signal;
494 	HANDLE wait_handle;
495 	HANDLE process_handle;
496 	char exit_cb_pending;
497 }
498 template UV_FS_PRIVATE_FIELDS() {
499 	uv__work work_req;
500 	int flags;
501 	DWORD sys_errno_;
502 	union file_s {
503 		/* TODO: remove me in 0.9. */
504 		WCHAR* pathw;
505 		int fd;
506 	};
507 	file_s file;
508 	union fs_s {
509 		struct info_s {
510 			int mode;
511 			WCHAR* new_pathw;
512 			int file_flags;
513 			int fd_out;
514 			uint nbufs;
515 			uv_buf_t* bufs;
516 			int64_t offset;
517 			uv_buf_t[4] bufsml;
518 		};
519 		info_s info;
520 		struct time_s {
521 			double atime;
522 			double mtime;
523 		};
524 		time_s time;
525 	};
526 	fs_s fs;
527 }
528 template UV_WORK_PRIVATE_FIELDS() {
529 	uv__work work_req;
530 }
531 template UV_FS_EVENT_PRIVATE_FIELDS() {
532 	struct req_s {
533 		mixin UV_REQ_FIELDS;
534 	};
535 	req_s req;
536 	HANDLE dir_handle;
537 	int req_pending;
538 	uv_fs_event_cb cb;
539 	WCHAR* filew;
540 	WCHAR* short_filew;
541 	WCHAR* dirw;
542 	char* buffer;
543 }
544 template UV_SIGNAL_PRIVATE_FIELDS() {
545 	RB_ENTRY!(uv_signal_s) tree_entry;
546 	uv_req_s signal_req;
547 	c_ulong pending_signum;
548 }
549 enum F_OK = 0;
550 enum R_OK = 4;
551 enum W_OK = 2;
552 /* fs open() flags supported on this platform: */
553 enum X_OK = 1;
554 alias UV_FS_O_APPEND = _O_APPEND ;
555 alias UV_FS_O_CREAT = _O_CREAT ;
556 alias UV_FS_O_EXCL = _O_EXCL ;
557 enum UV_FS_O_FILEMAP = 0x20000000 ;
558 alias UV_FS_O_RANDOM = _O_RANDOM ;
559 alias UV_FS_O_RDONLY = _O_RDONLY ;
560 alias UV_FS_O_RDWR = _O_RDWR ;
561 alias UV_FS_O_SEQUENTIAL = _O_SEQUENTIAL ;
562 alias UV_FS_O_SHORT_LIVED = _O_SHORT_LIVED ;
563 alias UV_FS_O_TEMPORARY = _O_TEMPORARY ;
564 alias UV_FS_O_TRUNC = _O_TRUNC ;
565 /* fs open() flags supported on other platforms (or mapped on this platform): */
566 alias UV_FS_O_WRONLY = _O_WRONLY ;
567 enum UV_FS_O_DIRECT = 0x02000000 ;
568 enum UV_FS_O_DIRECTORY = 0 ;
569 enum UV_FS_O_DSYNC = 0x04000000 ;
570 enum UV_FS_O_EXLOCK = 0x10000000 ;
571 enum UV_FS_O_NOATIME = 0 ;
572 enum UV_FS_O_NOCTTY = 0 ;
573 enum UV_FS_O_NOFOLLOW = 0 ;
574 enum UV_FS_O_NONBLOCK = 0 ;
575 enum UV_FS_O_SYMLINK = 0 ;
576 enum UV_FS_O_SYNC = 0x08000000 ;