[ 1790625 ] asm/page.h is unportable
Status: Alpha
Brought to you by:
coroberti
From: Gregor R. <set...@fr...> - 2007-09-09 10:41:36
|
Sorry that I didn't report this the way I was supposed to. I generally prefer filing bugs through a bug tracking system, and since I'm subscribed to so many mailing lists already, I'm a bit reluctant to add more. But I'll gladly provide more information, since this was an issue that could pop up for other users in the future. Here's the proper report: CURL-LOADER VERSION: 0.42, released September 5, 2007 HW DETAILS: Dual Pentium III 1GHz, 1.5GB RAM, Software-RAID5 with 4 SCSI disks LINUX DISTRIBUTION and KERNEL (uname -r): 2.6.21-gentoo-r1 GCC VERSION (gcc -v): gcc version 3.4.6 (Gentoo 3.4.6-r2, ssp-3.4.6-1.0, pie-8.7.10) GLIBC VERSION: 2.5 (gentoo-r4) DOES THE PROBLEM AFFECT: COMPILATION? Yes LINKING? No EXECUTION? No OTHER (please specify)? Portability DESCRIPTION: The source file mpool.c contains a bit of unportable code, that doesn't build on GNU/Linux systems with recent glibc versions and UNIX systems other than Linux (*BSD, Mac OS X, ...): #include <asm/page.h> #if !defined PAGE_SIZE #define PAGE_SIZE 4096 #endif glibc 2.5 (and 2.4 too I think) do not duplicate or symlink the headers of the live Linux kernel, but use a compatible subset instead, which does not contain asm/page.h. The portable (POSIX) way to get the page size is: #include <unistd.h> sysconf(_SC_PAGESIZE) Plus there is also the legacy getpagesize(), which should work on even more UNIX platforms. QUESTION/ SUGGESTION/ PATCH: Change the fragment above to: #include <unistd.h> #define PAGE_SIZE (getpagesize()) Thank you for fixing this! Gregor |