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

Solaris: fixes build and tests, adds CI #2544

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

psumbera
Copy link

Disables some tests for Solaris.

test/test_sendfile.rs:

Solaris, sendfilev() doesn't support AF_UNIX sockets. Instead, it expects an AF_INET or AF_INET6 sockets.

@SteveLauC SteveLauC self-requested a review November 20, 2024 01:11
@SteveLauC SteveLauC linked an issue Nov 20, 2024 that may be closed by this pull request
Copy link
Member

@SteveLauC SteveLauC left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Sorry for a bunch of comments 🫣

.github/workflows/ci.yml Outdated Show resolved Hide resolved
src/dir.rs Show resolved Hide resolved
src/fcntl.rs Outdated Show resolved Hide resolved
src/sys/signal.rs Outdated Show resolved Hide resolved
src/sys/socket/mod.rs Show resolved Hide resolved
src/sys/termios.rs Outdated Show resolved Hide resolved
src/sys/termios.rs Outdated Show resolved Hide resolved
Comment on lines 466 to 469
// Solaris can use libc::_POSIX_VDISABLE once following is pulled in:
// https://github.com/rust-lang/libc/pull/4103
#[cfg(target_os = "solaris")]
pub const _POSIX_VDISABLE: u8 = 0;
Copy link
Member

Choose a reason for hiding this comment

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

This libc PR has been merged and back-ported into the libc-0.2 branch, though it has not been released, so we can use it from git:

# Cargo.toml
libc = { git = "https://github.com/rust-lang/libc", branch = "libc-0.2", features = ["extra_traits"] }

Copy link
Author

Choose a reason for hiding this comment

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

With git libc version I'm getting:

error[E0015]: cannot call non-const fn `CMSG_SPACE` in constant functions
   --> src/sys/socket/mod.rs:652:14
    |
652 |     unsafe { libc::CMSG_SPACE(mem::size_of::<T>() as libc::c_uint) as usize }
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants

No idea from where it comes...

Copy link
Member

Choose a reason for hiding this comment

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

Weird, looks like it is still a const function:

$ rg "CMSG_SPACE"
mod.rs
2508:    pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {

Copy link
Member

Choose a reason for hiding this comment

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

Could you please try this in our CI so that I can see the error message

Copy link
Member

Choose a reason for hiding this comment

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

Weird, I didn't expect it to be broken on all the targets, let me investigate a bit. 😵

Copy link
Member

Choose a reason for hiding this comment

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

Looks like libc PR rust-lang/libc#4063 broke this, I verified that enabling feature const-extern-fn will work, but I think it is an issue, so let's wait for the upstream to fix it. 😶

libc = { git = "https://github.com/rust-lang/libc", branch = "libc-0.2", features = ["extra_traits", "const-extern-fn"] }

Copy link
Member

Choose a reason for hiding this comment

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

Upstream issue: rust-lang/libc#4115

src/syslog.rs Outdated Show resolved Hide resolved
test/sys/test_timer.rs Outdated Show resolved Hide resolved
@SteveLauC
Copy link
Member

BTW, looks like x86_64-sun-solaris was renamed to x86_64-pc-solaris, so this PR can close #935?

@SteveLauC SteveLauC linked an issue Nov 20, 2024 that may be closed by this pull request
Disables some tests for Solaris.

test/test_sendfile.rs:

Solaris, sendfilev() doesn't support AF_UNIX sockets.
Instead, it expects an AF_INET or AF_INET6 sockets.

test/sys/test_timer.rs:

Note that sys::test_timer::alarm_fires can fail as timer_create(3C) function
requires the PRIV_PROC_CLOCK_HIGHRES. But since tests are supposed to run
with sudo it should be ok.
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.

fails cross check --target x86_64-pc-solaris on 1.72.1 Add support for x86_64-sun-solaris target
2 participants