On 01/26/2012 08:49 AM, David Henningsson wrote:
> In the call to POST(sys_ioctl), ARG2 is a 64 bit value, which for every 
> call except mine had the upper 32 bits set to zero. For my particular 
> call, ARG2 was set to 0xFFFFFFFFC008551A, so it would not match my ioctl 
> of C008551A in the following giant switch/case.
> Before I submit a patch for SNDRV_CTL_IOCTL_TLV_READ, I assume this 
> needs to be generically resolved somehow?

"man 2 ioctl" says that the type of the second parameter is 'int',
and thus signed:
       int ioctl(int d, int request, ...);
Yet <sys/ioctl.h> says:
        extern int ioctl (int __fd, unsigned long int __request, ...) __THROW;

Nearly always ARG2 is interpreted as bit fields, which are much better unsigned.
Also, an actual function prototype in <sys/ioctl.h> trumps documentation
in "man ioctl".  Historically the actual interpretation of the second parameter
is "unsigned 32-bit integer".  The "unsigned long" of <sys/ioctl.h>
is a hang-over from the days when 'int' was 16 bits.

However, somewhere the inconsistency affected the conversion of 'request'
from 32 to 64 bits.  It's a bug which can be tedious to find.

-- 

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to