s390/s390x ioctls

Dmitry V. Levin ldv at altlinux.org
Fri Feb 25 23:24:32 UTC 2011


On Tue, Feb 22, 2011 at 01:00:05PM -0500, Mike Frysinger wrote:
> On Tuesday, February 22, 2011 05:19:08 Heiko Carstens wrote:
> > On Sun, Feb 20, 2011 at 04:04:21PM -0500, Mike Frysinger wrote:
> > > anyone know what's going on with the s390 ioctls in ioctlent.h that are 8
> > > hex digits long instead of the normal 4 ?  they date back to the
> > > original port (done in 2002).  seems like garbage that can be thrown
> > > away ...
> > 
> > The more interesting question would be why the strace ioctl code seems to
> > ignore a couple of bits of the ioctl commands. In particular it seems to
> > ignore the direction and size bits.
> 
> so, for practical purposes today, the extra ioctls in the s390 headers are not 
> necessary and may safely be punted.  i'm trying to unify all the duplicated 
> ioctlent content and this was the only hold out.

And, btw, ioctlsort on ppc is broken due to an outdated kludge.
I suppose this patch will clean these high bits properly:

diff --git a/linux/ioctlsort.c b/linux/ioctlsort.c
index afdcc5f..14e7ddc 100644
--- a/linux/ioctlsort.c
+++ b/linux/ioctlsort.c
@@ -35,10 +35,10 @@ int compare(const void* a, const void* b) {
 int main(int argc, char** argv) {
 	int i;
 
-#if defined(POWERPC) || defined(__powerpc__)			/* unspeakable kludge */
+	/* ioctl_lookup() only looks at the number and type bits atm. */
 	for (i = 0; i < nioctls; i++)
-		ioctls[i].code &= ~_IOC_DIRMASK;
-#endif
+		ioctls[i].code &= (_IOC_NRMASK << _IOC_NRSHIFT) |
+				  (_IOC_TYPEMASK << _IOC_TYPESHIFT);
 
 	qsort(ioctls, nioctls, sizeof(ioctls[0]), compare);
 	puts ("\t/* Generated by ioctlsort */");


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


More information about the Strace-devel mailing list