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

rust-lang/libc seems to have incorrect definition for sockaddr_in #174

Open
adryzz opened this issue Mar 26, 2024 · 5 comments
Open

rust-lang/libc seems to have incorrect definition for sockaddr_in #174

adryzz opened this issue Mar 26, 2024 · 5 comments

Comments

@adryzz
Copy link
Contributor

adryzz commented Mar 26, 2024

Was trying to get mio to build and run on the 3ds, using its poll backend, such that crates like reqwest and the literal thousands of libraries that depend on tokio's net feature would run, but i ran into this issue, just asking if it's to report to upstream, and if so, we should check whether other definitions are wrong, such that they can be fixed all at once:

this is sockaddr_in in rust:
https://github.com/rust-lang/libc/blob/a0f5b4b21391252fe38b2df9310dc65e37b07d9f/src/unix/newlib/horizon/mod.rs#L34-L38

and this is the devkitpro definition:
https://libctru.devkitpro.org/structsockaddr__in.html

    pub struct sockaddr_in {
        pub sin_family: ::sa_family_t,
        pub sin_port: ::in_port_t,
        pub sin_addr: ::in_addr,
+       pub sin_zero: [::c_char; 8],
    }
@Meziu
Copy link
Member

Meziu commented Mar 26, 2024

Uhm, I thought we had accounted for those definitions already… If we can find more issues in the bindings we could push everything through with one PR, otherwise it’s fine to just merge this one change directly to libc.

@FenrirWolf
Copy link
Member

FenrirWolf commented Mar 26, 2024

There's at least one more problem that I was planning on making an issue for: libctru changed the definition for hostent some time ago, and both libc and std are using the old one still

@adryzz
Copy link
Contributor Author

adryzz commented Mar 26, 2024

yeah, we should create some patches to fix libc/std all at once. i'll try checking if other definitions are wrong

@adryzz
Copy link
Contributor Author

adryzz commented Mar 27, 2024

uhh one problem: i found this: rust-lang/libc#2725, which is the PR that created this problem. how do we proceed?

edit: for more info, this branch of mio adds Horizon OS support, and doesn't build without the extra bytes

@Meziu
Copy link
Member

Meziu commented Mar 27, 2024

uhh one problem: i found this: rust-lang/libc#2725, which is the PR that created this problem. how do we proceed?

Wow, i had completely forgotten about that! Do we know whether the original “faulty checks” issue is still present? I’m a bit unsure on how to tackle this problem.

Edit: we could turn off the checks in std (or make custom ones for Horizon), but that would create a bit of difference with the rest of the implementations that we’d have to maintain (would they even accept it?)

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

3 participants