kernel ioctl aggregator script, might be generally useful
Chris Torek
torek at torek.net
Mon Dec 5 23:43:13 UTC 2016
I wrote a little Python script to let me view existing kernel
_IO*(group, number, type) ioctls. Here's a sample of the kind
of data it prints:
group 'F':
0: _IOR('F', 0, struct fbtype) sys/fbio.h:106
2: _IOR('F', 2, struct fbinfo) sys/fbio.h:178
3: _IOW('F', 3, struct fbcmap) sys/fbio.h:191
4: _IOW('F', 4, struct fbcmap) sys/fbio.h:192
5: _IOW('F', 5, struct fbsattr) sys/fbio.h:216
6: _IOR('F', 6, struct fbgattr) sys/fbio.h:217
[snip]
group 'I':
0: _IOWR('I', 0, struct iodev_pio_req) dev/io/iodev.h:42
1: _IOR('I', 1, struct iscsi_daemon_request) dev/iscsi/iscsi_ioctl.h:125
_IOR('I', 1, struct autofs_daemon_request) fs/autofs/autofs_ioctl.h:112
_IOWR('I', 1, struct iodev_efivar_req) ia64/include/iodev.h:53
2: _IOW('I', 2, struct iscsi_daemon_handoff) dev/iscsi/iscsi_ioctl.h:126
_IOW('I', 2, struct autofs_daemon_done_101) fs/autofs/autofs_ioctl.h:113
3: _IOW('I', 3, struct iscsi_daemon_fail) dev/iscsi/iscsi_ioctl.h:127
_IOW('I', 3, struct autofs_daemon_done) fs/autofs/autofs_ioctl.h:114
4: _IOWR('I', 4, struct iscsi_daemon_connect) dev/iscsi/iscsi_ioctl.h:179
[snip]
which lets us see that there are overlapping uses of some of the
group-'I' ioctls (overlapping uses are OK as long as they don't
really collide, of course, this just lets you check for potential
issues). (Also it does not know about #ifdef so it finds things
like these:
group r:
60: _IOW(r, 60, struct ipfobj) contrib/ipfilter/netinet/ip_fil.h:88
which is inside the "#else" part of a __STDC__ ifdef.)
Anyway, if anyone wants it for whatever purpose, I put it up
for public access at https://github.com/chris3torek/scripts
(https://raw.githubusercontent.com/chris3torek/scripts/master/sysioctl.py)
Chris
More information about the freebsd-hackers
mailing list