-
Notifications
You must be signed in to change notification settings - Fork 677
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
ioctl write_int doesn't support passing long integers #824
Comments
Where is this specified for Linux? And if this is correct, then why wouldn't |
@jethrogb I don't understand enough to fix this, so I need some more information from you. Specifically a test case that you know is failing currently. Linux should actually be using a #[cfg(not(any(target_os = "android", target_env = "musl")))]
#[doc(hidden)]
pub type ioctl_num_type = ::libc::c_ulong; |
Sorry, actually looking at the code I do see the size of a |
The problem is with this line https://github.com/Susurrus/nix/blob/7eb8dd1ccf5ec8281076e9aa8f1598e0e8bcbd68/src/sys/ioctl/mod.rs#L544 |
I still don't see any documentation suggesting what youre saying here. The passed integer must be equal in size to a pointer type because of the way ioctl is defined. We'll need to sort out what's appropriate for each platform, and we'll need docs for that. Can you link to any? |
https://github.com/torvalds/linux/blob/5d38f04/include/linux/fs.h#L1702-L1703 That, by the way, shows that the current |
I couldn't quickly find the declaration of I'll fix this and add also specify the parameter as On BSD it looks like it's consistently a |
And the fix to this might not be too easy because:
So are those 3 |
While usually `ioctl()` passes a pointer, the function call has been overloaded to allow integers to be passed. For some platforms this is an `int` and on others it's a `ulong`. Fixes nix-rust#824.
Fixed by 5dad660, which is now in master. |
The Linux kernel API always passes the ioctl parameter as an
unsigned long
. However, theioctl!
macro always usesc_int
. It should probably usec_long
/c_ulong
/usize
instead, in order to pass all possible values.The text was updated successfully, but these errors were encountered: