[SCM] strace branch, master, updated. v4.7-98-g1ba8543

Denys Vlasenko dvlasenk at redhat.com
Tue Mar 5 14:49:28 UTC 2013


On 03/05/2013 03:19 PM, Chris Metcalf wrote:
>>>> +#include <sys/user.h>	/* for PAGE_SHIFT */
>>>>  #if defined(SH64)
>>>> -# include <asm/page.h>	    /* for PAGE_SHIFT */
>>>> +# include <asm/page.h>	/* for PAGE_SHIFT */
>>>> +#endif
>>>> +#if !defined(PAGE_SHIFT)
>>>> +# warning Failed to get PAGE_SHIFT, assuming 12
>>>> +# define PAGE_SHIFT 12
>>>>  #endif
>>> In glibc, sys/user.h is notoriously incomplete header file containing a
>>> nice comment that "The whole purpose of this file is for GDB and GDB
>>> only".  In particular, on most of architectures it doesn't define
>>> PAGE_SHIFT, and on some architectures PAGE_SHIFT is greater that 12.
>>> I think we should not rely on <sys/user.h>.  The natural source of
>>> PAGE_SHIFT definition seems to be <asm/page.h>; we can either include it
>>> directly, or, if there is a risk of namespace collisions, fetch PAGE_SHIFT
>>> during configure stage.
>> It looks like <asm/page.h> is not usually installed, so another reliable
>> method is needed.
> 
> You need to do it at runtime in general, since it's possible to boot some
> architectures and choose the page size with kernel boot arguments
> (or kernel build-time configure options).  Just multiply by getpagesize()
> instead of shifting by PAGE_SHIFT.

Are there guarantees that getpagesize() is the _kernel's_ page size,
such as: it isn't affected by compat layer?





More information about the Strace-devel mailing list