Closed
Description
I'm working on converting my crate to use nix
instead of ioctl-rs
as nix
is better maintained. The big issue here is that the documentation for using ioctl
s with nix
is not good from a user's point of view. Here are some issues I ran into:
- The difference between using
ioctl!
and usingior!
,iow!
,iorw!
, andioc
is not listed clearly. I'm sure one is preferred over the other, but I'm not certain which. The example only usesioctl!
. - It should be clarified that ioctl constants should be upstreamed into
libc
and then those should be used as inputs/outputs. The example doesn't do that, so we'll have tons of people reimplementing everything per-crate. - The
ioctl!
example only usesread
andwrite
. Looking at the macro there are 8 forms of it, but the documentation doesn't actually describe any of them. - It's unclear how to use
ioc_dir
and friends. There are no docs and they don't take clear types, but there are constants that have similar names in the module, so maybe those are related? - There are various constants that are also a part of the
ioctl
module, but those don't seem attached to these functions. nix
doesn't provide helpful wrapper functions for ioctls even if they're quite common (TIOCEXCL
would be an example) and well-defined. I'd suggest that wrapper functions be provided for well-defined ioctls. This may be controversial, as I think it's come up before, because ioctl's are unbounded and defined by kernel drivers. So maybe there is a role for an ioctl crate that does this on top ofnix
.