master
1#ifndef __wasilibc___header_fcntl_h
2#define __wasilibc___header_fcntl_h
3
4#include <wasi/api.h>
5#include <__seek.h>
6#include <__mode_t.h>
7
8#define O_APPEND __WASI_FDFLAGS_APPEND
9#define O_DSYNC __WASI_FDFLAGS_DSYNC
10#define O_NONBLOCK __WASI_FDFLAGS_NONBLOCK
11#define O_RSYNC __WASI_FDFLAGS_RSYNC
12#define O_SYNC __WASI_FDFLAGS_SYNC
13#define O_CREAT (__WASI_OFLAGS_CREAT << 12)
14#define O_DIRECTORY (__WASI_OFLAGS_DIRECTORY << 12)
15#define O_EXCL (__WASI_OFLAGS_EXCL << 12)
16#define O_TRUNC (__WASI_OFLAGS_TRUNC << 12)
17
18#define O_NOFOLLOW (0x01000000)
19#define O_EXEC (0x02000000)
20#define O_RDONLY (0x04000000)
21#define O_SEARCH (0x08000000)
22#define O_WRONLY (0x10000000)
23
24/*
25 * O_CLOEXEC is defined to be zero, as WASI has no exec-style functions.
26 */
27#define O_CLOEXEC (0)
28
29/*
30 * O_TTY_INIT is defined to be zero, meaning that WASI implementations are
31 * expected to always initialize a terminal the first time it's opened.
32 */
33#define O_TTY_INIT (0)
34
35#define O_NOCTTY (0)
36
37#define O_RDWR (O_RDONLY | O_WRONLY)
38#define O_ACCMODE (O_EXEC | O_RDWR | O_SEARCH)
39
40#define POSIX_FADV_DONTNEED __WASI_ADVICE_DONTNEED
41#define POSIX_FADV_NOREUSE __WASI_ADVICE_NOREUSE
42#define POSIX_FADV_NORMAL __WASI_ADVICE_NORMAL
43#define POSIX_FADV_RANDOM __WASI_ADVICE_RANDOM
44#define POSIX_FADV_SEQUENTIAL __WASI_ADVICE_SEQUENTIAL
45#define POSIX_FADV_WILLNEED __WASI_ADVICE_WILLNEED
46
47#define F_GETFD (1)
48#define F_SETFD (2)
49#define F_GETFL (3)
50#define F_SETFL (4)
51
52#define FD_CLOEXEC (1)
53
54#define AT_EACCESS (0x0)
55#define AT_SYMLINK_NOFOLLOW (0x1)
56#define AT_SYMLINK_FOLLOW (0x2)
57#define AT_REMOVEDIR (0x4)
58
59#define AT_FDCWD (-2)
60
61#endif