Merge remote-tracking branch 'origin/main' into pch/wasi_common_cap_std

This commit is contained in:
Pat Hickey
2021-01-07 16:37:06 -08:00
58 changed files with 309 additions and 260 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "wasi-common"
version = "0.21.0"
version = "0.22.0"
authors = ["The Wasmtime Project Developers"]
description = "WASI implementation in Rust"
license = "Apache-2.0 WITH LLVM-exception"
@@ -24,14 +24,14 @@ getrandom = { version = "0.2.0", features = ["std"] }
cfg-if = "1.0"
filetime = "0.2.7"
lazy_static = "1.4.0"
wiggle = { path = "../wiggle", default-features = false, version = "0.21.0" }
wiggle = { path = "../wiggle", default-features = false, version = "0.22.0" }
tracing = "0.1.19"
[target.'cfg(unix)'.dependencies]
yanix = { path = "yanix", version = "0.21.0" }
yanix = { path = "yanix", version = "0.22.0" }
[target.'cfg(windows)'.dependencies]
winx = { path = "winx", version = "0.21.0" }
winx = { path = "winx", version = "0.22.0" }
winapi = "0.3"
cpu-time = "1.0"

View File

@@ -9,7 +9,7 @@ use crate::sys::stdio::{Stderr, Stdin, Stdout};
use crate::sys::AsFile;
use crate::{Error, Result};
use lazy_static::lazy_static;
use std::convert::TryInto;
use std::convert::{TryFrom, TryInto};
use std::sync::mpsc::{self, Receiver, RecvTimeoutError, Sender, TryRecvError};
use std::sync::Mutex;
use std::thread;
@@ -81,7 +81,9 @@ impl StdinPoll {
// Linux returns `POLLIN` in both cases, and we imitate this behavior.
let resp = match std::io::stdin().lock().fill_buf() {
Ok(_) => PollState::Ready,
Err(e) => PollState::Error(Errno::from(Error::from(e))),
Err(e) => {
PollState::Error(Errno::try_from(Error::from(e)).expect("non-trapping error"))
}
};
// Notify the requestor about data in stdin. They may have already timed out,
@@ -158,7 +160,9 @@ fn handle_rw_event(event: FdEventData, out_events: &mut Vec<Event>) {
.as_file()
.and_then(|f| f.metadata())
.map(|m| m.len())
.map_err(|ioerror| Errno::from(Error::from(ioerror)))
.map_err(|ioerror| {
Errno::try_from(Error::from(ioerror)).expect("non-trapping error")
})
} else {
// The spec is unclear what nbytes should actually be for __WASI_EVENTTYPE_FD_WRITE and
// the implementation on Unix just returns 0 here, so it's probably fine

View File

@@ -1,6 +1,6 @@
[package]
name = "winx"
version = "0.21.0"
version = "0.22.0"
authors = ["Jakub Konka <kubkon@jakubkonka.com>"]
description = "Windows API helper library"
documentation = "https://docs.rs/winx"

View File

@@ -1,6 +1,6 @@
[package]
name = "yanix"
version = "0.21.0"
version = "0.22.0"
authors = ["The Wasmtime Project Developers"]
description = "Yet Another Nix crate: a Unix API helper library"
documentation = "https://docs.rs/yanix"