-
Notifications
You must be signed in to change notification settings - Fork 738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add wasm32-wasip2
support
#1836
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -104,7 +104,7 @@ impl<T> DerefMut for IoSource<T> { | |||||
} | ||||||
} | ||||||
|
||||||
#[cfg(any(unix, target_os = "hermit"))] | ||||||
#[cfg(any(unix, target_os = "hermit", all(target_os = "wasi", target_env = "p2")))] | ||||||
impl<T> event::Source for IoSource<T> | ||||||
where | ||||||
T: AsRawFd, | ||||||
|
@@ -175,7 +175,7 @@ where | |||||
} | ||||||
} | ||||||
|
||||||
#[cfg(target_os = "wasi")] | ||||||
#[cfg(all(target_os = "wasi", not(target_env = "p2")))] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we do this?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason I did it that way is because |
||||||
impl<T> event::Source for IoSource<T> | ||||||
where | ||||||
T: AsRawFd, | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ use std::os::windows::io::{ | |
}; | ||
|
||
use crate::io_source::IoSource; | ||
#[cfg(not(target_os = "wasi"))] | ||
#[cfg(any(not(target_os = "wasi"), target_env = "p2"))] | ||
use crate::sys::tcp::{connect, new_for_addr}; | ||
use crate::{event, Interest, Registry, Token}; | ||
|
||
|
@@ -87,10 +87,10 @@ impl TcpStream { | |
/// entries in the routing cache. | ||
/// | ||
/// [write interest]: Interest::WRITABLE | ||
#[cfg(not(target_os = "wasi"))] | ||
#[cfg(any(not(target_os = "wasi"), target_env = "p2"))] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you mean |
||
pub fn connect(addr: SocketAddr) -> io::Result<TcpStream> { | ||
let socket = new_for_addr(addr)?; | ||
#[cfg(any(unix, target_os = "hermit"))] | ||
#[cfg(any(unix, target_os = "hermit", all(target_os = "wasi", target_env = "p2")))] | ||
let stream = unsafe { TcpStream::from_raw_fd(socket) }; | ||
#[cfg(windows)] | ||
let stream = unsafe { TcpStream::from_raw_socket(socket as _) }; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really the correct way to go about this? Only 0.11 supports p1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at https://docs.rs/wasi/latest/wasi/
I would say yes, the last mention I see of
p1
is on0.11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct; see https://docs.rs/wasi/latest/wasi/#wasi-today-and-wasi_snapshot_preview1