This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: kernel header usage fix needed on ppc
- To: howarth at bromo dot med dot uc dot edu
- Subject: Re: kernel header usage fix needed on ppc
- From: Geoff Keating <geoffk at cygnus dot com>
- Date: Sat, 21 Oct 2000 14:20:01 -0700
- CC: Franz dot Sirl-kernel at lauterbach dot com, drepper at redhat dot com, libc-alpha at sources dot redhat dot com
- References: <200010211917.MAA93537@bromo.med.uc.edu>
> Date: Sat, 21 Oct 2000 12:17:00 -0700 (PDT)
> From: Jack Howarth <howarth@bromo.med.uc.edu>
>
> Hi,
> As I said before, Paul Mackerras <paulus@linuxcare.com>, has decided
> to wrap the asm-ppc kernel headers in Linux 2.4 tightly with an
> #ifdef __KERNEL__/#endif /* __KERNEL__ */ wrapper. This is because
> we have been told that all kernel header usage by userland should be
> considered as breakage. That being the case, I have found that glibc
> 2.1.95 has a build problem on linuxppc against these new strict kernel
> headers. The file sysdeps/unix/sysv/linux/powerpc/mmap64.c has
> asm/page.h included which now under the current bitkeeper linuxppc_2_3
> tree no longer provides the needed declarations. I have managed to build
> glibc 2.1.95 with the following patch...
>
> --- glibc-2.1.95/sysdeps/unix/sysv/linux/powerpc/mmap64.c Tue Sep 19 12:55:38 2000
> +++ glibc-2.1.95.new/sysdeps/unix/sysv/linux/powerpc/mmap64.c Sat Oct 21 14:15:55 2000
> @@ -25,8 +25,12 @@
> #include <sys/syscall.h>
> #include <bp-checks.h>
>
> -#include <asm/page.h>
> #include "kernel-features.h"
> +
> +/* PAGE_SHIFT determines the page size */
> +#define PAGE_SHIFT 12
> +#define PAGE_SIZE (1UL << PAGE_SHIFT)
> +#define PAGE_MASK (~(PAGE_SIZE-1))
>
> #ifdef __NR_mmap2
> extern void *__unbounded __syscall_mmap2(void *__unbounded, size_t,
>
> ...It is unclear to me if we can do this in a better way using
> getpagesize to calculate this stuff as in this test program...
I think that getpagesize() is wrong here, and in fact using
<asm/page.h> is wrong too. It's not really the page size, it's
the constant 12; if the page size changed, it would still be 12.
So this patch is OK. I've put it in my tree and will commit it after testing.
--
- Geoffrey Keating <geoffk@cygnus.com>