-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use wiggle in place of wig in wasi-common
This is a rather massive commit that introduces `wiggle` into the picture. We still use `wig`'s macro in `old` snapshot and to generate `wasmtime-wasi` glue, but everything else is now autogenerated by `wiggle`. In summary, thanks to `wiggle`, we no longer need to worry about serialising and deserialising to and from the guest memory, and all guest (WASI) types are now proper idiomatic Rust types. While we're here, in preparation for the ephemeral snapshot, I went ahead and reorganised the internal structure of the crate. Instead of modules like `hostcalls_impl` or `hostcalls_impl::fs`, the structure now resembles that in ephemeral with modules like `path`, `fd`, etc. Now, I'm not requiring we leave it like this, but I reckon it looks cleaner this way after all.
- Loading branch information
Showing
61 changed files
with
4,343 additions
and
4,975 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use crate::sys; | ||
use crate::wasi::types::{Subclockflags, SubscriptionClock}; | ||
use crate::wasi::{Errno, Result}; | ||
use std::time::SystemTime; | ||
|
||
pub(crate) use sys::clock::*; | ||
|
||
pub(crate) fn to_relative_ns_delay(clock: SubscriptionClock) -> Result<u128> { | ||
if clock.flags != Subclockflags::SUBSCRIPTION_CLOCK_ABSTIME { | ||
return Ok(u128::from(clock.timeout)); | ||
} | ||
let now: u128 = SystemTime::now() | ||
.duration_since(SystemTime::UNIX_EPOCH) | ||
.map_err(|_| Errno::Notcapable)? | ||
.as_nanos(); | ||
let deadline = u128::from(clock.timeout); | ||
Ok(deadline.saturating_sub(now)) | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.