unix.h revision 1.1 1 1.1 christos /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
2 1.1 christos *
3 1.1 christos * Permission is hereby granted, free of charge, to any person obtaining a copy
4 1.1 christos * of this software and associated documentation files (the "Software"), to
5 1.1 christos * deal in the Software without restriction, including without limitation the
6 1.1 christos * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 1.1 christos * sell copies of the Software, and to permit persons to whom the Software is
8 1.1 christos * furnished to do so, subject to the following conditions:
9 1.1 christos *
10 1.1 christos * The above copyright notice and this permission notice shall be included in
11 1.1 christos * all copies or substantial portions of the Software.
12 1.1 christos *
13 1.1 christos * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 1.1 christos * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 1.1 christos * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 1.1 christos * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 1.1 christos * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 1.1 christos * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19 1.1 christos * IN THE SOFTWARE.
20 1.1 christos */
21 1.1 christos
22 1.1 christos #ifndef UV_UNIX_H
23 1.1 christos #define UV_UNIX_H
24 1.1 christos
25 1.1 christos #include <sys/types.h>
26 1.1 christos #include <sys/stat.h>
27 1.1 christos #include <fcntl.h>
28 1.1 christos #include <dirent.h>
29 1.1 christos
30 1.1 christos #include <sys/socket.h>
31 1.1 christos #include <netinet/in.h>
32 1.1 christos #include <netinet/tcp.h>
33 1.1 christos #include <arpa/inet.h>
34 1.1 christos #include <netdb.h> /* MAXHOSTNAMELEN on Solaris */
35 1.1 christos
36 1.1 christos #include <termios.h>
37 1.1 christos #include <pwd.h>
38 1.1 christos
39 1.1 christos #if !defined(__MVS__)
40 1.1 christos #include <semaphore.h>
41 1.1 christos #include <sys/param.h> /* MAXHOSTNAMELEN on Linux and the BSDs */
42 1.1 christos #endif
43 1.1 christos #include <pthread.h>
44 1.1 christos #include <signal.h>
45 1.1 christos
46 1.1 christos #include "uv/threadpool.h"
47 1.1 christos
48 1.1 christos #if defined(__linux__)
49 1.1 christos # include "uv/linux.h"
50 1.1 christos #elif defined (__MVS__)
51 1.1 christos # include "uv/os390.h"
52 1.1 christos #elif defined(__PASE__) /* __PASE__ and _AIX are both defined on IBM i */
53 1.1 christos # include "uv/posix.h" /* IBM i needs uv/posix.h, not uv/aix.h */
54 1.1 christos #elif defined(_AIX)
55 1.1 christos # include "uv/aix.h"
56 1.1 christos #elif defined(__sun)
57 1.1 christos # include "uv/sunos.h"
58 1.1 christos #elif defined(__APPLE__)
59 1.1 christos # include "uv/darwin.h"
60 1.1 christos #elif defined(__DragonFly__) || \
61 1.1 christos defined(__FreeBSD__) || \
62 1.1 christos defined(__FreeBSD_kernel__) || \
63 1.1 christos defined(__OpenBSD__) || \
64 1.1 christos defined(__NetBSD__)
65 1.1 christos # include "uv/bsd.h"
66 1.1 christos #elif defined(__CYGWIN__) || \
67 1.1 christos defined(__MSYS__) || \
68 1.1 christos defined(__GNU__)
69 1.1 christos # include "uv/posix.h"
70 1.1 christos #elif defined(__HAIKU__)
71 1.1 christos # include "uv/posix.h"
72 1.1 christos #endif
73 1.1 christos
74 1.1 christos #ifndef NI_MAXHOST
75 1.1 christos # define NI_MAXHOST 1025
76 1.1 christos #endif
77 1.1 christos
78 1.1 christos #ifndef NI_MAXSERV
79 1.1 christos # define NI_MAXSERV 32
80 1.1 christos #endif
81 1.1 christos
82 1.1 christos #ifndef UV_IO_PRIVATE_PLATFORM_FIELDS
83 1.1 christos # define UV_IO_PRIVATE_PLATFORM_FIELDS /* empty */
84 1.1 christos #endif
85 1.1 christos
86 1.1 christos struct uv__io_s;
87 1.1 christos struct uv_loop_s;
88 1.1 christos
89 1.1 christos typedef void (*uv__io_cb)(struct uv_loop_s* loop,
90 1.1 christos struct uv__io_s* w,
91 1.1 christos unsigned int events);
92 1.1 christos typedef struct uv__io_s uv__io_t;
93 1.1 christos
94 1.1 christos struct uv__io_s {
95 1.1 christos uv__io_cb cb;
96 1.1 christos void* pending_queue[2];
97 1.1 christos void* watcher_queue[2];
98 1.1 christos unsigned int pevents; /* Pending event mask i.e. mask at next tick. */
99 1.1 christos unsigned int events; /* Current event mask. */
100 1.1 christos int fd;
101 1.1 christos UV_IO_PRIVATE_PLATFORM_FIELDS
102 1.1 christos };
103 1.1 christos
104 1.1 christos #ifndef UV_PLATFORM_SEM_T
105 1.1 christos # define UV_PLATFORM_SEM_T sem_t
106 1.1 christos #endif
107 1.1 christos
108 1.1 christos #ifndef UV_PLATFORM_LOOP_FIELDS
109 1.1 christos # define UV_PLATFORM_LOOP_FIELDS /* empty */
110 1.1 christos #endif
111 1.1 christos
112 1.1 christos #ifndef UV_PLATFORM_FS_EVENT_FIELDS
113 1.1 christos # define UV_PLATFORM_FS_EVENT_FIELDS /* empty */
114 1.1 christos #endif
115 1.1 christos
116 1.1 christos #ifndef UV_STREAM_PRIVATE_PLATFORM_FIELDS
117 1.1 christos # define UV_STREAM_PRIVATE_PLATFORM_FIELDS /* empty */
118 1.1 christos #endif
119 1.1 christos
120 1.1 christos /* Note: May be cast to struct iovec. See writev(2). */
121 1.1 christos typedef struct uv_buf_t {
122 1.1 christos char* base;
123 1.1 christos size_t len;
124 1.1 christos } uv_buf_t;
125 1.1 christos
126 1.1 christos typedef int uv_file;
127 1.1 christos typedef int uv_os_sock_t;
128 1.1 christos typedef int uv_os_fd_t;
129 1.1 christos typedef pid_t uv_pid_t;
130 1.1 christos
131 1.1 christos #define UV_ONCE_INIT PTHREAD_ONCE_INIT
132 1.1 christos
133 1.1 christos typedef pthread_once_t uv_once_t;
134 1.1 christos typedef pthread_t uv_thread_t;
135 1.1 christos typedef pthread_mutex_t uv_mutex_t;
136 1.1 christos typedef pthread_rwlock_t uv_rwlock_t;
137 1.1 christos typedef UV_PLATFORM_SEM_T uv_sem_t;
138 1.1 christos typedef pthread_cond_t uv_cond_t;
139 1.1 christos typedef pthread_key_t uv_key_t;
140 1.1 christos
141 1.1 christos /* Note: guard clauses should match uv_barrier_init's in src/unix/thread.c. */
142 1.1 christos #if defined(_AIX) || \
143 1.1 christos defined(__OpenBSD__) || \
144 1.1 christos !defined(PTHREAD_BARRIER_SERIAL_THREAD)
145 1.1 christos /* TODO(bnoordhuis) Merge into uv_barrier_t in v2. */
146 1.1 christos struct _uv_barrier {
147 1.1 christos uv_mutex_t mutex;
148 1.1 christos uv_cond_t cond;
149 1.1 christos unsigned threshold;
150 1.1 christos unsigned in;
151 1.1 christos unsigned out;
152 1.1 christos };
153 1.1 christos
154 1.1 christos typedef struct {
155 1.1 christos struct _uv_barrier* b;
156 1.1 christos # if defined(PTHREAD_BARRIER_SERIAL_THREAD)
157 1.1 christos /* TODO(bnoordhuis) Remove padding in v2. */
158 1.1 christos char pad[sizeof(pthread_barrier_t) - sizeof(struct _uv_barrier*)];
159 1.1 christos # endif
160 1.1 christos } uv_barrier_t;
161 1.1 christos #else
162 1.1 christos typedef pthread_barrier_t uv_barrier_t;
163 1.1 christos #endif
164 1.1 christos
165 1.1 christos /* Platform-specific definitions for uv_spawn support. */
166 1.1 christos typedef gid_t uv_gid_t;
167 1.1 christos typedef uid_t uv_uid_t;
168 1.1 christos
169 1.1 christos typedef struct dirent uv__dirent_t;
170 1.1 christos
171 1.1 christos #define UV_DIR_PRIVATE_FIELDS \
172 1.1 christos DIR* dir;
173 1.1 christos
174 1.1 christos #if defined(DT_UNKNOWN)
175 1.1 christos # define HAVE_DIRENT_TYPES
176 1.1 christos # if defined(DT_REG)
177 1.1 christos # define UV__DT_FILE DT_REG
178 1.1 christos # else
179 1.1 christos # define UV__DT_FILE -1
180 1.1 christos # endif
181 1.1 christos # if defined(DT_DIR)
182 1.1 christos # define UV__DT_DIR DT_DIR
183 1.1 christos # else
184 1.1 christos # define UV__DT_DIR -2
185 1.1 christos # endif
186 1.1 christos # if defined(DT_LNK)
187 1.1 christos # define UV__DT_LINK DT_LNK
188 1.1 christos # else
189 1.1 christos # define UV__DT_LINK -3
190 1.1 christos # endif
191 1.1 christos # if defined(DT_FIFO)
192 1.1 christos # define UV__DT_FIFO DT_FIFO
193 1.1 christos # else
194 1.1 christos # define UV__DT_FIFO -4
195 1.1 christos # endif
196 1.1 christos # if defined(DT_SOCK)
197 1.1 christos # define UV__DT_SOCKET DT_SOCK
198 1.1 christos # else
199 1.1 christos # define UV__DT_SOCKET -5
200 1.1 christos # endif
201 1.1 christos # if defined(DT_CHR)
202 1.1 christos # define UV__DT_CHAR DT_CHR
203 1.1 christos # else
204 1.1 christos # define UV__DT_CHAR -6
205 1.1 christos # endif
206 1.1 christos # if defined(DT_BLK)
207 1.1 christos # define UV__DT_BLOCK DT_BLK
208 1.1 christos # else
209 1.1 christos # define UV__DT_BLOCK -7
210 1.1 christos # endif
211 1.1 christos #endif
212 1.1 christos
213 1.1 christos /* Platform-specific definitions for uv_dlopen support. */
214 1.1 christos #define UV_DYNAMIC /* empty */
215 1.1 christos
216 1.1 christos typedef struct {
217 1.1 christos void* handle;
218 1.1 christos char* errmsg;
219 1.1 christos } uv_lib_t;
220 1.1 christos
221 1.1 christos #define UV_LOOP_PRIVATE_FIELDS \
222 1.1 christos unsigned long flags; \
223 1.1 christos int backend_fd; \
224 1.1 christos void* pending_queue[2]; \
225 1.1 christos void* watcher_queue[2]; \
226 1.1 christos uv__io_t** watchers; \
227 1.1 christos unsigned int nwatchers; \
228 1.1 christos unsigned int nfds; \
229 1.1 christos void* wq[2]; \
230 1.1 christos uv_mutex_t wq_mutex; \
231 1.1 christos uv_async_t wq_async; \
232 1.1 christos uv_rwlock_t cloexec_lock; \
233 1.1 christos uv_handle_t* closing_handles; \
234 1.1 christos void* process_handles[2]; \
235 1.1 christos void* prepare_handles[2]; \
236 1.1 christos void* check_handles[2]; \
237 1.1 christos void* idle_handles[2]; \
238 1.1 christos void* async_handles[2]; \
239 1.1 christos void (*async_unused)(void); /* TODO(bnoordhuis) Remove in libuv v2. */ \
240 1.1 christos uv__io_t async_io_watcher; \
241 1.1 christos int async_wfd; \
242 1.1 christos struct { \
243 1.1 christos void* min; \
244 1.1 christos unsigned int nelts; \
245 1.1 christos } timer_heap; \
246 1.1 christos uint64_t timer_counter; \
247 1.1 christos uint64_t time; \
248 1.1 christos int signal_pipefd[2]; \
249 1.1 christos uv__io_t signal_io_watcher; \
250 1.1 christos uv_signal_t child_watcher; \
251 1.1 christos int emfile_fd; \
252 1.1 christos UV_PLATFORM_LOOP_FIELDS \
253 1.1 christos
254 1.1 christos #define UV_REQ_TYPE_PRIVATE /* empty */
255 1.1 christos
256 1.1 christos #define UV_REQ_PRIVATE_FIELDS /* empty */
257 1.1 christos
258 1.1 christos #define UV_PRIVATE_REQ_TYPES /* empty */
259 1.1 christos
260 1.1 christos #define UV_WRITE_PRIVATE_FIELDS \
261 1.1 christos void* queue[2]; \
262 1.1 christos unsigned int write_index; \
263 1.1 christos uv_buf_t* bufs; \
264 1.1 christos unsigned int nbufs; \
265 1.1 christos int error; \
266 1.1 christos uv_buf_t bufsml[4]; \
267 1.1 christos
268 1.1 christos #define UV_CONNECT_PRIVATE_FIELDS \
269 1.1 christos void* queue[2]; \
270 1.1 christos
271 1.1 christos #define UV_SHUTDOWN_PRIVATE_FIELDS /* empty */
272 1.1 christos
273 1.1 christos #define UV_UDP_SEND_PRIVATE_FIELDS \
274 1.1 christos void* queue[2]; \
275 1.1 christos struct sockaddr_storage addr; \
276 1.1 christos unsigned int nbufs; \
277 1.1 christos uv_buf_t* bufs; \
278 1.1 christos ssize_t status; \
279 1.1 christos uv_udp_send_cb send_cb; \
280 1.1 christos uv_buf_t bufsml[4]; \
281 1.1 christos
282 1.1 christos #define UV_HANDLE_PRIVATE_FIELDS \
283 1.1 christos uv_handle_t* next_closing; \
284 1.1 christos unsigned int flags; \
285 1.1 christos
286 1.1 christos #define UV_STREAM_PRIVATE_FIELDS \
287 1.1 christos uv_connect_t *connect_req; \
288 1.1 christos uv_shutdown_t *shutdown_req; \
289 1.1 christos uv__io_t io_watcher; \
290 1.1 christos void* write_queue[2]; \
291 1.1 christos void* write_completed_queue[2]; \
292 1.1 christos uv_connection_cb connection_cb; \
293 1.1 christos int delayed_error; \
294 1.1 christos int accepted_fd; \
295 1.1 christos void* queued_fds; \
296 1.1 christos UV_STREAM_PRIVATE_PLATFORM_FIELDS \
297 1.1 christos
298 1.1 christos #define UV_TCP_PRIVATE_FIELDS /* empty */
299 1.1 christos
300 1.1 christos #define UV_UDP_PRIVATE_FIELDS \
301 1.1 christos uv_alloc_cb alloc_cb; \
302 1.1 christos uv_udp_recv_cb recv_cb; \
303 1.1 christos uv__io_t io_watcher; \
304 1.1 christos void* write_queue[2]; \
305 1.1 christos void* write_completed_queue[2]; \
306 1.1 christos
307 1.1 christos #define UV_PIPE_PRIVATE_FIELDS \
308 1.1 christos const char* pipe_fname; /* strdup'ed */
309 1.1 christos
310 1.1 christos #define UV_POLL_PRIVATE_FIELDS \
311 1.1 christos uv__io_t io_watcher;
312 1.1 christos
313 1.1 christos #define UV_PREPARE_PRIVATE_FIELDS \
314 1.1 christos uv_prepare_cb prepare_cb; \
315 1.1 christos void* queue[2]; \
316 1.1 christos
317 1.1 christos #define UV_CHECK_PRIVATE_FIELDS \
318 1.1 christos uv_check_cb check_cb; \
319 1.1 christos void* queue[2]; \
320 1.1 christos
321 1.1 christos #define UV_IDLE_PRIVATE_FIELDS \
322 1.1 christos uv_idle_cb idle_cb; \
323 1.1 christos void* queue[2]; \
324 1.1 christos
325 1.1 christos #define UV_ASYNC_PRIVATE_FIELDS \
326 1.1 christos uv_async_cb async_cb; \
327 1.1 christos void* queue[2]; \
328 1.1 christos int pending; \
329 1.1 christos
330 1.1 christos #define UV_TIMER_PRIVATE_FIELDS \
331 1.1 christos uv_timer_cb timer_cb; \
332 1.1 christos void* heap_node[3]; \
333 1.1 christos uint64_t timeout; \
334 1.1 christos uint64_t repeat; \
335 1.1 christos uint64_t start_id;
336 1.1 christos
337 1.1 christos #define UV_GETADDRINFO_PRIVATE_FIELDS \
338 1.1 christos struct uv__work work_req; \
339 1.1 christos uv_getaddrinfo_cb cb; \
340 1.1 christos struct addrinfo* hints; \
341 1.1 christos char* hostname; \
342 1.1 christos char* service; \
343 1.1 christos struct addrinfo* addrinfo; \
344 1.1 christos int retcode;
345 1.1 christos
346 1.1 christos #define UV_GETNAMEINFO_PRIVATE_FIELDS \
347 1.1 christos struct uv__work work_req; \
348 1.1 christos uv_getnameinfo_cb getnameinfo_cb; \
349 1.1 christos struct sockaddr_storage storage; \
350 1.1 christos int flags; \
351 1.1 christos char host[NI_MAXHOST]; \
352 1.1 christos char service[NI_MAXSERV]; \
353 1.1 christos int retcode;
354 1.1 christos
355 1.1 christos #define UV_PROCESS_PRIVATE_FIELDS \
356 1.1 christos void* queue[2]; \
357 1.1 christos int status; \
358 1.1 christos
359 1.1 christos #define UV_FS_PRIVATE_FIELDS \
360 1.1 christos const char *new_path; \
361 1.1 christos uv_file file; \
362 1.1 christos int flags; \
363 1.1 christos mode_t mode; \
364 1.1 christos unsigned int nbufs; \
365 1.1 christos uv_buf_t* bufs; \
366 1.1 christos off_t off; \
367 1.1 christos uv_uid_t uid; \
368 1.1 christos uv_gid_t gid; \
369 1.1 christos double atime; \
370 1.1 christos double mtime; \
371 1.1 christos struct uv__work work_req; \
372 1.1 christos uv_buf_t bufsml[4]; \
373 1.1 christos
374 1.1 christos #define UV_WORK_PRIVATE_FIELDS \
375 1.1 christos struct uv__work work_req;
376 1.1 christos
377 1.1 christos #define UV_TTY_PRIVATE_FIELDS \
378 1.1 christos struct termios orig_termios; \
379 1.1 christos int mode;
380 1.1 christos
381 1.1 christos #define UV_SIGNAL_PRIVATE_FIELDS \
382 1.1 christos /* RB_ENTRY(uv_signal_s) tree_entry; */ \
383 1.1 christos struct { \
384 1.1 christos struct uv_signal_s* rbe_left; \
385 1.1 christos struct uv_signal_s* rbe_right; \
386 1.1 christos struct uv_signal_s* rbe_parent; \
387 1.1 christos int rbe_color; \
388 1.1 christos } tree_entry; \
389 1.1 christos /* Use two counters here so we don have to fiddle with atomics. */ \
390 1.1 christos unsigned int caught_signals; \
391 1.1 christos unsigned int dispatched_signals;
392 1.1 christos
393 1.1 christos #define UV_FS_EVENT_PRIVATE_FIELDS \
394 1.1 christos uv_fs_event_cb cb; \
395 1.1 christos UV_PLATFORM_FS_EVENT_FIELDS \
396 1.1 christos
397 1.1 christos /* fs open() flags supported on this platform: */
398 1.1 christos #if defined(O_APPEND)
399 1.1 christos # define UV_FS_O_APPEND O_APPEND
400 1.1 christos #else
401 1.1 christos # define UV_FS_O_APPEND 0
402 1.1 christos #endif
403 1.1 christos #if defined(O_CREAT)
404 1.1 christos # define UV_FS_O_CREAT O_CREAT
405 1.1 christos #else
406 1.1 christos # define UV_FS_O_CREAT 0
407 1.1 christos #endif
408 1.1 christos
409 1.1 christos #if defined(__linux__) && defined(__arm__)
410 1.1 christos # define UV_FS_O_DIRECT 0x10000
411 1.1 christos #elif defined(__linux__) && defined(__m68k__)
412 1.1 christos # define UV_FS_O_DIRECT 0x10000
413 1.1 christos #elif defined(__linux__) && defined(__mips__)
414 1.1 christos # define UV_FS_O_DIRECT 0x08000
415 1.1 christos #elif defined(__linux__) && defined(__powerpc__)
416 1.1 christos # define UV_FS_O_DIRECT 0x20000
417 1.1 christos #elif defined(__linux__) && defined(__s390x__)
418 1.1 christos # define UV_FS_O_DIRECT 0x04000
419 1.1 christos #elif defined(__linux__) && defined(__x86_64__)
420 1.1 christos # define UV_FS_O_DIRECT 0x04000
421 1.1 christos #elif defined(O_DIRECT)
422 1.1 christos # define UV_FS_O_DIRECT O_DIRECT
423 1.1 christos #else
424 1.1 christos # define UV_FS_O_DIRECT 0
425 1.1 christos #endif
426 1.1 christos
427 1.1 christos #if defined(O_DIRECTORY)
428 1.1 christos # define UV_FS_O_DIRECTORY O_DIRECTORY
429 1.1 christos #else
430 1.1 christos # define UV_FS_O_DIRECTORY 0
431 1.1 christos #endif
432 1.1 christos #if defined(O_DSYNC)
433 1.1 christos # define UV_FS_O_DSYNC O_DSYNC
434 1.1 christos #else
435 1.1 christos # define UV_FS_O_DSYNC 0
436 1.1 christos #endif
437 1.1 christos #if defined(O_EXCL)
438 1.1 christos # define UV_FS_O_EXCL O_EXCL
439 1.1 christos #else
440 1.1 christos # define UV_FS_O_EXCL 0
441 1.1 christos #endif
442 1.1 christos #if defined(O_EXLOCK)
443 1.1 christos # define UV_FS_O_EXLOCK O_EXLOCK
444 1.1 christos #else
445 1.1 christos # define UV_FS_O_EXLOCK 0
446 1.1 christos #endif
447 1.1 christos #if defined(O_NOATIME)
448 1.1 christos # define UV_FS_O_NOATIME O_NOATIME
449 1.1 christos #else
450 1.1 christos # define UV_FS_O_NOATIME 0
451 1.1 christos #endif
452 1.1 christos #if defined(O_NOCTTY)
453 1.1 christos # define UV_FS_O_NOCTTY O_NOCTTY
454 1.1 christos #else
455 1.1 christos # define UV_FS_O_NOCTTY 0
456 1.1 christos #endif
457 1.1 christos #if defined(O_NOFOLLOW)
458 1.1 christos # define UV_FS_O_NOFOLLOW O_NOFOLLOW
459 1.1 christos #else
460 1.1 christos # define UV_FS_O_NOFOLLOW 0
461 1.1 christos #endif
462 1.1 christos #if defined(O_NONBLOCK)
463 1.1 christos # define UV_FS_O_NONBLOCK O_NONBLOCK
464 1.1 christos #else
465 1.1 christos # define UV_FS_O_NONBLOCK 0
466 1.1 christos #endif
467 1.1 christos #if defined(O_RDONLY)
468 1.1 christos # define UV_FS_O_RDONLY O_RDONLY
469 1.1 christos #else
470 1.1 christos # define UV_FS_O_RDONLY 0
471 1.1 christos #endif
472 1.1 christos #if defined(O_RDWR)
473 1.1 christos # define UV_FS_O_RDWR O_RDWR
474 1.1 christos #else
475 1.1 christos # define UV_FS_O_RDWR 0
476 1.1 christos #endif
477 1.1 christos #if defined(O_SYMLINK)
478 1.1 christos # define UV_FS_O_SYMLINK O_SYMLINK
479 1.1 christos #else
480 1.1 christos # define UV_FS_O_SYMLINK 0
481 1.1 christos #endif
482 1.1 christos #if defined(O_SYNC)
483 1.1 christos # define UV_FS_O_SYNC O_SYNC
484 1.1 christos #else
485 1.1 christos # define UV_FS_O_SYNC 0
486 1.1 christos #endif
487 1.1 christos #if defined(O_TRUNC)
488 1.1 christos # define UV_FS_O_TRUNC O_TRUNC
489 1.1 christos #else
490 1.1 christos # define UV_FS_O_TRUNC 0
491 1.1 christos #endif
492 1.1 christos #if defined(O_WRONLY)
493 1.1 christos # define UV_FS_O_WRONLY O_WRONLY
494 1.1 christos #else
495 1.1 christos # define UV_FS_O_WRONLY 0
496 1.1 christos #endif
497 1.1 christos
498 1.1 christos /* fs open() flags supported on other platforms: */
499 1.1 christos #define UV_FS_O_FILEMAP 0
500 1.1 christos #define UV_FS_O_RANDOM 0
501 1.1 christos #define UV_FS_O_SHORT_LIVED 0
502 1.1 christos #define UV_FS_O_SEQUENTIAL 0
503 1.1 christos #define UV_FS_O_TEMPORARY 0
504 1.1 christos
505 1.1 christos #endif /* UV_UNIX_H */
506