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

uclibc/mips change SA_* to uint #3887

Open
tgross35 opened this issue Aug 29, 2024 · 5 comments
Open

uclibc/mips change SA_* to uint #3887

tgross35 opened this issue Aug 29, 2024 · 5 comments
Milestone

Comments

@tgross35
Copy link
Contributor

This comes from #3211, I'm not positive what the context is. But we can do this at 1.0.

@cppcoffee do you have links to the relevant headers?

@cppcoffee
Copy link
Contributor

Hi @tgross35 , I'm really sorry, it's been a while and I've somewhat forgotten, but at the time I encountered a compilation error related to signal interfaces. Modifying it to u_long allowed the compilation to pass.

@tgross35
Copy link
Contributor Author

Nothing to be sorry for - your PR has been open a very long time :) after #3211 merges just submit another PR to correct these things, but I do need a link to headers to check against if you can find it.

(If headers aren't easy to find then it's not the end of the world since mips is tier 3 and I can take your word for it, just better to be certain if possible).

@cppcoffee
Copy link
Contributor

I reproduced it and the compilation error is as follows:

error[E0308]: mismatched types
   --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.26.4/src/macros.rs:70:35
    |
70  |                       const $Flag = libc::$Flag $(as $cast)*;
    |                                     ^^^^^^^^^^^ expected `u32`, found `i32`
    |
   ::: /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.26.4/src/sys/signal.rs:414:1
    |
414 | / libc_bitflags! {
415 | |     /// Controls the behavior of a [`SigAction`]
416 | |     #[cfg_attr(docsrs, doc(cfg(feature = "signal")))]
417 | |     pub struct SaFlags: SaFlags_t {
...   |
439 | |     }
440 | | }
    | |_- in this macro invocation
    |
    = note: this error originates in the macro `libc_bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)

@tgross35
Copy link
Contributor Author

tgross35 commented Aug 30, 2024

Okay, tracing back: this error comes from https://github.com/nix-rust/nix/blame/ae338dfc2097a741d9dbff21391c737f9c95de93/src/sys/signal.rs#L413-L421, which seems to indicate that sigaction flags on ulibc are c_ulong. This was added here nix-rust/nix#1603.

Looking at ulibc, this might not always be correct.

Our struct sigaction reflects this, as do the flags.

So I think nix might have to be the one to change here - their config needs to check if ulibc and mips and make it c_uint rather than always c_ulong. I think this might apply to gun/musl too and not just ulibc - see the mips-specific https://github.com/torvalds/linux/blob/20371ba120635d9ab7fc7670497105af8f33eb08/arch/mips/include/uapi/asm/signal.h#L94 in the kernel, as well as the other results. (the last bit is not true, see below)

@tgross35
Copy link
Contributor Author

tgross35 commented Aug 30, 2024

@tgross35 tgross35 changed the title uclibc/mips change SA_* to ulong uclibc/mips change SA_* to uint Sep 17, 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

No branches or pull requests

2 participants