Linux – Dynamically register IOCTLs

Dynamically register IOCTLs… here is a solution to the problem.

Dynamically register IOCTLs

When using IOCTL, can we use dynamic registration for device drivers?

Solution

You do not need major numbers to define ioctl, they are not relevant.

What you need is a (somewhat) unique (or at least not built-in) number or letter to identify your IOCTL range. These can be optionally registered (registered in Documentation/ioctl/ioctl-number.txt , in which there are also instructions for use) to prevent (or at least reduce) the possibility that others will also use it.

I highly recommend reading the documentation in any case, as it explains common conventions and usages.

Related Problems and Solutions