[PATCH] strace: ioctl resolve fix for strace

Christian Bornträger cborntra at de.ibm.com
Thu Sep 30 06:12:03 UTC 2004


Hi Roland, 

Currently we are using only the lower 16bit of the ioctl code information in 
strace. As IOCTL numbers can be 32 bits wide, there are, unfortunately, some 
ambiguous ioctl numbers. Therefore, I suggest the following patch to enable 
strace to get the right ioctl names for ioctls that share the lower 16 bits. 
numbers. 

cheers

Christian


diff -urp strace-4.5.7/ioctl.c new/ioctl.c
--- strace-4.5.7/ioctl.c 2004-07-12 09:44:08.000000000 +0200
+++ new/ioctl.c 2004-09-30 14:44:01.557806440 +0200
@@ -86,7 +86,10 @@ long code;
 
  ioent.code = code;
 #ifdef LINUX
- ioent.code &= (_IOC_NRMASK<<_IOC_NRSHIFT) | (_IOC_TYPEMASK<<_IOC_TYPESHIFT);
+ ioent.code &= (_IOC_NRMASK<<_IOC_NRSHIFT)
+   | (_IOC_TYPEMASK<<_IOC_TYPESHIFT)
+   | (_IOC_SIZEMASK<<_IOC_SIZESHIFT)
+   | (_IOC_DIRMASK<<_IOC_DIRSHIFT);
 #endif
  iop = (struct ioctlent *) bsearch((char *) &ioent, (char *) ioctlent,
    nioctlents, sizeof(struct ioctlent), compare);





More information about the Strace-devel mailing list