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

Fix error result of clock_time_get #6812

Merged
merged 1 commit into from
Aug 7, 2023

Conversation

vigoo
Copy link
Contributor

@vigoo vigoo commented Aug 7, 2023

This PR changes the behavior of the clock_time_get function implemented in the preview2 adapter in case of being called with an unsupported clock id.

Previously it ran onto unreachable, with this change it fails with ERRNO_BADF.

The motivation is to get the same behavior as the preview1 WASI implementation. (

types::Clockid::ProcessCputimeId | types::Clockid::ThreadCputimeId => {
return Err(types::Errno::Badf.into())
)

(I ran into this difference when tried to run a ruby.wasm module converted into a component using the preview2 adapter. Seems like Ruby queries all 4 clocks during startup but handles the BADF response properly.)

@vigoo vigoo requested a review from a team as a code owner August 7, 2023 13:51
@vigoo vigoo requested review from pchickey and removed request for a team August 7, 2023 13:51
@vigoo vigoo force-pushed the fix-clock-time-get branch from 19b2b7b to b709c64 Compare August 7, 2023 13:59
Copy link
Member

@sunfishcode sunfishcode left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@sunfishcode sunfishcode enabled auto-merge August 7, 2023 14:11
@sunfishcode sunfishcode added this pull request to the merge queue Aug 7, 2023
Merged via the queue into bytecodealliance:main with commit c4eafed Aug 7, 2023
@vigoo vigoo deleted the fix-clock-time-get branch August 7, 2023 16:42
eduardomourar pushed a commit to eduardomourar/wasmtime that referenced this pull request Aug 18, 2023
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.

2 participants