Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion arrow-array/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ ahash = { version = "0.8", default-features = false, features = ["compile-time-r
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
ahash = { version = "0.8", default-features = false, features = ["runtime-rng"] }

# Used by the ffi feature for platform-correct errno values. Excluded on
# wasm32-unknown-unknown, which has no libc.
[target.'cfg(not(all(target_family = "wasm", target_os = "unknown")))'.dependencies]
libc = { version = "0.2", default-features = false, optional = true }

[dependencies]
arrow-buffer = { workspace = true }
arrow-schema = { workspace = true }
Expand All @@ -63,7 +68,7 @@ all-features = true

[features]
async = ["dep:futures"]
ffi = ["arrow-schema/ffi", "arrow-data/ffi"]
ffi = ["arrow-schema/ffi", "arrow-data/ffi", "dep:libc"]
force_validate = []
# Enable memory tracking support
pool = ["arrow-buffer/pool", "arrow-data/pool"]
Expand Down
13 changes: 12 additions & 1 deletion arrow-array/src/ffi_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,21 @@ use crate::record_batch::{RecordBatch, RecordBatchReader};

type Result<T> = std::result::Result<T, ArrowError>;

// Errno values returned through the C stream interface, taken from libc so they match
// the platform the consumer interprets them against.
#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
use libc::{EINVAL, EIO, ENOMEM, ENOSYS};

// wasm32-unknown-unknown has no libc, and no OS to interpret the codes either — any
// non-zero value works there, so use Linux's.
#[cfg(all(target_family = "wasm", target_os = "unknown"))]
const ENOMEM: i32 = 12;
#[cfg(all(target_family = "wasm", target_os = "unknown"))]
const EIO: i32 = 5;
#[cfg(all(target_family = "wasm", target_os = "unknown"))]
const EINVAL: i32 = 22;
const ENOSYS: i32 = 78;
#[cfg(all(target_family = "wasm", target_os = "unknown"))]
const ENOSYS: i32 = 38;

/// ABI-compatible struct for `ArrayStream` from C Stream Interface
/// See <https://arrow.apache.org/docs/format/CStreamInterface.html#structure-definitions>
Expand Down
Loading