Re: procedure for creating new ioctl?

From: Andreas Dilger (
Date: Mon Jun 10 2002 - 14:56:10 EST

On Jun 10, 2002 14:17 -0400, Richard B. Johnson wrote:
> I use SIOCDEVPRIVATE as the starting value for new ioctls:
> /*
> * Interface to the private device functions. User API sees this only.
> */
> I've seen this in several drivers. I think this is the way to do it
> so there is no interference with other ioctls.

Of course there is. That means that a program accidentally running on
the wrong device will get completely unexpected results because the
ioctl numbers will all be some value above SIOCDEVPRIVATE.

Since each of the drivers have (mostly) their own private ioctl handling,
there is less of an issue of actual ioctl number conflicts as there
is an issue that ioctl numbers should be globally unique to avoid
accidental side effects when running on an incorrect device.

Besides which, SIOCDEVPRIVATE is supposed to be for socket (networking)
ioctls and not just random ioctl values. The comment above it also
indicates this value is deprecated...

Cheers, Andreas

Andreas Dilger

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

This archive was generated by hypermail 2b29 : Sat Jun 15 2002 - 22:00:19 EST