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...@@ -78,7 +78,6 @@ pub extern "c" fn fread(noalias ptr: [*]u8, size_of_type: usize, item_count: usi
7878
79pub extern "c" fn printf(format: [*:0]const u8, ...) c_int;79pub extern "c" fn printf(format: [*:0]const u8, ...) c_int;
80pub extern "c" fn abort() noreturn;80pub extern "c" fn abort() noreturn;
81
82pub extern "c" fn exit(code: c_int) noreturn;81pub extern "c" fn exit(code: c_int) noreturn;
83pub extern "c" fn _exit(code: c_int) noreturn;82pub extern "c" fn _exit(code: c_int) noreturn;
84pub extern "c" fn isatty(fd: fd_t) c_int;83pub 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;...@@ -277,22 +277,23 @@ pub const lookupflags_t = u32;
277pub const LOOKUP_SYMLINK_FOLLOW: lookupflags_t = 0x00000001;277pub const LOOKUP_SYMLINK_FOLLOW: lookupflags_t = 0x00000001;
278278
279pub usingnamespace if (builtin.link_libc) struct {279pub usingnamespace if (builtin.link_libc) struct {
280 // Derived from https://github.com/WebAssembly/wasi-libc/blob/main/expected/wasm32-wasi/predefined-macros.txt
280 pub const O_ACCMODE = (O_EXEC | O_RDWR | O_SEARCH);281 pub const O_ACCMODE = (O_EXEC | O_RDWR | O_SEARCH);
281 pub const O_APPEND = 1 << 0; // = __WASI_FDFLAGS_APPEND282 pub const O_APPEND = FDFLAG_APPEND;
282 pub const O_CLOEXEC = (0);283 pub const O_CLOEXEC = (0);
283 pub const O_CREAT = ((1 << 0) << 12); // = __WASI_OFLAGS_CREAT << 12284 pub const O_CREAT = ((1 << 0) << 12); // = __WASI_OFLAGS_CREAT << 12
284 pub const O_DIRECTORY = ((1 << 1) << 12); // = __WASI_OFLAGS_DIRECTORY << 12285 pub const O_DIRECTORY = ((1 << 1) << 12); // = __WASI_OFLAGS_DIRECTORY << 12
285 pub const O_DSYNC = (1 << 1); // = __WASI_FDFLAGS_DSYNC286 pub const O_DSYNC = FDFLAG_DSYNC;
286 pub const O_EXCL = ((1 << 2) << 12); // = __WASI_OFLAGS_EXCL << 12287 pub const O_EXCL = ((1 << 2) << 12); // = __WASI_OFLAGS_EXCL << 12
287 pub const O_EXEC = (0x02000000);288 pub const O_EXEC = (0x02000000);
288 pub const O_NOCTTY = (0);289 pub const O_NOCTTY = (0);
289 pub const O_NOFOLLOW = (0x01000000);290 pub const O_NOFOLLOW = (0x01000000);
290 pub const O_NONBLOCK = (1 << 2); // = __WASI_FDFLAGS_NONBLOCK291 pub const O_NONBLOCK = (1 << FDFLAG_NONBLOCK);
291 pub const O_RDONLY = (0x04000000);292 pub const O_RDONLY = (0x04000000);
292 pub const O_RDWR = (O_RDONLY | O_WRONLY);293 pub const O_RDWR = (O_RDONLY | O_WRONLY);
293 pub const O_RSYNC = (1 << 3); // = __WASI_FDFLAGS_RSYNC294 pub const O_RSYNC = (1 << FDFLAG_RSYNC);
294 pub const O_SEARCH = (0x08000000);295 pub const O_SEARCH = (0x08000000);
295 pub const O_SYNC = (1 << 4); // = __WASI_FDFLAGS_SYNC296 pub const O_SYNC = (1 << FDFLAG_SYNC);
296 pub const O_TRUNC = ((1 << 3) << 12); // = __WASI_OFLAGS_TRUNC << 12297 pub const O_TRUNC = ((1 << 3) << 12); // = __WASI_OFLAGS_TRUNC << 12
297 pub const O_TTY_INIT = (0);298 pub const O_TTY_INIT = (0);
298 pub const O_WRONLY = (0x10000000);299 pub const O_WRONLY = (0x10000000);
...@@ -476,9 +477,9 @@ pub const S_IFREG = 0x8000;...@@ -476,9 +477,9 @@ pub const S_IFREG = 0x8000;
476// There's no concept of UNIX domain socket but we define this value here in order to line with other OSes.477// There's no concept of UNIX domain socket but we define this value here in order to line with other OSes.
477pub const S_IFSOCK = 0x1;478pub const S_IFSOCK = 0x1;
478479
479pub const SEEK_SET = 0x0; // = __WASI_WHENCE_SET480pub const SEEK_SET = WHENCE_SET;
480pub const SEEK_CUR = 0x1; // = __WASI_WHENCE_CUR481pub const SEEK_CUR = WHENCE_CUR;
481pub const SEEK_END = 0x2; // = __WASI_WHENCE_END482pub const SEEK_END = WHENCE_END;
482483
483pub const LOCK_SH = 0x1;484pub const LOCK_SH = 0x1;
484pub const LOCK_EX = 0x2;485pub const LOCK_EX = 0x2;