Uh oh!
There was an error while loading. Please reload this page.
Implement __wasi_fd_fdstat_get for Windows. - #557
Conversation
Primarily the Apparently |
peterhuene
commented
Nov 13, 2019
I'm also working on The idea will be to utilize these changes along with ReOpenFile to reopen the file from the existing descriptor, but with the new access / flags while preserving the current file pointer. |
kubkon
left a comment
There was a problem hiding this comment.
LGTM! Amazing work, thanks so much! :-)
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
kubkon
commented
Nov 13, 2019
Go Windows... |
kubkon
commented
Nov 13, 2019
Oh, and while we're here, if you could rebase to the latest |
peterhuene
commented
Nov 13, 2019
Will do! |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
8d38e2e to
3bc87c5Comparepeterhuene
commented
Nov 15, 2019
I'm expecting CI to fail on Windows until there's clarification on how we expect the |
b39a182 to
62c08b9Compare62c08b9 to
d2be013Comparepeterhuene
commented
Nov 26, 2019
This is ready for a review as it should now pass CI.
|
d2be013 to
0a98681CompareThis commit 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 the `winapi` crate, so it is manually being linked against. This commit also fixes several bugs on Windows: * Ignore `__WASI_FDFLAG_NONBLOCK` by not setting `FILE_FLAG_OVERLAPPED` on file handles (the POSIX behavior for `O_NONBLOCK` on files). * Use `FILE_FLAG_WRITE_THROUGH` for the `__WASI_FDFLAG_?SYNC` flags. * `__WASI_FDFLAG_APPEND` should disallow `FILE_WRITE_DATA` access to force append-only on write operations. * Use `GENERIC_READ` and `GENERIC_WRITE` access flags. The latter is required when opening a file for truncation.
0a98681 to
45f71e5Compare
kubkon
left a comment
There was a problem hiding this comment.
LGTM! I'm gonna go ahead and merge this in so that we can progress with other work, leaving the problem of truncation rights for a subsequent PR. Please feel free to file an issue if you find anything amiss though!
marmistrz
commented
Nov 27, 2019
I think it was a very good decision to just leave |
This PR fully implements
__wasi_fd_fdstat_geton Windows so thatthe descriptor flags can be determined.
It does this by calling into
NtQueryInformationFile(safe to call fromuser mode) to get the open mode and access of the underlying OS handle.
NtQueryInformationFileisn't included in thewinapicrate, so it ismanually being linked against.
This PR also fixes several bugs on Windows:
__WASI_FDFLAG_NONBLOCKby not settingFILE_FLAG_OVERLAPPEDon file handles (the POSIX behavior for
O_NONBLOCKon files).FILE_FLAG_WRITE_THROUGHfor the__WASI_FDFLAG_?SYNCflags.__WASI_FDFLAG_APPENDshould disallowFILE_WRITE_DATAaccess toforce append-only on write operations.
GENERIC_READandGENERIC_WRITEaccess flags. Thelatter is required when opening a file for truncation.