qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] ioctl() numbers are unsigned (the man page lies


From: David Gibson
Subject: Re: [Qemu-devel] [PATCH] ioctl() numbers are unsigned (the man page lies)
Date: Fri, 10 Feb 2012 17:45:13 +1100
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Feb 09, 2012 at 03:11:13PM +0100, Jan Kiszka wrote:
> On 2012-02-09 13:07, Paul Brook wrote:
> >>>> What about naming the problem instead:
> >>>>
> >>>> /* Comparison with IOCTL macros on 32-bit hosts requires unsigned. */
> >>>
> >>> Just once, it would be nice to post something to this list and get a
> >>> substantive comment _before_ the bitching about minutiae.
> >>>
> >>> Oh, and it's not just 32-bit hosts, it's anywhere sizeof(int)==4,
> >>> which includes ppc64 amongst other 64-bit hosts.
> >>
> >> Then state "if int is 32 bits". The comment is unfortunately not helpful
> >> without the commit log.
> > 
> > Int is 32 bits on every host we're ever likey to care about, so clearly 
> > there's something else going on.
> 
> Yep. So a better explanation could be "Required for comparison with
> unsigned IOCTL macro values". This wasn't noticed so far as the original
> code was never build on anything but IA32/64.

Right.  The problem still exists on x86 and x86_64, but it occurs for
a different set of ioctls (IOC_READ instead of IOC_WRITE).  I guess we
never did this sort of signed comparison on an IOC_WRITE ioctl number
(comparing ioctl numbers for equality isn't a particularly obvious
thing to do from userspace, after all).

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]