Implement fd_fdstat_set_flags for Windows.#711
Merged
sunfishcode merged 3 commits intobytecodealliance:masterfrom Jan 10, 2020
Merged
Implement fd_fdstat_set_flags for Windows.#711sunfishcode merged 3 commits intobytecodealliance:masterfrom
sunfishcode merged 3 commits intobytecodealliance:masterfrom
Conversation
Member
Author
|
@marmistrz for review too please :) |
75e8130 to
9fdc356
Compare
marmistrz
suggested changes
Dec 15, 2019
96592d3 to
5614c43
Compare
added 3 commits
January 9, 2020 14:52
This commit implements `fd_fdstat_set_flags` for Windows. Additionally, it fixes a problem where `O_APPEND` was not working correctly because `GENERIC_WRITE` was always being set; as a result, `FILE_WRITE_DATA` could not be removed from the permission set to properly enable append-only mode. It also treats `O_TRUNC` with `O_APPEND` as an invalid argument error. This is because Windows cannot support these two flags together. To support `O_TRUNC`, the `GENERIC_WRITE` bit must be set for the file access flags. Setting this bit will cause `FILE_WRITE_DATA` to be set, which will not properly treat the file as append-only (it requires `FILE_APPEND_DATA` without `FILE_WRITE_DATA`).
* Add more comments. * Use `contains` from bitflags. * Format wasi-test source. * Remove permission check from Windows `path_open` impl.
5614c43 to
995c32c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements
fd_fdstat_set_flagsfor Windows.Additionally, it fixes a problem where
O_APPENDwas not working correctlybecause
GENERIC_WRITEwas always being set; as a result,FILE_WRITE_DATAcould not be removed from the permission set to properly enable append-only
mode.
It also treats
O_TRUNCwithO_APPENDas an invalid argument error. This isbecause Windows cannot support these two flags together. To support
O_TRUNC,the
GENERIC_WRITEbit must be set for the file access flags. Setting thisbit will cause
FILE_WRITE_DATAto be set, which will not properly treat thefile as append-only (it requires
FILE_APPEND_DATAwithoutFILE_WRITE_DATA).