Skip to content

Commit

Permalink
Don't support fd sync flags
Browse files Browse the repository at this point in the history
It's not yet clear whether these flags should be added to the standard
so disallow use of them for the time being. See
WebAssembly/wasi-filesystem#98 for more
details. These changes are also necessary to ensure the rust WASI tests
pass since they assert that path_open returns ENOTSUP when passing
O_DSYNC/O_RSYNC/O_SYNC.
  • Loading branch information
zoraaver committed Sep 21, 2023
1 parent 967765b commit 5517a24
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1800,16 +1800,16 @@ wasmtime_ssp_path_open(
needed_base |= __WASI_RIGHT_PATH_FILESTAT_SET_SIZE;
}

// Convert file descriptor flags.
if ((fs_flags & __WASI_FDFLAG_DSYNC) != 0) {
needed_inheriting |= __WASI_RIGHT_FD_DATASYNC;
}
if ((fs_flags & __WASI_FDFLAG_RSYNC) != 0) {
needed_inheriting |= __WASI_RIGHT_FD_SYNC;
}
if ((fs_flags & __WASI_FDFLAG_SYNC) != 0) {
needed_inheriting |= __WASI_RIGHT_FD_SYNC;
// It's not clear whether we want to support these flags in the standard
// yet: https://github.com/WebAssembly/wasi-filesystem/issues/98 so disable
// them in the meanwhile.
if (((fs_flags & __WASI_FDFLAG_DSYNC) != 0)
|| ((fs_flags & __WASI_FDFLAG_RSYNC) != 0)
|| ((fs_flags & __WASI_FDFLAG_SYNC) != 0)) {
return __WASI_ENOTSUP;
}

// Convert file descriptor flags.
if (write
&& !((fs_flags & __WASI_FDFLAG_APPEND) || (__WASI_O_TRUNC & oflags)))
needed_inheriting |= __WASI_RIGHT_FD_SEEK;
Expand Down

0 comments on commit 5517a24

Please sign in to comment.