Skip to content

Commit 8274bc4

Browse files
authored
[WasmFS] Ignore rather than asserting on O_NONBLOCK (#19084)
O_NONBLOCK serves two purposes when passed to open. First, it prevents `open` from blocking for a "long time" to open the file. Second, it opens the file in nonblocking I/O mode which allows reads and writes to return error codes if I/O cannot be done without blocking. Ignoring O_NONBLOCK completely is a semantically valid implementation strategy, so for now just stop asserting when it is used.
1 parent 03b00b7 commit 8274bc4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

system/lib/wasmfs/syscalls.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,9 @@ static __wasi_fd_t doOpen(path::ParsedParent parsed,
418418
}
419419

420420
// TODO: remove assert when all functionality is complete.
421-
assert((flags &
422-
~(O_CREAT | O_EXCL | O_DIRECTORY | O_TRUNC | O_APPEND | O_RDWR |
423-
O_WRONLY | O_RDONLY | O_LARGEFILE | O_NOFOLLOW | O_CLOEXEC)) == 0);
421+
assert((flags & ~(O_CREAT | O_EXCL | O_DIRECTORY | O_TRUNC | O_APPEND |
422+
O_RDWR | O_WRONLY | O_RDONLY | O_LARGEFILE | O_NOFOLLOW |
423+
O_CLOEXEC | O_NONBLOCK)) == 0);
424424

425425
if (auto err = parsed.getError()) {
426426
return err;

0 commit comments

Comments
 (0)