Questions about ioctl entries

Eugene Syromyatnikov evgsyr at
Tue Apr 2 16:35:28 UTC 2019

On Tue, Apr 2, 2019 at 6:16 PM Zhibin Li <haoyouab at> wrote:
> Hi,
> I'm trying to figure out how those ioctl decoders actually work. I
> found that ioctl entries in strace are always updated according to
> linux kernel's updates and I wonder how we can make the decoders
> compatible when we are on an OS with older kernel headers.
> I've been recently doing research about DRM ioctl and I saw those
> related structures are updated frequently. For example,
> 'struct drm_mode_get_connector' had been added a u32 padding in linux
> v3.12 so in /strace/linux/32/ioctls_inc_aligned32.h the size of it was
> updated to 0x50. But when the kernel headers are bit older, the size of
> this struct is 0x4c. In this case it seems the decoder will not work as
> expected because the output will be something like:
> 'ioctl(-1, _IOC(_IOC_READ|_IOC_WRITE, 0x64, 0xa7, 0x4c), NULL) = -1 EBADF (Bad file descriptor)'
> because according to /strace/linux/32/ioctls_inc_aligned32.h it's a
> 80-byte struct. Is there any commonly acceptable way to avoid/resolve
> this? Or any materials I can refer to?

DRM ioctls are generally forward/backward compatible in respect to
structure size changes, since this is generally handled in the common
DRM code. On the strace's part, a solution similar to the evdev ioctl
names handling is likely have to be implemented (with correction for
the lack of respective macros for arbitrary structure size, so,
something like "DRM_IOWR(0xa7, 0x4c) /* DRM_IOCTL_MODE_GETCONNECTOR
*/" will probably be ought to be printed).

> Thanks,
> Zhibin Li
> --
> Strace-devel mailing list
> Strace-devel at

Eugene Syromyatnikov
mailto:evgsyr at
xmpp:esyr at jabber.{ru|org}

More information about the Strace-devel mailing list