int-long confusion in some ioctls

Michael Elizabeth Chastain (mec@duracef.shout.net)
Wed, 13 Nov 1996 07:39:51 -0600


Hello Hackers,

I've found a handful of ioctl calls that write an either an int or a
long into the calling process's address space, depending on which driver
implements the ioctl.

For example, TIOCOUTQ usually has this interface:

int i;
ioctl( fd, TIOCOUTQ, &i );

But some drivers implement this interface:

long l;
ioctl( fd, TIOCOUTQ, &l );

This is harmless on i386 but I think it will cause problems on the alpha
and other 64-bit architectures.

The ioctls are:

TIOCOUTQ TIOCINQ
TIOCMGET TIOCMBIS TIOCMBIC TIOCMSET
TIOCGSOFTCAR TIOCSSOFTCAR TIOCSERGETLSR
BLKGETSIZE BLKRAGET

Two questions:

(1) Is my analysis correct, that this really will cause problems
in 64-bit Linux?

(2) Have these ioctls been standardized somewhere, so that I can
tell whether 'int *' or 'long *' is the right type for each one?

Michael Chastain
mec@shout.net