Skip to content
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 HermitOS support to branch v0.8.x #1775

Closed
wants to merge 8 commits into from

Conversation

stlankes
Copy link
Contributor

Backport of #1759

HermitOS is a library operating system. The handling of the socket streams is compatible to unix. However, other parts are not compatible to Unix. Consequently, HermitOS doesn't belong to the unix family.

To support MIO, MIO's unix is revised to support HermitOS. Currently, the implementation based on the unix system poll.

HermitOS is a library operating system. It it is partly compatible
to Unix. Consequently, the system interface to unix is revised
to support HermitOS.
@stlankes stlankes changed the title add support HermitOS to branch v0.8.x add HermitOS support to branch v0.8.x Apr 23, 2024
also the master branch disable these warnings
@stlankes
Copy link
Contributor Author

Hm, I think that the my changes aren't the reason for the clippy warnings

@Thomasdezeeuw
Copy link
Collaborator

Hm, I think that the my changes aren't the reason for the clippy warnings

You can ignore the Clippy warnings.

@@ -48,6 +48,9 @@ log = { version = "0.4.8", optional = true }
[target.'cfg(unix)'.dependencies]
libc = "0.2.149"

[target.'cfg(target_os = "hermit")'.dependencies]
libc = { package = "hermit-abi", version = "0.3.9" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, we're using hermit-abi as libc? That's rather misleading.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realised I accept it on master, that was a mistake.

Copy link
Contributor Author

@stlankes stlankes Apr 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can rename it to hermit_abi. Should we also rename src/sys/unix to src/sys/hermit because the prefix libc is often used in this directory. But the code is more or less identical. Also in other parts of the prefix is often used and code is identical.

Copy link
Contributor Author

@stlankes stlankes Apr 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I have an idea to solve it. I will revise it.

@@ -81,6 +84,7 @@ targets = [
"x86_64-unknown-linux-gnu",
"x86_64-unknown-netbsd",
"x86_64-unknown-openbsd",
"x86_64-unknown-hermit",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add this to the CI and the Makefile as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will do it.

@@ -48,6 +48,9 @@ log = { version = "0.4.8", optional = true }
[target.'cfg(unix)'.dependencies]
libc = "0.2.149"

[target.'cfg(target_os = "hermit")'.dependencies]
libc = { package = "hermit-abi", version = "0.3.9" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realised I accept it on master, that was a mistake.

src/sys/unix/mod.rs Show resolved Hide resolved
src/sys/unix/waker.rs Outdated Show resolved Hide resolved
src/sys/unix/waker.rs Outdated Show resolved Hide resolved
stlankes and others added 2 commits April 25, 2024 08:12
Co-authored-by: Thomas de Zeeuw <[email protected]>
Co-authored-by: Thomas de Zeeuw <[email protected]>
@Thomasdezeeuw
Copy link
Collaborator

I made some changes to the cfg of Hermit in #1789, this should be reflected when backporting to v0.8.

Co-authored-by: Thomas de Zeeuw <[email protected]>
@stlankes
Copy link
Contributor Author

Looks good for me. By the way, we try to move parts of ABI to libc (see rust-lang/libc#3724). At least the stabilized interfaced should be moved to libc.

@stlankes
Copy link
Contributor Author

stlankes commented Jul 8, 2024

I have to revert a8a5c5b We don't return always -1. It could be also other negative values.

I wait also for rust-lang/libc#3766 to be part of libc 0.2.

@Thomasdezeeuw
Copy link
Collaborator

I have to revert a8a5c5b We don't return always -1. It could be also other negative values.

Should we also fix that in v1:

mio/src/sys/unix/mod.rs

Lines 5 to 15 in 1ce1545

macro_rules! syscall {
($fn: ident ( $($arg: expr),* $(,)* ) ) => {{
#[allow(unused_unsafe)]
let res = unsafe { libc::$fn($($arg, )*) };
if res < 0 {
Err(std::io::Error::last_os_error())
} else {
Ok(res)
}
}};
}
?

I wait also for rust-lang/libc#3766 to be part of libc 0.2.

👍 also like to make this change in v1.

Is the main aim of this to support Tokio? Because if so, it might make more sense to merge tokio-rs/tokio#6635 instead.

@stlankes
Copy link
Contributor Author

stlankes commented Jul 8, 2024

Should we also fix that in v1:

The code in v1 is correct and similar to the current version in 0.8.

Is the main aim of this to support Tokio? Because if so, it might make more sense to merge tokio-rs/tokio#6635 instead.

Yes! What is the current state of tokio-rs/tokio#6635 ?

@Darksonn
Copy link
Contributor

Darksonn commented Jul 9, 2024

The summary I gave in tokio-rs/tokio#6635 (comment) is still accurate. I am on vacation right now.

@Thomasdezeeuw
Copy link
Collaborator

I am on vacation right now.

Then you should not be reading emails/GitHub, but enjoying your vacation instead ;)

@stlankes
Copy link
Contributor Author

I think, we can close this PR. mio 1.0 is already used by tokio

@stlankes stlankes closed this Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants