lint and ioctl parameter types (4.2 BSD)
Guido van Rossum
guido at mcvax.UUCP
Fri Apr 6 23:54:08 AEST 1984
I keep getting errors about inconsistent parameter usage for the second and
third parameter of ioctl when I run lint. It may give the discussion on
pointer sizes some new oil to burn, that's why I post to net.lang.c.
In reverse order of the ioctl arguments:
The type of the third argument to ioctl is indeed problematic (as the manual
already says). It can be a pointer to various structs, to long int or to
char. Lint insists that it is (char*).
QUESTION: on systems where this matters (i.e., where sizeof(char *) !=
sizeof(int *)), how does the system treat this? (I could imagine a kernel
expecting various pointer formats depending on the second parameter.)
The type of the second ioctl argument is a harmless int. I use the standard
constants from /usr/include/sys/ioctl.h: TIOCGETP, FIONREAD, etc. Lint
complaints about this! Looking at the definitions of these symbols, all I
can see is that they are a complicated mask constructed by oring together:
0x20000000 or 0x4000000 or 0x80000000, the size of the parameter type
shifted left 16 bits, a character shifted left 8 bits and some small
integer. How come lint doesn't recognize this as an int? What does it
think it is, then?!?
Any suggestions? (NO GUESSES PLEASE!)
--
Guido van Rossum, "Stamp Out Basic" Committee, CWI, Amsterdam
guido @ mcvax
More information about the Comp.lang.c
mailing list