According to folks on libc-alpha any program that accesses kernel headers (asm) in userland are broken and should be fixed. Our maintainer for Linux 2.4 (Paul Mackerras <paulus>) has wrapped all of our asm-ppc kernel headers in #ifdef __KERNEL__/#endif wrappers to prevent userland programs from accessing their contents. This has revealed that procps is broken in that it repeatedly access PAGE_SIZE and PAGE_SHIFT from asm/page.h. On linuxppc, we believe the following test program demonstrates that these values can be obtained for procps without resorting to the current broken behavior of accessing kernel headers... ---------------------------------------------------------- #include <stdio.h> #include <sys/shm.h> #define PAGE_SHIFT 12 #define PAGE_SIZE (1UL << PAGE_SHIFT) int i,pagesize,pageshift; main() { pagesize=__getpagesize(); for(i=1; i <= 8*sizeof(int); i++) { if( pagesize & (1UL << i)) { pageshift += i; } } printf("pagesize is %d\n",pagesize); printf("pagesize is %d\n",PAGE_SIZE); printf("pageshift is %d\n",pageshift); printf("pageshift is %d\n",PAGE_SHIFT); --------------------------------------------- This code works fine on Linuxppc running glibc 2.1.95/Linux 2.4-testpre3 /gcc 2.95.3. Below is the output I get from it here... pagesize is 4096 pagesize is 4096 pageshift is 12 pageshift is 12 Please fix procps in rawhide so we can test the fixed version before Linux 2.4 is released.
but, you have redefined these internal kernel constants. How can you be sure they won't change? I believe that procps needs to intrinsically depend on the kernel headers. Michael?
the assumption that userspace programs shouldn't access kernel constants and data structures is a good general rule, but it doesn't _always_ apply. procps is a case where it doesn't.