Sun keyboard driver?

Doug Gwyn <gwyn> gwyn at brl-tgr.ARPA
Wed Mar 13 03:36:52 AEST 1985


> 	#define KIOCSETKEY _IOW(k, 1, struct kiockey)

This is a macro Berkeley introduced that evaluates to the (int)
ioctl code (second argument to ioctl(2)) for ioctl functions that
involve sending data from user process space into the kernel.
The macro is defined in /usr/include/sys/ioctl.h.  Unfortunately,
they are making use of a Reiser C preprocessor trick to take the
"k" and make a character constant 'k' out of it (then combine that
with the constant "1" and the sizeof(struct kiockey)).  If you are
having trouble, first check that you're #including <sys/ioctl.h>.

One objection I have to the _IOWR macros is that not every ioctl
fits this model.  There are some "xt" driver ioctls for which the
sizeof the transfered data simply does not fit the alloted space.



More information about the Comp.unix.wizards mailing list