-
Notifications
You must be signed in to change notification settings - Fork 1k
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
utsame struct is incorrectly defined on FreebSD #1190
Comments
The appropriate header is here: https://github.com/freebsd/freebsd/blob/1d6e4247415d264485ee94b59fdbc12e0c566fd0/sys/sys/utsname.h#L49 The length of the arrays for the user-land interface is actually configurable.
Indeed, the length of those arrays should be the length that the kernel interface expects. I wondered why the tests aren't catching this error, and it appears that we are just skipping the tests for Line 798 in 027d483
Instead of skipping the tests, the right way to test this is to define |
It looks like the test is skipped because
|
libc's uname is at https://svnweb.freebsd.org/base/head/lib/libc/gen/uname.c?view=markup . The inline function was added in r74729 (back in 2001!) and is what all new programs should be using. The version in libc is for binary compatibility with very old programs. All Rust programs should be using the inline version. Unfortunately, that probably means that libc needs to deprecate uname and only expose __xuname. See Also: |
Well if the goal is to replicate libc I'd say the ideal should be to wrap |
On FreeBSD, uname is an inline function. The uname that is present in libc.so is for FreeBSD 1.0 compatibility. It expects a buffer of a different size. Fixes rust-lang#1190 Reported-by: Alex Zepeda
Fix uname on FreeBSD On FreeBSD, uname is an inline function. The uname that is present in libc.so is for FreeBSD 1.0 compatibility. It expects a buffer of a different size. Fixes #1190 Reported-by: Alex Zepeda
Fix uname on FreeBSD On FreeBSD, uname is an inline function. The uname that is present in libc.so is for FreeBSD 1.0 compatibility. It expects a buffer of a different size. Fixes #1190 Reported-by: Alex Zepeda
On FreeBSD utsname struct is defined with 32 character-wide arrays for the kernel interface and 256-wide arrays for the userland interface. The userland interface is a small inline function in
sys/utsname.h
that calls the kernel interface and explicitly requests longer fields. Unfortunately rust is calling the kernel interface directly and only getting arrays that are 32 characters in length. As a result each field from the C struct ends up in the first field in the rust struct, and the other rust fields remain empty.For example:
The text was updated successfully, but these errors were encountered: