Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditionally support SYNC flags #2581

Merged
merged 1 commit into from
Oct 4, 2023

Conversation

zoraaver
Copy link
Contributor

@zoraaver zoraaver commented Sep 21, 2023

To make it clearer to users when synchronization behaviour is not supported, return ENOTSUP when O_RSYNC, O_DSYNC or O_SYNC are respectively not defined. Linux also doesn't support O_RSYNC despite the O_RSYNC flag being defined.

@yamt
Copy link
Collaborator

yamt commented Sep 21, 2023

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.

it sounds like a bug in tests to me.
preview1 has these flags defined.

@lum1n0us
Copy link
Collaborator

It also bothers me. They are defined but not used in wasi-libc till ec4566beae84e54952637f0bf61bee4b4cacc087.

@yamt
Copy link
Collaborator

yamt commented Sep 22, 2023

It also bothers me. They are defined but not used in wasi-libc till ec4566beae84e54952637f0bf61bee4b4cacc087.

what do you mean by "not used in wasi-libc"?
doesn't open() pass-through them to wasi?

@yamt
Copy link
Collaborator

yamt commented Sep 22, 2023

@zoraaver
Copy link
Contributor Author

it sounds like a bug in tests to me.

I don't think it's that clear-cut. I'm not suggesting that this change is definitive or the correct approach but for the time being I would say it's better to explicitly not support these flags rather than offering half-baked support depending on the underlying OS. e.g. Linux doesn't actually support O_RSYNC.

The purpose of this change is mainly so we can start running the rust tests in CI, not to spark a discussion on the use of these flags.

If you want to merge WebAssembly/wasi-testsuite#91, that also works but it made more sense to me personally to remove support for these flags in WAMR.

@wenyongh do you have any further thoughts? This is a breaking change so would require mentioning in the release notes if I'm not mistaken.

@wenyongh
Copy link
Contributor

If you want to merge WebAssembly/wasi-testsuite#91, that also works but it made more sense to me personally to remove support for these flags in WAMR.

@wenyongh do you have any further thoughts? This is a breaking change so would require mentioning in the release notes if I'm not mistaken.

How about making these flags optional, just let the developer choose whether to support it or not? By default they are unsupported, and we add a macro to control the code and mention the change in the release notes?

@zoraaver
Copy link
Contributor Author

Thanks, that sounds like a good idea. I'll amend this PR to add a build flag to control whether these flags are supported or not so developers can opt in if they require it for their use cases.

@zoraaver zoraaver changed the title Don't support fd sync flags Don't support fd sync flags by default Sep 26, 2023
@zoraaver zoraaver force-pushed the not-support-sync-flags branch 3 times, most recently from 3458133 to 1325536 Compare September 26, 2023 15:46
@yamt
Copy link
Collaborator

yamt commented Sep 27, 2023

do you mean something like CONFIG_HAS_ macros in ssp_config.h?

@yamt
Copy link
Collaborator

yamt commented Sep 27, 2023

do you mean something like CONFIG_HAS_ macros in ssp_config.h?

i didn't notice you have already updated the patch when asking this.
anyway, to me, it seems more appropriate to use CONFIG_HAS_ style macros than user-facing config knobs.

build-scripts/config_common.cmake Outdated Show resolved Hide resolved
core/iwasm/libraries/libc-wasi/libc_wasi.cmake Outdated Show resolved Hide resolved
core/iwasm/libraries/libc-wasi/libc_wasi.cmake Outdated Show resolved Hide resolved
@zoraaver zoraaver force-pushed the not-support-sync-flags branch 2 times, most recently from a80d071 to a153119 Compare September 27, 2023 09:39
@zoraaver zoraaver changed the title Don't support fd sync flags by default Conditionally support SYNC flags Oct 3, 2023
To make it clearer to users when synchronization behaviour is not
supported, return ENOTSUP when O_RSYNC, O_DSYNC or O_SYNC are
respectively not defined. Linux also doesn't support O_RSYNC despite the
O_RSYNC flag being defined.
Copy link
Contributor

@wenyongh wenyongh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@loganek
Copy link
Collaborator

loganek commented Oct 4, 2023

Looks good, thanks

@wenyongh wenyongh merged commit 8987432 into bytecodealliance:main Oct 4, 2023
368 checks passed
@zoraaver zoraaver deleted the not-support-sync-flags branch October 4, 2023 13:32
victoryang00 pushed a commit to victoryang00/wamr-aot-gc-checkpoint-restore that referenced this pull request May 27, 2024
To make it clearer to users when synchronization behaviour is not
supported, return ENOTSUP when O_RSYNC, O_DSYNC or O_SYNC are
respectively not defined. Linux also doesn't support O_RSYNC despite the
O_RSYNC flag being defined.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants