[wasi-common]: add armv7 support to wasi-common (#1269)
* Add armv7 support to wasi-common This commit enables `target_pointer_width = 32` compatibility for `wasi-common` (and by transitivity, any crate found inside, e.g., `yanix`). I've also added a simplistic (bare minimum) check to our CI to ensure that `wasi-common` cross-compiles to `armv7-unknown-gnueabihf` fine. While here, I've done the same for `wasm32-unknown-emscripten`. * Clean arch-specific impls + reuse libc consts * Make SeekLoc::from_raw platform independent * Collapse CI cc jobs into one
This commit is contained in:
@@ -2,7 +2,8 @@ use crate::{
|
||||
file::FileType,
|
||||
sys::dir::{iter_impl, EntryImpl},
|
||||
};
|
||||
use std::io::Result;
|
||||
use std::convert::TryInto;
|
||||
use std::io::{Error, Result};
|
||||
use std::os::unix::io::{AsRawFd, IntoRawFd, RawFd};
|
||||
use std::{ffi::CStr, io, ops::Deref, ptr};
|
||||
|
||||
@@ -98,6 +99,18 @@ impl SeekLoc {
|
||||
pub fn to_raw(&self) -> i64 {
|
||||
self.0.into()
|
||||
}
|
||||
|
||||
pub unsafe fn from_raw(loc: i64) -> Result<Self> {
|
||||
// The cookie (or `loc`) is an opaque value, and applications aren't supposed to do
|
||||
// arithmetic on them or pick their own values or have any awareness of the numeric
|
||||
// range of the values. They're just supposed to pass back in the values that we
|
||||
// give them. And any value we give them will be convertable back to `long`,
|
||||
// because that's the type the OS gives them to us in. So return an `EINVAL`.
|
||||
let loc = loc
|
||||
.try_into()
|
||||
.map_err(|_| Error::from_raw_os_error(libc::EINVAL))?;
|
||||
Ok(Self(loc))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
||||
Reference in New Issue
Block a user