Skip to content

Conversation

@wingo
Copy link
Contributor

@wingo wingo commented Dec 8, 2025

On macos and ios, fadvise is only implemented for WillNeed and dispatches via the system-interface crate to the F_RDADVISE fcntl. If you call WillNeed on an out-of-bounds offset, this fcntl returns FileTooLarge. Here we paper over this harmless error code to avoid this needless platform-dependent nonuniformity. Should fix wasmtime for WebAssembly/wasi-testsuite#178.

@wingo wingo requested a review from a team as a code owner December 8, 2025 11:53
@github-actions github-actions bot added the wasi Issues pertaining to WASI label Dec 8, 2025
@wingo wingo force-pushed the macos-fadvise-willneed-oob branch from db95e26 to 6a351af Compare December 9, 2025 15:52
On macos and ios, fadvise is only implemented for WillNeed and
dispatches via the system-interface crate to the F_RDADVISE fcntl.  If
you call WillNeed on an out-of-bounds offset, this fcntl returns
FileTooLarge.  Here we paper over this harmless error code to avoid this
needless platform-dependent nonuniformity.  Should fix wasmtime for
WebAssembly/wasi-testsuite#178.

prtest:full
@wingo wingo force-pushed the macos-fadvise-willneed-oob branch from 6a351af to 1da615b Compare December 9, 2025 15:58
return Ok(());
}

Err(code)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I find this patch to be pretty gross, for a few reasons:

  • advice doesn't implement copy, so it gets moved into the closure; have to check it beforehand, making it less amenable to #[cfg]
  • the whole system error vs errorcode thing; can't match on FileTooLarge directly, only on err.into()
  • ErrorCode doesn't implement PartialEq, so no ==

Any style tips are very welcome.

@wingo wingo requested a review from a team as a code owner December 15, 2025 15:49
@wingo wingo requested review from fitzgen and removed request for a team December 15, 2025 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasi Issues pertaining to WASI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants