authorgravatar for takeshi@tetrate.ioTakeshi Yoneda <takeshi@tetrate.io> 2021-08-09 14:36:11+09:00
committergravatar for takeshi@tetrate.ioTakeshi Yoneda <takeshi@tetrate.io> 2021-08-09 14:36:11+09:00
log7814a2bd4a3ec22cd9548c622f7dc837dba968f7
tree4dd6ec33c19246f46f5a9b779d602dc7f4db2e3e
parent1e20a62126e66d0306a6db01b3a2ffd6b946b9b6

review: use defined flag for oflags.

Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>

2 files changed, 9 insertions(+), 9 deletions(-)

lib/std/c.zig-1
......@@ -78,7 +78,6 @@ pub extern "c" fn fread(noalias ptr: [*]u8, size_of_type: usize, item_count: usi
7878
7979pub extern "c" fn printf(format: [*:0]const u8, ...) c_int;
8080pub extern "c" fn abort() noreturn;
81
8281pub extern "c" fn exit(code: c_int) noreturn;
8382pub extern "c" fn _exit(code: c_int) noreturn;
8483pub extern "c" fn isatty(fd: fd_t) c_int;
lib/std/os/bits/wasi.zig+9-8
......@@ -277,22 +277,23 @@ pub const lookupflags_t = u32;
277277pub const LOOKUP_SYMLINK_FOLLOW: lookupflags_t = 0x00000001;
278278
279279pub usingnamespace if (builtin.link_libc) struct {
280 // Derived from https://github.com/WebAssembly/wasi-libc/blob/main/expected/wasm32-wasi/predefined-macros.txt
280281 pub const O_ACCMODE = (O_EXEC | O_RDWR | O_SEARCH);
281 pub const O_APPEND = 1 << 0; // = __WASI_FDFLAGS_APPEND
282 pub const O_APPEND = FDFLAG_APPEND;
282283 pub const O_CLOEXEC = (0);
283284 pub const O_CREAT = ((1 << 0) << 12); // = __WASI_OFLAGS_CREAT << 12
284285 pub const O_DIRECTORY = ((1 << 1) << 12); // = __WASI_OFLAGS_DIRECTORY << 12
285 pub const O_DSYNC = (1 << 1); // = __WASI_FDFLAGS_DSYNC
286 pub const O_DSYNC = FDFLAG_DSYNC;
286287 pub const O_EXCL = ((1 << 2) << 12); // = __WASI_OFLAGS_EXCL << 12
287288 pub const O_EXEC = (0x02000000);
288289 pub const O_NOCTTY = (0);
289290 pub const O_NOFOLLOW = (0x01000000);
290 pub const O_NONBLOCK = (1 << 2); // = __WASI_FDFLAGS_NONBLOCK
291 pub const O_NONBLOCK = (1 << FDFLAG_NONBLOCK);
291292 pub const O_RDONLY = (0x04000000);
292293 pub const O_RDWR = (O_RDONLY | O_WRONLY);
293 pub const O_RSYNC = (1 << 3); // = __WASI_FDFLAGS_RSYNC
294 pub const O_RSYNC = (1 << FDFLAG_RSYNC);
294295 pub const O_SEARCH = (0x08000000);
295 pub const O_SYNC = (1 << 4); // = __WASI_FDFLAGS_SYNC
296 pub const O_SYNC = (1 << FDFLAG_SYNC);
296297 pub const O_TRUNC = ((1 << 3) << 12); // = __WASI_OFLAGS_TRUNC << 12
297298 pub const O_TTY_INIT = (0);
298299 pub const O_WRONLY = (0x10000000);
......@@ -476,9 +477,9 @@ pub const S_IFREG = 0x8000;
476477// There's no concept of UNIX domain socket but we define this value here in order to line with other OSes.
477478pub const S_IFSOCK = 0x1;
478479
479pub const SEEK_SET = 0x0; // = __WASI_WHENCE_SET
480pub const SEEK_CUR = 0x1; // = __WASI_WHENCE_CUR
481pub const SEEK_END = 0x2; // = __WASI_WHENCE_END
480pub const SEEK_SET = WHENCE_SET;
481pub const SEEK_CUR = WHENCE_CUR;
482pub const SEEK_END = WHENCE_END;
482483
483484pub const LOCK_SH = 0x1;
484485pub const LOCK_EX = 0x2;