lkml.org 
[lkml]   [2006]   [Feb]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] compat: fix compat_sys_openat and friends


On Thu, 2 Feb 2006, Stephen Rothwell wrote:
>
> Most of the 64 bit architectures will zero extend the first argument to
> compat_sys_{openat,newfstatat,futimesat} which will fail if the 32 bit
> syscall was passed AT_FDCWD (which is a small negative number). Declare
> the first argument to be an unsigned int which will force the correct
> sign extension when the internal functions are called in each case.

Umm.

Wouldn't it be _much_ better to declare the argument as a "long", since
some architectures (alpha, for example) may assume that 32-bit arguments
have been _sign_extended, not zero-extended.

Then, when the "compat_sys_xxxx()" function passes the "long" down to the
_real_ function (which takes an "int"), those architectures (and only
those architectures) that actually have assumptions about high bits will
have the compiler automatically do the right zero- or sign-extensions at
that call-site.

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2009-11-18 23:46    [W:0.040 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site