[klibc] mmap and getpagesize

H. Peter Anvin hpa at zytor.com
Sat Jan 24 23:29:43 PST 2004

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.

It's sort-of OK.  I think klibc uses PAGE_SIZE as a compile-time 
constant.  I probably should implement getpagesize() as an inline 
returning PAGE_SIZE.


More information about the klibc mailing list