ioctl begins to work

This commit is contained in:
Ciro Santilli
2017-06-11 22:33:01 +01:00
parent bf538cd3a6
commit 025ba63a57
4 changed files with 38 additions and 2 deletions

View File

@@ -1,5 +1,20 @@
/*
Give integer and a pointer to the kernel, and get one positive integer out.
Feels like an archaic API... so many weird restrictions for something that could be so simple!
TODO: must the ioctl numbers be globally unique? How to ensure that?
Ioctl is super picky about the ioctl numbers, it is very annoying: https://stackoverflow.com/questions/10071296/ioctl-is-not-called-if-cmd-2
See how do_vfs_ioctl highjacks several values. This "forces" use to use the _IOx macros...
Documentation/ioctl/ioctl-number.txt has some info:
_IO an ioctl with no parameters
_IOW an ioctl with write parameters (copy_from_user)
_IOR an ioctl with read parameters (copy_to_user)
_IOWR an ioctl with both write and read parameters.
*/
#include <linux/debugfs.h>