-
Notifications
You must be signed in to change notification settings - Fork 716
Closed
Labels
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 ioctls 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!, andiocis 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
libcand 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 usesreadandwrite. 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_dirand 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
ioctlmodule, but those don't seem attached to these functions. nixdoesn't provide helpful wrapper functions for ioctls even if they're quite common (TIOCEXCLwould 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.