This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [WIP] BZ #14361: POSIX vs. BSD and the `ioctl' interface.
- From: Chris Metcalf <cmetcalf at tilera dot com>
- To: Roland McGrath <roland at hack dot frob dot com>
- Cc: Carlos O'Donell <carlos_odonell at mentor dot com>, libc-alpha<libc-alpha at sourceware dot org>, "Joseph S. Myers" <joseph at codesourcery dot com>
- Date: Wed, 25 Jul 2012 19:48:55 -0400
- Subject: Re: [WIP] BZ #14361: POSIX vs. BSD and the `ioctl' interface.
- References: <500E1CA6.7050607@mentor.com> <20120725213923.21E442C0F6@topped-with-meat.com>
On 7/25/2012 5:39 PM, Roland McGrath wrote:
> The tilegx and mipsn64 code to explicitly sign-extend seems
> misguided to me. As Linus said in bugzilla, Linux always treats it
> as a 32-bit quantity so it really should not care at all whether it
> was sign-extended to 64 bits or not.
The problem is that for kernels not configured with HAVE_SYSCALL_WRAPPERS,
calling ioctl() with a value that has bit 31 set will result in a value
that does not compare equal within the kernel: the passed-in value will
have zero high bits (since the ioctl argument was prototyped as a long) but
the kernel constant that the comparison is done against will be
sign-extended (since it's prototyped as an int). So the comparison fails.
This is true for both tilegx and mipsn64 as far as I know.
--
Chris Metcalf, Tilera Corp.
http://www.tilera.com