[PATCH 4/5] Update linux/ioctlent.h.in file

Dmitry V. Levin ldv at altlinux.org
Mon Jan 19 01:08:44 UTC 2015


On Fri, Jan 16, 2015 at 03:57:59PM +0100, Gabriel Laskar wrote:
> On Fri, Jan 16, 2015 at 3:41 PM, Dmitry V. Levin wrote:
> > On Fri, Jan 16, 2015 at 09:49:19AM +0100, Gabriel Laskar wrote:
> >> On Fri, Jan 16, 2015 at 12:39 AM, Dmitry V. Levin wrote:
> > [...]
> >> > strace uses only 16 bits (8-bit number and 8-bit type) of the 32-bit ioctl
> >> > command, so the only real solution to this issue is to take into account
> >> > remaining 16 bits (size and direction).
> >> >
> >> > For example,
> >> > SNDCTL_TMR_TIMEBASE is _IOC(_IOC_READ|_IOC_WRITE, 'T', 1, sizeof(int)),
> >> > SNDRV_TIMER_IOCTL_NEXT_DEVICE is _IOC(_IOC_READ|_IOC_WRITE, 'T', 1, sizeof(struct snd_timer_id)),
> >> > TCGETS is architecture-specific, its generic value 0x5401 is _IOC(0, 'T', 1, 0).
> >> >
> >> > As you can see all these 32-bit values are different.
> >> > The only question is how to evaluate these remaining bits reliably, especially
> >> > 14 bits (or 13 on alpha, mips, powerpc, and sparc) of ioctl command size.
> >>
> >> Or we could do that, yes. I don't know why I have occulted this
> >> solution. I have missed the 14/13 bit snafu though.
> >>
> >> Maybe we can create 2 ioctlent.h.in files, 1 for the 14 bits size, and
> >> another one for the 13 bits one and compile the right one for each
> >> arch.
> >
> > If we succeeded to fetch the "size" bits, we could avoid these
> > architecture-specific complications by storing {dir,type,nr,size}
> > in ioctlent.h.in files apart, and assembling them into 32-bit words
> > at build time.
> > This way we won't need two different generic ioctlent.h.in files.
> >
> > We still have to support small architecture-specific ioctlent.h.in
> > files because some historic ioctl commands like TCGETS differ.
> 
> Seems good. I will give it a go.
> 
> Beside that issue that was already present without these patches, is
> there any comments on this serie ?

I've posted some comments.  In general, patches on .c files need some
fixes regardless of changes that are going to be applied to ioctlent.sh.

What should be done with ioctlent.sh is another story.  There is a quite
old part there that fetches old constants (whose definitions are static
and don't use macros defined in <asm-generic/ioctl.h>), that part is
likely to stay.  Another part of ioctlent.sh that tries to fetch
_IOC-based ioctl definitions is not capable of taking "size" bits into
account, there has to be another code based on different ideas.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20150119/cbc6466a/attachment.bin>


More information about the Strace-devel mailing list