Re: From Eric Anholt:

From: Egbert Eich
Date: Thu May 13 2004 - 11:56:36 EST

Linus Torvalds writes:
> On Wed, 12 May 2004, Dave Airlie wrote:
> >
> > I just looked at drm.h and nearly all the ioctls use int, this file is
> > included in user-space applications also at the moment, I'm worried
> > changing all ints to __u32 will break some of these, anyone on DRI list
> > care to comment?
> Right now, all architectures have "int" being 32-bit, so nothing should
> break. Apart from sign issues, of course.
> If there are pointers and "long", then those should just not exist. Never
> expose kernel pointers to user mode (and you really never should pass user
> pointers back), and "long" should really just be "__u32" instead (since
> that is what it is on a 32-bit platform - and if it works there, then it
> should work on a 64-bit platform too).

Unfortunately this is done in some places in DRM. Pointers are used as a
simple 'handle' to point to areas that are to be mapped by mmap()
from user mode.
I've done some ioctl32() interfaces for DRM for a few drivers (mga,
radeon, r128) to make 32bit software work on 64bit systems such as AMD64.
In most cases it was easy to work around the longs as they either did
not have to exist at all or could be replaced by something that's
platform independent.
I have plans to submit these ioctl32() interfaces to Mesa when I get
around to do it.
Anyway they are unnecessary kludges which should have been avoided
from the beginning.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at