-
Notifications
You must be signed in to change notification settings - Fork 735
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
Port to Solaris #1152
Comments
So you're saying that the Solaris port never worked? @psumbera do you use Solaris and are you willing to contribute such a port? Otherwise we maybe should just drop support for Solaris if it never worked in the first place. /cc @carllerche |
Well, we need some way to test it in CI... none of the mio devs have a solaris setup. |
Mio is used by Rust. And Solaris really needs Rust to build Firefox. From Rust version 1.38 something changed and it now fails to link on Solaris because of this issue (though I know Mio was used also with previous Rust versions without the issue). I'm Solaris engineer so I have access to Solaris. Unfortunately I'm not very good with Rust. But anyway I will try to come with something or will seek for help. |
Can you try testing Mio (by running Also could you help with setting up the CI for Solaris? Going forward we would like to a bit stricter about what platforms we support and having a CI for it is one of them. |
I'm trying to add 'src/sys/unix/selector/evport.rs' which would add support via Solaris even ports API. My question is also whether it wouldn't be enough to add support for other platforms via select()?
This is different problem we are aware of. As for Solaris right now there is for free available only old image of Solaris 11.4. So if you have virtual environment where to run it (e.g. VirtualBox) I can do some setup. But as you can see see I'm now locked with Rust 1.37 till we solve Mio problem... |
I think the problem is that rust's libc wrapper has the If you remove mio/src/sys/unix/selector/mod.rs Lines 1 to 5 in ac0515c
select() , or whatever functions are appropriate, you can use it with the following target #[cfg(target_os = "solaris")] . Much like the mod and pub use statements in that file. Something like:
#[cfg(any(target_os = "linux", target_os = "android"))]
mod epoll;
#[cfg(any(target_os = "linux", target_os = "android"))]
pub use self::epoll::{event, Event, Events, Selector};
#[cfg(target_os = "solaris")]
mod evport;
#[cfg(target_os = "solaris")]
pub use self::evport::{event, Event, Events, Selector};
// kqueue... In Also could you update Line 168 in ac0515c
|
I have started my work (see here): But now I'm getting:
Any idea about this one? Thank you! |
I guess pub struct Event(libc::port_event);
unsafe impl Send for Event {}
unsafe impl Sync for Event {} Note however you must manually ensure that the |
You are right:
I tried quick hack by modifying it to
Any clue?
Sorry I'm no good enough with Rust yet. I tried:
And I get now:
Can you please hint me little bit more?
I hope there is no problem. Event port API is marked as thread safe. |
Yes then it means you can implement
My guess it that you're using an older rust compiler version. Can you update to a newer version? Preferably 1.39. If not you can change those constants to literal values (that of the length of
The first problem is that now we're using different types. So revert the suggestion I made and go back to
This is safe, see the first part of my comment |
Ok. With my modification for Rust libc: and
I have following test failures:
|
If you add For the error itself, I don't know what the source could be. It seems specific to the Solaris port though, as I've never seen the error for Mio before. Also if you can't find the source of the error it's fine to ignore the test for a while by adding the Lines 358 to 360 in d64a303
|
I resolved the issue with 'add_then_drop' like this: But now I'm puzzled with 'register_deregister' test. port_dissociate() returns ENOENT at the end. The issue seems to be that I need to re-associate fd every time I get event for it from port_getn(). Man page says:
And I don't do it now. Isn't this needed for epoll too? |
On For now; on each I/O operation, e.g. If it does not you can ignore the |
How should I do it? Are there some mio |
I'm afraid you'll need to manually change all methods of |
Ok. There might be also possibility to use poll(7d): I will have look at it. Thank you! |
That contains a note:
It seems to be deprecated and soon to be removed, so let's not depend on that. |
As a insider I don't think it will be removed anytime soon... In fact Illuomos epoll interface is using it: BTW. How can open and write into the file using libc functions in Rust? |
I see... then I think we could consider it.
All libc functions are exported in the |
Sorry, I don't seem to be able even open file...
Also not sure where is open defined. Is it here? |
That is because in C a str is just a pointer to a slice of Easiest way around it is using use std::fs::File;
File::open("/dev/poll").map(|file| {
let fd = file.into_raw_fd(); // Get the raw file descriptor.
}) |
I'm lost again. Can you please help me wit this?
The relevant code is:
|
This works:
The original code mapped an |
Thank you very much for helping me! Now I get this:
|
Try |
Following did the trick:
But it seems that /dev/poll was wrong path. The main problem is missing place where to store token. I tried to store lowest 3 bits of token into So should I go back to Solaris ports? If yes, can you please show me some place where to do reregistration (e.g. in sys::unix::TcpStream)? |
This might be because Rust
Doesn't it have any user defined fields? We need at least 64 bits (on 64 bits architectures).
I don't know enough about Solaris to answer this. Maybe you can look at what libuv uses? |
No. We don't understand each other. I have no problem with file opening. I can open it. I meant that Solaris /dev/poll (https://docs.oracle.com/cd/E19253-01/816-5177/6mbbc4g9n/index.html) doesn't allow to store any user defined value (token).
No it doesn't have it.
libuv uses Solaris event ports: And after each read they seem to call port_associate() again: |
If As for calling |
Yes, my colleague proposed fix here: #1263 |
Pr #1263 didn't go anywhere so I'm going to close this for. If people are interested in supporting Solaris (and maintaining it!) we can reopen this issue. |
We never really supported Solaris, we pretended it implemented epoll, but it never did see tokio-rs#1152. As no one ever committed to being a maintainer for the port I'm removing it now with this commit. Instead replace it with illumuos on the CI, which we do support (as it supports epoll) and for which we do have maintainers.
We never really supported Solaris, we pretended it implemented epoll, but it never did see tokio-rs#1152. As no one ever committed to being a maintainer for the port I'm removing it now with this commit. Instead replace it with illumuos on the CI, which we do support (as it supports epoll) and for which we do have maintainers.
We never really supported Solaris, we pretended it implemented epoll, but it never did see #1152. As no one ever committed to being a maintainer for the port I'm removing it now with this commit. Instead replace it with illumuos on the CI, which we do support (as it supports epoll) and for which we do have maintainers.
There really does need to be generic poll/select support as a fallback and that would handle most all fringe Unix platforms. It's also testable on the Tier 1 platforms. It's extremely frustrating that this library is causing so much grief on Solaris. |
Not really, we support a pretty broad range of Unix platforms already without a poll/select fallback. Furthermore the design of poll/select is very different from epoll/kqueue's design, with in turn decided Mio's design, so implementing a poll/select fallback in a safe way isn't as easy as you might think.
Porting to a new platform requires more then just code, it also requires maintainers. In #1263 an attempt was made, but no-one stepped forward and to finish the port and commit to maintaining it. But anyone is welcome to finish the work! |
commit 5234b5f Author: Thomas de Zeeuw <[email protected]> Date: Sat Nov 13 12:57:29 2021 +0100 Release v0.8.0 commit 41a494b Author: Thomas de Zeeuw <[email protected]> Date: Sat Nov 13 12:59:43 2021 +0100 Fix Clippy warning commit a8c5756 Author: Thomas de Zeeuw <[email protected]> Date: Sun Nov 7 12:45:33 2021 +0100 Add changelog for v0.8 commit 7029a35 Author: Thomas de Zeeuw <[email protected]> Date: Sun Nov 7 12:34:33 2021 +0100 Add v0.7.14 change log From commit 064af84 commit dca2134 Author: Thomas de Zeeuw <[email protected]> Date: Sun Nov 7 11:26:23 2021 +0100 Fix feature flags for some tests files The test util module requires both the "os-poll" and "net" features. commit b9f089b Author: Thomas de Zeeuw <[email protected]> Date: Sun Nov 7 11:19:09 2021 +0100 Remove cfg attributes for Solaris We never really supported Solaris, we pretended it implemented epoll, but it never did see tokio-rs#1152. As no one ever committed to being a maintainer for the port I'm removing it now with this commit. Instead replace it with illumuos on the CI, which we do support (as it supports epoll) and for which we do have maintainers. commit 7d86108 Author: Thomas de Zeeuw <[email protected]> Date: Sun Nov 7 11:53:32 2021 +0100 Add section about raw fd to portability guidelines commit 3be5811 Author: Thomas de Zeeuw <[email protected]> Date: Sun Nov 7 12:09:53 2021 +0100 Add note about short receive on datagram sockets Talking about the differences between OSs. commit 3ca57f3 Author: Thomas de Zeeuw <[email protected]> Date: Sat Nov 6 15:20:54 2021 +0100 Document unconnected TcpStream returned by TcpStream::connect commit 47cf59c Author: Thomas de Zeeuw <[email protected]> Date: Sat Nov 6 15:04:56 2021 +0100 Deregister connection before dropping it in TCP example commit 05009e4 Author: Thomas de Zeeuw <[email protected]> Date: Sat Nov 6 14:53:45 2021 +0100 Document that Mio report OOB data in Event::is_readable Reporting Out-of-band (OOB) as readable it could leave applications open to DoS attacks. However because Mio uses edge-triggers most applications won't actually be effected. commit 44666e8 Author: Thomas de Zeeuw <[email protected]> Date: Sat Nov 6 14:41:54 2021 +0100 Fix match_like_matches_macro Clippy lint We've updated our MSVR since the comment above it. commit f8695a7 Author: Thomas de Zeeuw <[email protected]> Date: Sat Nov 6 14:39:42 2021 +0100 Update Rustc nightly version in CI commit f4b9252 Author: Ben Noordhuis <[email protected]> Date: Sun Oct 10 16:45:25 2021 +0200 Add sys::unix::SocketAddr::as_abstract_namespace() Fixes tokio-rs#1517. commit 04e0ca4 Author: Thomas de Zeeuw <[email protected]> Date: Tue Sep 28 18:16:01 2021 +0200 Update change log with v0.7.x releases Contains the work in the following commits: * v0.7.8 20b7298. * v0.7.9 07bc32f. * v0.7.10 b7006d7. * v0.7.11 772c692. * v0.7.12 7adfb75. * v0.7.13 75f41fb. commit e55ec59 Author: Thomas de Zeeuw <[email protected]> Date: Thu Oct 7 20:21:22 2021 +0200 Install nightly Rust on CI for install cargo-hack commit 499004f Author: Thomas de Zeeuw <[email protected]> Date: Thu Oct 7 20:14:36 2021 +0200 Install Cargo-hack using nightly on CI Cargo-hack's (transient) dependency bitflags has updated its MSRV. commit e9e91ff Author: Thomas de Zeeuw <[email protected]> Date: Tue Sep 28 19:59:15 2021 +0200 Fix Clippy warnings on Windows Seems this isn't check on the CI. commit b48cce6 Author: Thomas de Zeeuw <[email protected]> Date: Tue Sep 28 19:51:19 2021 +0200 Fix Clippy warnings commit 37aec3e Author: Thomas de Zeeuw <[email protected]> Date: Tue Sep 28 19:45:26 2021 +0200 Fix dead_code warnings for Windows commit 02e9be4 Author: Thomas de Zeeuw <[email protected]> Date: Tue Sep 28 19:32:35 2021 +0200 Remove TcpSocket type The socket2 crate provide all the functionality and more. Furthermore supporting all socket options is beyond the scope of Mio. The easier migration is to the socket2 crate, using the Socket or SockRef types. The migration for Tokio is tracked in tokio-rs/tokio#4135. commit d4ce420 Author: Rémi Lauzier <[email protected]> Date: Tue Jul 6 14:21:17 2021 -0400 Update dev-dependencies commit fbcc849 Author: Thomas de Zeeuw <[email protected]> Date: Sat Jul 3 12:44:57 2021 +0200 Change port in connect_error Hopefully this port is actually not used. Also check Event::is_write_closed since we expect that to be true. commit bfbcd9d Author: Jake Shadle <[email protected]> Date: Fri Jul 2 15:17:17 2021 +0200 Move wine from unsupported commit 21ddf94 Author: Ivan Enderlin <[email protected]> Date: Tue Jun 22 22:36:09 2021 +0200 chore: Make Clippy happy (bis). commit 6d62f5d Author: Ivan Enderlin <[email protected]> Date: Mon Jun 21 16:41:21 2021 +0200 chore: Make Clippy happy. commit 6eb1efa Author: Ivan Enderlin <[email protected]> Date: Mon Jun 21 16:22:16 2021 +0200 feat: Move `poll::selector` to `Registry::selector`. commit 441367b Author: Thomas de Zeeuw <[email protected]> Date: Sun Jun 13 00:33:17 2021 +0200 Fix Selector::try_clone Calls fcntl F_DUPFD_CLOEXEC expects two arguments; the command (F_DUPFD_CLOEXEC) and an argument for the command. In this case an lower bound for the resulting file descriptor. Because we didn't provide a value it would take whatever value was left in the register from whatever code used it before the system call. This caused Waker::new to fail, see issue tokio-rs#1497. commit cbcaedf Author: Thomas de Zeeuw <[email protected]> Date: Sat Jun 12 20:39:12 2021 +0200 Set FD_CLOEXEC flag on duplicated kqueue Poll Same as commit c52635c, but for kqueue. commit c52635c Author: Tim Zhang <[email protected]> Date: Tue May 25 11:40:54 2021 +0800 Set the close-on-exec flag for the duplicate epoll_fd The close-on-exec flag (FD_CLOEXEC; see fcntl(2)) for the duplicate descriptor created by dup(2) is off. We can use fcntl + F_DUPFD_CLOEXEC to dup the epoll_fd to fix this issue. Fixes: tokio-rs/tokio#3809 Signed-off-by: Tim Zhang <[email protected]> commit 2246ffb Author: Taiki Endo <[email protected]> Date: Sun May 23 16:06:15 2021 +0900 Use ubuntu-18.04 instead of ubuntu-16.04 commit 0cfba5d Author: cdcode <[email protected]> Date: Sun Jun 6 22:42:26 2021 +0100 Small spelling correction in example commit 22e8858 Author: Thomas de Zeeuw <[email protected]> Date: Thu May 13 17:09:57 2021 +0200 Update outdated comment commit 607a12f Author: Thomas de Zeeuw <[email protected]> Date: Mon May 10 12:10:28 2021 +0200 Replace x86_64-sun-solaris with x86_64-pc-solaris rust-lang/rust#82216 removed the x86_64-sun-solaris target from rustup, changing it to use x86_64-pc-solaris instead. Related issues: * rust-lang/rust#85098 commit 27a6a3c Author: Thomas de Zeeuw <[email protected]> Date: Mon May 10 11:56:41 2021 +0200 Avoid cast pointers to usize in windows::NamedPipe Changes the Inner::ptr_from_* methods to use ptr::wrapping_sub rather then casting to usize. commit e316b21 Author: Thomas de Zeeuw <[email protected]> Date: Wed May 5 12:13:47 2021 +0200 Replace offset constants with methods in Windows NamedPipe commit 9e13732 Author: Thomas de Zeeuw <[email protected]> Date: Mon Apr 12 20:26:53 2021 +0200 Reorder NamedPipe fields Moving the Overlapped fields to the start to make it easier to determine the offsets and hopefully incur less breakage once external fields change size. Note that the Overlapped fields internally uses miow::Overlapped, which in turn is a OVERLAPPED struct as found in the winapi crate and has a stable layout (as defined by the Windows API). commit db0d74c Author: Thomas de Zeeuw <[email protected]> Date: Mon Apr 12 20:03:24 2021 +0200 Remove unsound offset_of macro And replace it with constants that define the offsets to the fields. It's not a pretty solution, but it's one without UB. commit 1667a70 Author: Rob Ede <[email protected]> Date: Thu Apr 1 17:01:01 2021 +0100 remove manual doc versioning
For anyone still watching this issue. Solar is supported in Mio v1 using the |
Currently mio is using for Solaris epoll interface. But Solaris doesn't have this interface. Only Illumos has it.
There are two things to be done:
The text was updated successfully, but these errors were encountered: