authorgravatar for takeshi@tetrate.ioTakeshi Yoneda <takeshi@tetrate.io> 2021-08-13 21:54:18+09:00
committergravatar for takeshi@tetrate.ioTakeshi Yoneda <takeshi@tetrate.io> 2021-08-13 21:54:18+09:00
log68617c9fb05ad7e92315edb0dec7c5fad56b6265
tree6aecb01b6b5ed3a7673bba4e58136b66b3b5ceb6
parentca4898c0f3590832d7a2ef84e8f4906e89d7f34e

Add comment about compiletime check.

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

1 files changed, 5 insertions(+), 1 deletions(-)

lib/std/fs.zig+5-1
......@@ -937,6 +937,8 @@ pub const Dir = struct {
937937 try os.openatZ(self.fd, sub_path, os_flags, 0);
938938 errdefer os.close(fd);
939939
940 // WASI doesn't have os.flock so we intetinally check OS prior to the inner if block
941 // since it is not compiltime-known and we need to avoid undefined symbol in Wasm.
940942 if (builtin.target.os.tag != .wasi) {
941943 if (!has_flock_open_flags and flags.lock != .None) {
942944 // TODO: integrate async I/O
......@@ -1089,8 +1091,10 @@ pub const Dir = struct {
10891091 try os.openatZ(self.fd, sub_path_c, os_flags, flags.mode);
10901092 errdefer os.close(fd);
10911093
1094 // WASI doesn't have os.flock so we intetinally check OS prior to the inner if block
1095 // since it is not compiltime-known and we need to avoid undefined symbol in Wasm.
10921096 if (builtin.target.os.tag != .wasi) {
1093 if (!has_flock_open_flags and flags.lock != .None and builtin.target.os.tag != .wasi) {
1097 if (!has_flock_open_flags and flags.lock != .None) {
10941098 // TODO: integrate async I/O
10951099 const lock_nonblocking = if (flags.lock_nonblocking) os.LOCK_NB else @as(i32, 0);
10961100 try os.flock(fd, switch (flags.lock) {