fix: take FFI_ArrowArrayStream errno values from libc#10299
Open
fornwall wants to merge 1 commit into
Open
Conversation
The errno constants in ffi_stream.rs were hardcoded to a single set of values, but ENOSYS is 78 only on macOS/iOS and the BSDs — on Linux it is 38, on Windows 40, on Solaris/illumos 89. On WASI even the other codes differ (EINVAL is 28, EIO 29, ENOMEM 48), since WASI numbers its errnos independently. A stream exported on Linux therefore reported ArrowError::NotYetImplemented as 78, which Linux errno tables read as an unrelated code, confusing C consumers that interpret the returned errno. Take the constants from libc instead, as an optional dependency of the ffi feature. It is target-gated off wasm32-unknown-unknown — the one target without a libc — where no OS interprets the codes anyway, so hardcoded Linux values remain. Signed-off-by: Fredrik Fornwall <fredrik@fornwall.net>
7e086a2 to
a183c3d
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.
Disclaimer: The PR description and the code change was generated by claude code. I have reviewed it and think it makes sense, and is ready to dig into any eventual issues or make necessary modifications.
The
errnoconstants inffi_stream.rswere hardcoded to a single set of values, butENOSYSis78only on macOS/iOS and the BSDs — on Linux it is38, on Windows40, on Solaris/illumos89. On WASI even the other codes differ (EINVALis28,EIO29,ENOMEM48), since WASI numbers its errnos independently. A stream exported on Linux therefore reportedArrowError::NotYetImplementedas78, which Linux errno tables read as an unrelated code, confusing C consumers that interpret the returned errno.Take the constants from libc instead, as an optional dependency of the ffi feature. It is target-gated off
wasm32-unknown-unknown— the one target without a libc — where no OS interprets the codes anyway, so hardcoded Linux values remain.