Jefffrey commented on code in PR #10299:
URL: https://github.com/apache/arrow-rs/pull/10299#discussion_r3578419073


##########
arrow-array/src/ffi_stream.rs:
##########
@@ -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;

Review Comment:
   was `ENOSYS` supposed to be changing here even though this hardcoded value 
is gated to wasm only?



##########
arrow-array/Cargo.toml:
##########
@@ -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]

Review Comment:
   do we need to check both wasm + unknown, or is just checking against wasm32 
sufficient (see above `ahash` on how it gates)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to