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 Solaris operating system support (using flag mio_unsupported_forc… #1715

Closed
wants to merge 0 commits into from

Conversation

psumbera
Copy link
Contributor

@psumbera psumbera commented Sep 1, 2023

…e_poll_poll)

@Thomasdezeeuw
Copy link
Collaborator

Since solaris doesn't support any selector other than poll you don't need the mio_unsupported_force_poll_poll cfg.

But are problems listed in #1152 and #1328 (and #1528, #1542) resolved?

@notgull
Copy link

notgull commented Sep 1, 2023

Solaris and Illumos support a mechanism called event ports, which can be used to implement event listening in a more efficient way than poll().

@Thomasdezeeuw
Copy link
Collaborator

Solaris and Illumos support a mechanism called event ports, which can be used to implement event listening in a more efficient way than poll().

Illumos already uses epoll, so this will be Solaris specific.

@psumbera
Copy link
Contributor Author

psumbera commented Sep 4, 2023

Since solaris doesn't support any selector other than poll you don't need the mio_unsupported_force_poll_poll cfg.

How is that possible? So far I had to use RUSTFLAGS="--cfg mio_unsupported_force_poll_poll".

But are problems listed in #1152 and #1328 (and #1528, #1542) resolved?

#1152 could be considered as resolved once this is merged in. Originally I was thinking about implementing it via Solaris event ports but it's not possible right now since we couln't check it using continous integration.

#1328 my commit uses SOCK_CLOEXEC and SOCK_NONBLOCK as it's for Illumos. Solaris 10 will never support Rust. It's very old and now with mininal support. It was released in 2004.

Not sure about others. I can modifiy README file and remove Solaris line. But mio_unsupported_force_poll_poll is mentined there as not really supported thing.

@Thomasdezeeuw
Copy link
Collaborator

Since solaris doesn't support any selector other than poll you don't need the mio_unsupported_force_poll_poll cfg.

How is that possible? So far I had to use RUSTFLAGS="--cfg mio_unsupported_force_poll_poll".

By adding the correct cfg attributes for Solaris.

But are problems listed in #1152 and #1328 (and #1528, #1542) resolved?

#1152 could be considered as resolved once this is merged in. Originally I was thinking about implementing it via Solaris event ports but it's not possible right now since we couln't check it using continous integration.

👍

#1328 my commit uses SOCK_CLOEXEC and SOCK_NONBLOCK as it's for Illumos. Solaris 10 will never support Rust. It's very old and now with mininal support. It was released in 2004.

I'm not familiar with Solaris, but do newer version have support for SOCK_CLOEXEC and SOCK_NONBLOCK?

Not sure about others. I can modifiy README file and remove Solaris line.

Let's leave it for now, I want to make sure it actually works this time.

But mio_unsupported_force_poll_poll is mentined there as not really supported thing.

They key word in mio_unsupported_force_poll_poll is force, it overwrites the preferred polling method on the platform to use a poll(2) based implementation instead. This is mainly used for testing and thus the flag itself unsupported. However the poll(2) implementation is fully supported on platforms that don't have anything "better", for example ESP-IDF. We can add Solaris to this list, even though it has event ports.

@psumbera
Copy link
Contributor Author

psumbera commented Sep 4, 2023

Since solaris doesn't support any selector other than poll you don't need the mio_unsupported_force_poll_poll cfg.

How is that possible? So far I had to use RUSTFLAGS="--cfg mio_unsupported_force_poll_poll".

By adding the correct cfg attributes for Solaris.

Sorry! I think I'm lost. What and where should I put anything? Thanks!

But are problems listed in #1152 and #1328 (and #1528, #1542) resolved?

#1328 my commit uses SOCK_CLOEXEC and SOCK_NONBLOCK as it's for Illumos. Solaris 10 will never support Rust. It's very old and now with mininal support. It was released in 2004.

I'm not familiar with Solaris, but do newer version have support for SOCK_CLOEXEC and SOCK_NONBLOCK?

Yes, all versions of Solaris 11.4 (first release in 2018) do support them.

But mio_unsupported_force_poll_poll is mentined there as not really supported thing.

@Thomasdezeeuw
Copy link
Collaborator

By adding the correct cfg attributes for Solaris.

Sorry! I think I'm lost. What and where should I put anything? Thanks!

Try compiling without RUSTFLAGS="--cfg mio_unsupported_force_poll_poll" and rustc will tell you ;)

I'm not familiar with Solaris, but do newer version have support for SOCK_CLOEXEC and SOCK_NONBLOCK?

Yes, all versions of Solaris 11.4 (first release in 2018) do support them.

👍

@psumbera
Copy link
Contributor Author

psumbera commented Sep 4, 2023

By adding the correct cfg attributes for Solaris.

Sorry! I think I'm lost. What and where should I put anything? Thanks!

Try compiling without RUSTFLAGS="--cfg mio_unsupported_force_poll_poll" and rustc will tell you ;)

No it doesn't help:

$ RUSTFLAGS="--cfg mio_unsupported_force_poll_poll" cargo build
   Compiling libc v0.2.147
   Compiling log v0.4.20
   Compiling mio v0.8.8 (/builds/psumbera/mio-solaris)
    Finished dev [unoptimized + debuginfo] target(s) in 6.07s

@Thomasdezeeuw
Copy link
Collaborator

No it doesn't help:

$ RUSTFLAGS="--cfg mio_unsupported_force_poll_poll" cargo build
   Compiling libc v0.2.147
   Compiling log v0.4.20
   Compiling mio v0.8.8 (/builds/psumbera/mio-solaris)
    Finished dev [unoptimized + debuginfo] target(s) in 6.07s

Try enabling all features --all-features. And as I said don't use RUSTFLAGS="--cfg mio_unsupported_force_poll_poll". So just run cargo check --all-features on Solaris and it should fail.

@psumbera
Copy link
Contributor Author

psumbera commented Sep 4, 2023

Try enabling all features --all-features. And as I said don't use RUSTFLAGS="--cfg mio_unsupported_force_poll_poll". So just run cargo check --all-features on Solaris and it should fail. But still have no issue how to define

Sorry about with[out] RUSTFLAGS. It fails like this now. But still have no clue how to define mio_unsupported_force_poll_poll cfg attribute (ideally in Config.toml or src/macros.rs).

cargo check --all-features
    Checking mio v0.8.8 (/builds/psumbera/mio-solaris)
error[E0432]: unresolved imports `self::selector::event`, `self::selector::Event`, `self::selector::Events`, `self::selector::Selector`
  --> src/sys/unix/mod.rs:18:37
   |
18 |     pub(crate) use self::selector::{event, Event, Events, Selector};
   |                                     ^^^^^  ^^^^^  ^^^^^^  ^^^^^^^^ no `Selector` in `sys::unix::selector`
   |                                     |      |      |
   |                                     |      |      no `Events` in `sys::unix::selector`
   |                                     |      no `Event` in `sys::unix::selector`
   |                                     no `event` in `sys::unix::selector`
   |
   = help: consider importing this module instead:
           crate::event
   = help: consider importing this struct instead:
           crate::event::Event
   = help: consider importing this struct instead:
           crate::Events

warning: unused macro definition: `debug_detail`
  --> src/sys/mod.rs:18:18
   |
18 |     macro_rules! debug_detail {
   |                  ^^^^^^^^^^^^
   |
   = note: `#[warn(unused_macros)]` on by default

For more information about this error, try `rustc --explain E0432`.
warning: `mio` (lib) generated 1 warning
error: could not compile `mio` (lib) due to previous error; 1 warning emitted

@Thomasdezeeuw
Copy link
Collaborator

Well... you need to resolve those issues to ensure that Solaris works...

@psumbera
Copy link
Contributor Author

psumbera commented Sep 4, 2023

Ok, with my new change Solaris builds without need to define mio_unsupported_force_poll_poll.

@Thomasdezeeuw
Copy link
Collaborator

@psumbera can you add some CI setup? cargo test would be best, but cargo check is sufficient for now. Also see https://github.com/tokio-rs/mio/blob/master/Makefile#L2.

@psumbera
Copy link
Contributor Author

psumbera commented Sep 5, 2023

@psumbera can you add some CI setup? cargo test would be best, but cargo check is sufficient for now.

Confused again. Where? .github/workflows/ci.yml? Any example for that?
cargo test passes for me. But there is no Solaris instance which is accesible from github for CI.

Also see https://github.com/tokio-rs/mio/blob/master/Makefile#L2.

Solaris isn't supported by rustup right now. I think there is no need to extend the list.

@Thomasdezeeuw
Copy link
Collaborator

@psumbera can you add some CI setup? cargo test would be best, but cargo check is sufficient for now.

Confused again. Where? .github/workflows/ci.yml? Any example for that? cargo test passes for me. But there is no Solaris instance which is accesible from github for CI.

... I mean come on... At some point you have put the time in. It's really not that complicated once you find the GitHub Actions file.

Also see https://github.com/tokio-rs/mio/blob/master/Makefile#L2.

Solaris isn't supported by rustup right now. I think there is no need to extend the list.

Do you have any other means to add Solaris support to the CI?

@@ -1,5 +1,5 @@
#[cfg(all(
not(mio_unsupported_force_poll_poll),
not(any(target_os = "solaris", mio_unsupported_force_poll_poll)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not needed as solaris is not any of the targets listed below.

@@ -10,7 +10,7 @@
mod epoll;

#[cfg(all(
not(mio_unsupported_force_poll_poll),
not(any(target_os = "solaris", mio_unsupported_force_poll_poll)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Again not needed.

pub(crate) use self::poll::{event, Event, Events, IoSourceState, Selector};

#[cfg(all(
not(mio_unsupported_force_poll_poll),
not(any(target_os = "solaris", mio_unsupported_force_poll_poll)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not needed.

@@ -42,7 +42,7 @@ pub(crate) use self::poll::{event, Event, Events, IoSourceState, Selector};
mod kqueue;

#[cfg(all(
not(mio_unsupported_force_poll_poll),
not(any(target_os = "solaris", mio_unsupported_force_poll_poll)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not needed.

@@ -1,5 +1,5 @@
#[cfg(all(
not(mio_unsupported_force_poll_poll),
not(any(target_os = "solaris", mio_unsupported_force_poll_poll)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I got following error without this change:

error: field `waker` is never read
  --> src/sys/unix/waker.rs:38:9
   |
37 |     pub struct Waker {
   |                ----- field in this struct
38 |         waker: WakerInternal,
   |         ^^^^^
   |
   = note: `Waker` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
note: the lint level is defined here
  --> src/lib.rs:6:5
   |
6  |     dead_code
   |     ^^^^^^^^^

error: associated items `new` and `wake` are never used
  --> src/sys/unix/waker.rs:42:16
   |
41 |     impl Waker {
   |     ---------- associated items in this implementation
42 |         pub fn new(selector: &Selector, token: Token) -> io::Result<Waker> {
   |                ^^^
...
48 |         pub fn wake(&self) -> io::Result<()> {
   |                ^^^^
```  

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it uses pub use self::poll::Waker; and thus cannot use pub use self::fdbased::Waker.

Copy link
Collaborator

Choose a reason for hiding this comment

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

But on Solaris this attribute should never return true, even without the change made. I don't have time to look into it at the moment, but this change is not needed and only made the cfg attribute more complex.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Thomasdezeeuw How can possibly following attribute be false on Solaris?

#[cfg(all(
    not(mio_unsupported_force_poll_poll),
    not(all(
        not(mio_unsupported_force_waker_pipe),
        any(
            target_os = "freebsd",
            target_os = "ios",
            target_os = "macos",
            target_os = "tvos",
            target_os = "watchos",
        )
    ))
))]

@@ -13,7 +13,7 @@
))]
mod fdbased {
#[cfg(all(
not(mio_unsupported_force_waker_pipe),
not(any(target_os = "solaris", mio_unsupported_force_waker_pipe)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not needed.

@@ -51,7 +52,7 @@ mod fdbased {
}

#[cfg(all(
not(mio_unsupported_force_poll_poll),
not(any(target_os = "solaris", mio_unsupported_force_poll_poll)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I got following error without this change:

error[E0432]: unresolved imports `self::fdbased`, `self::waker::Waker`
  --> src/sys/unix/mod.rs:24:20
   |
24 |     pub(crate) use self::waker::Waker;
   |                    ^^^^^^^^^^^^^^^^^^
   |
  ::: src/sys/unix/waker.rs:66:15
   |
66 | pub use self::fdbased::Waker;
   |               ^^^^^^^ could not find `fdbased` in `self`

@@ -112,7 +113,7 @@ mod eventfd {
}
}

#[cfg(mio_unsupported_force_poll_poll)]
#[cfg(any(target_os = "solaris", mio_unsupported_force_poll_poll))]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this is needed, but not 100% sure.

@@ -138,7 +139,7 @@ mod eventfd {
}

#[cfg(all(
mio_unsupported_force_poll_poll,
any(target_os = "solaris", mio_unsupported_force_poll_poll),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not needed.

@@ -276,7 +278,7 @@ mod pipe {
}

#[cfg(all(
mio_unsupported_force_poll_poll,
any(target_os = "solaris", mio_unsupported_force_poll_poll),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not need, you already added it below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I got following errir without this change:

error[E0432]: unresolved import `crate::sys::unix::waker::WakerInternal`
 --> src/sys/unix/selector/poll.rs:7:5
  |
7 | use crate::sys::unix::waker::WakerInternal;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `WakerInternal` in `sys::unix::waker`

error: unused import: `AsRawFd`
  --> src/sys/unix/selector/poll.rs:11:25
   |
11 | use std::os::unix::io::{AsRawFd, RawFd};
   |                         ^^^^^^^
   |
note: the lint level is defined here
  --> src/lib.rs:5:5
   |
5  |     unused_imports,
   |     ^^^^^^^^^^^^^^

@psumbera psumbera force-pushed the solaris-poll branch 2 times, most recently from 7c90608 to accc36b Compare September 11, 2023 08:39
@psumbera
Copy link
Contributor Author

@psumbera can you add some CI setup? cargo test would be best, but cargo check is sufficient for now.

Confused again. Where? .github/workflows/ci.yml? Any example for that? cargo test passes for me. But there is no Solaris instance which is accesible from github for CI.

... I mean come on... At some point you have put the time in. It's really not that complicated once you find the GitHub Actions file.

Still confused. If you mean '.cirrus.yml'. Cirrus CI doesn't support Solaris OS.

Also see https://github.com/tokio-rs/mio/blob/master/Makefile#L2.

Solaris isn't supported by rustup right now. I think there is no need to extend the list.

Do you have any other means to add Solaris support to the CI?

No.

@psumbera
Copy link
Contributor Author

@Thomasdezeeuw do you have any other commets or suggestions? Thank you!

Copy link
Collaborator

@Thomasdezeeuw Thomasdezeeuw left a comment

Choose a reason for hiding this comment

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

@Thomasdezeeuw do you have any other commets or suggestions? Thank you!

Ideally we can setup some kind of CI, but that doesn't seem likely.

Also some of the comments I made still need to be resolved, I see you answered them, but I think the warnings should we resolved in another way.

@@ -1,5 +1,5 @@
#[cfg(all(
not(mio_unsupported_force_poll_poll),
not(any(target_os = "solaris", mio_unsupported_force_poll_poll)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

But on Solaris this attribute should never return true, even without the change made. I don't have time to look into it at the moment, but this change is not needed and only made the cfg attribute more complex.

@Thomasdezeeuw
Copy link
Collaborator

Thomasdezeeuw commented Oct 18, 2023

I need to clean up the cfg a bit so that Solaris (and vita, see #1721) can use the epoll(2) implementation without any RUSTFLAGS.

@Thomasdezeeuw
Copy link
Collaborator

@psumbera can you rebase this? I think after we merged #1721 we got a reasonable way forward. I'll like Solaris to be supported in a similar way, that is without any flags.

@Thomasdezeeuw
Copy link
Collaborator

@psumbera did you mean to close this?

@psumbera
Copy link
Contributor Author

psumbera commented Nov 6, 2023

@psumbera did you mean to close this?

No. I'm now applying manually my changes on top of latest repo. I will push change to my repo later...

@psumbera
Copy link
Contributor Author

psumbera commented Nov 6, 2023

Ok. I wasn't able to reuse this pull request. Instead I have to create #1724.

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.

None yet

3 participants