[klibc] mmap and getpagesize

H. Peter Anvin hpa at zytor.com
Tue Jan 27 17:44:23 PST 2004

Olaf Hering wrote:
>  On Sat, Jan 24, Jon Smirl wrote:
>>The man page for mmap() says the size needs to be a multiple of getpagesize().
>>So in my code I call getpagesize() and adjust my lengths accordingly. klibc
>>doesn't have getpagesize() implemented. Is it safe to call mmap() with arbritary
>>lengths and assume the mmap will round up for you? Does this work on glibc too?
>>If so, I can just eliminate my getpagesize() code.
> Why do you depend on PAGE_SIZE as a compiletime option? It does depend
> on the used kernel .config on some architectures, like ia64. Current
> klibc fails to compile because of that.

klibc-0.100 released with getpagesize() a system call if available.

I had to hard-code the syscall number for IA-64, since it's marked a
"legacy" system call and not exported in <asm/unistd.h>.


More information about the klibc mailing list