Closed nickray closed 4 years ago
Ensuring that 0 is passed to an ioctl that shouldn't take any argument seems to be a sane thing to do.
Using _IO*
when defining ioctl numbers is just a convention. There's a lot of (especially legacy) ioctls that don't follow it at all. On top of that there are _IO()
("none" as you call them) ioctls that actually write to userspace or read from userspace.
Are those impossible to use from Rust? That seems weird.
Is there no way in Rust to explicitly provide all arguments to an ioctl?
Honestly I think that library is wrong (not to set the value explicitly to zero in case of "none"/_IO()
) and you're right. Thanks for clarifying!
Hi
I ran into issue https://github.com/nix-rust/nix/issues/781 when working on using this from Rust. The issue seems to be that
raw_ioctl_run
is declared as IO (i.e. "none"), but still checks that the passed value is zero: https://github.com/xairy/raw-gadget/blob/1e150b7a68ade7b68b0e635046ee8a15d2a72c9b/raw_gadget/raw_gadget.c#L501-L502Could this check be removed?