peterhuene edited PR #557 from implement-windows-fdstat-flags
to master
:
This PR fully implements
__wasi_fd_fdstat_get
on Windows so that
the descriptor flags can be determined.It does this by calling into
NtQueryInformationFile
(safe to call from
user mode) to get the open mode and access of the underlying OS handle.
NtQueryInformationFile
isn't included in thewinapi
crate, so it is
manually being linked against.This PR also fixes several bugs on Windows:
Ignore
__WASI_FDFLAG_NONBLOCK
by not settingFILE_FLAG_OVERLAPPED
on file handles (the POSIX behavior forO_NONBLOCK
on files).Use
FILE_FLAG_WRITE_THROUGH
for the__WASI_FDFLAG_?SYNC
flags.
__WASI_FDFLAG_APPEND
should disallowFILE_WRITE_DATA
access to
force append-only on write operations.Use
GENERIC_READ
andGENERIC_WRITE
access flags. The
latter is required when opening a file for truncation.
Last updated: Nov 22 2024 at 16:03 UTC