[klibc] mmap and getpagesize

H. Peter Anvin hpa at zytor.com
Tue Jan 27 09:24:25 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.
> 

That's pretty insane... the PAGE_SIZE I'm concerned with is the mmap() 
granularity, which is an ABI issue.  It's pretty sick if it changes...

I obviously don't have an IA64 to try anything on.

So we should adjust that for the architectures where it matters.

	-hpa



More information about the klibc mailing list