This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
pageshift?
- To: drepper at redhat dot com, libc-alpha at sources dot redhat dot com
- Subject: pageshift?
- From: Jack Howarth <howarth at bromo dot med dot uc dot edu>
- Date: Sat, 21 Oct 2000 09:20:07 -0700 (PDT)
Hi,
On ppc our maintainer Paul Mackerras <paulus@linuxcare.com>
for Linux 2.4 has decided to place tight wrappers around our
asm-ppc kernel headers of the form...
#ifdef __KERNEL__
#endif /* __KERNEL__ */
While the breakage of userland programs incorrectly using
kernel headers isn't as bad as I feared, I have found that
procps from Redhat 7.0 has a sprinkling of PAGE_SIZE and
PAGE_SHIFT obtained from asm/page.h.
I believe they should be able to get PAGE_SIZE from
the _getpagesize() call declared in sys/shm.h however I am
unclear how to back calculate PAGE_SHIFT. The asm/page.h header
contains...
#define PAGE_SHIFT 12
#define PAGE_SIZE (1UL << PAGE_SHIFT)
...and since PAGE_SHIFT can calculate PAGE_SIZE I assume I can do
the inverse. Below is the test code I have written so far...
-----------------------------------------
#include <stdio.h>
#include <sys/shm.h>
#define PAGE_SHIFT 12
#define PAGE_SIZE (1UL << PAGE_SHIFT)
int pagesize;
main()
{
pagesize=__getpagesize();
printf("pagesize is %d\n",pagesize);
printf("pagesize is %d\n",PAGE_SIZE);
}
---------------------------------------------
I am also concerned if I have to pass a parameter to __getpagesize or
if my approach of passing no parameters is valid.
Thanks in advance for any help.
Jack Howarth