-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Bsd stat fixes #31734
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
Bsd stat fixes #31734
Conversation
This becomes less relevant for dragonfly a i686 support is dropped since release 40, but using long allows some compatibility for older versions.
reproduces the padding found here: https://svnweb.freebsd.org/base/release/10.1.0/sys/sys/stat.h?view=markup#l139
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @brson (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Woops, meant to reference this for the LFS change: |
In #25155 the os::freebsd::raw stat was split for the x86 vs. x86-64 cases, which appears to have been done to implement the padding on the end of struct stat for the x86 case (the struct is otherwise the same notwistanding the size of long). This PR de-duplicates the struct using #[cfg(target_arch = "x86")] for the __unused field, which also fixes the definitions which had sinced changed with the LFS work d088b67. Also changed definitions to c_long for dragonfly and freebsd where appropriate. Also removes some unused imports that the compiler was complaining about. dragonfly's long time_t: https://gitweb.dragonflybsd.org/dragonfly.git/blob/a2a57c243ff8016578bc559f8603fb25bbcf1768:/lib/libstand/machine/stdint.h freebsd's long time_t: https://svnweb.freebsd.org/base/release/10.1.0/sys/x86/include/_types.h?view=markup https://github.com/rust-lang/rust/blob/d088b671872f1df6993ccca6fa6139ebed0a8cf3/src/liblibc/lib.rs#L980 freebsd's padding for i686 stat: https://svnweb.freebsd.org/base/release/10.1.0/sys/sys/stat.h?view=markup#l139 https://github.com/rust-lang/rust/blob/d088b671872f1df6993ccca6fa6139ebed0a8cf3/src/liblibc/lib.rs#L1038
In #25155 the os::freebsd::raw stat was split for the x86 vs. x86-64 cases, which appears to have been done to implement the padding on the end of struct stat for the x86 case (the struct is otherwise the same notwistanding the size of long).
This PR de-duplicates the struct using #[cfg(target_arch = "x86")] for the __unused field, which also fixes the definitions which had sinced changed with the LFS work d088b67.
Also changed definitions to c_long for dragonfly and freebsd where appropriate.
Also removes some unused imports that the compiler was complaining about.
dragonfly's long time_t:
https://gitweb.dragonflybsd.org/dragonfly.git/blob/a2a57c243ff8016578bc559f8603fb25bbcf1768:/lib/libstand/machine/stdint.h
freebsd's long time_t:
https://svnweb.freebsd.org/base/release/10.1.0/sys/x86/include/_types.h?view=markup
rust/src/liblibc/lib.rs
Line 980 in d088b67
freebsd's padding for i686 stat:
https://svnweb.freebsd.org/base/release/10.1.0/sys/sys/stat.h?view=markup#l139
rust/src/liblibc/lib.rs
Line 1038 in d088b67