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

Openbsd cleanup #110

Merged
merged 17 commits into from
Jan 11, 2016
Merged

Openbsd cleanup #110

merged 17 commits into from
Jan 11, 2016

Conversation

semarie
Copy link
Contributor

@semarie semarie commented Dec 23, 2015

The following PR is the result of running libc-test under OpenBSD, and corrects all problems.

I have keeped separated commits for reviewing.

Some commits touch BSD globally (getnameinfo for example). In these cases, I have tried to review definitions in system code source.

Please note that this version of libc will break openbsd target for rustc. There are three breaking change:

  • OpenBSD don't have HW_AVAILCPU: it will break num_cpus() inside src/libtest/lib.rs
  • the NR_GETENTROPY constant don't exist under this name (it is SYS_getentropy). But I also remove it and declare the function getentropy() which should be a more stable API. The current use is inside src/libstd/rand/os.rs
  • the type of siginfo_t.si_addr isn't compatible with the current definition of siginfo_si_addr() in src/libstd/sys/unix/stack_overflow.rs

For all these problems, I have pending patches.

- under openbsd and bitrig: dli_saddr member is *mut ::c_void
- under netbsd: it is *const ::c_void
- IPV6_{ADD,DROP}_MEMBERSHIP
- HW_AVAILCPU
- same prototype on bitrig and openbsd
- for netbsd, I did found it at all (?)
- sysctl: *mut -> *const
- mprotect: *const -> *mut
- remove sysctlbyname() that don't exists under openbsd
arguments `hostlen' and `servlen' are `socklen_t' or `size_t' depending
the platform

- apple: I don't known, so I don't change the original definition (socklen_t)
- netbsd: socklen_t
- freebsd: size_t
- dragonfly: size_t
- openbsd: size_t
- bitrig: size_t
under openbsd it is a `caddr_t` which expand to `char *`.
as the size of the type change, adjust the padding too.
- under openbsd/bitrig it is 256
- change type to `size_t` where system have `getnameinfo()` with
  `hostlen` as `size_t`
SYS_entropy is internal and may more easily change than getentropy(2).
@@ -200,6 +213,9 @@ fn main() {
let target2 = target.clone();
cfg.field_name(move |struct_, field| {
match field {
"d_namelen" if openbsd && struct_ == "dirent" => "d_namlen".to_string(),
Copy link
Member

Choose a reason for hiding this comment

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

Could this struct field be updated on openbsd to match the name in C? For renamings like this Rust shouldn't differ much

@alexcrichton
Copy link
Member

Thanks! I think it's fine to have some breakage here because this isn't a "tier 1 platform" of this library currently (e.g. there's no CI set up for it), but this is a great foundation to start from now!

@semarie
Copy link
Contributor Author

semarie commented Dec 24, 2015

@alexcrichton I don't understand the failure for mips-unknown-linux-gnu

the previous one (6b84742) was ok, and adding 6c8a63a would make a linkage problem with undefined reference to 'secure_getenv' ?

@alexcrichton
Copy link
Member

Thanks @semarie! I'll work on getting this merged (mips failures are likely unrelated)

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.

2 participants