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

sockaddr_storage in libc is incorrectly defined (on 32 bit systems at least) #23425

Closed
carllerche opened this issue Mar 16, 2015 · 1 comment · Fixed by #23450
Closed

sockaddr_storage in libc is incorrectly defined (on 32 bit systems at least) #23425

carllerche opened this issue Mar 16, 2015 · 1 comment · Fixed by #23450

Comments

@carllerche
Copy link
Member

I believe that on 32 bit linux, sizeof(struct sockaddr_storage) => 128, in rust => 124. I glanced at the definition in rust and it does look suspect with respect to portability.

@carllerche
Copy link
Member Author

Ok, I believe that the definition should be:

pub struct sockaddr_storage {
   pub ss_family: sa_family_t,
   pub __ss_align: u32,
   pub __ss_pad2: [u8; 120],
}

alexcrichton added a commit to alexcrichton/rust that referenced this issue Mar 17, 2015
The alignment field is actually a "pointer sized" type instead of always i64,
requiring that the size of the padding field is also calculated slightly
differently.

Closes rust-lang#23425
Manishearth added a commit to Manishearth/rust that referenced this issue Mar 18, 2015
…r=brson

 The alignment field is actually a \"pointer sized\" type instead of always i64,
requiring that the size of the padding field is also calculated slightly
differently.

Closes rust-lang#23425
homu added a commit to nix-rust/nix that referenced this issue Jan 11, 2017
Always use libc's socketaddr_storage

Since rust-lang/rust#23425 is closed, we no longer need the special
case.
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 a pull request may close this issue.

1 participant