X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ffbfdb3354cedfee2d8d6f3831ab04634bc004bd..566c37eac6ea944bcbee63778f267c64677f4ee9:/src/xbt/mmalloc/mmemalign.c diff --git a/src/xbt/mmalloc/mmemalign.c b/src/xbt/mmalloc/mmemalign.c index 5c7fb24cdd..93ca53a2da 100644 --- a/src/xbt/mmalloc/mmemalign.c +++ b/src/xbt/mmalloc/mmemalign.c @@ -39,3 +39,19 @@ void *mmemalign(xbt_mheap_t mdp, size_t alignment, size_t size) } return (result); } + +/* Cache the pagesize for the current host machine. Note that if the host + does not readily provide a getpagesize() function, we need to emulate it + elsewhere, not clutter up this file with lots of kluges to try to figure + it out. */ +static size_t cache_pagesize; + +void *mvalloc(xbt_mheap_t mdp, size_t size) +{ + if (cache_pagesize == 0) { + cache_pagesize = getpagesize(); + } + + return (mmemalign(mdp, cache_pagesize, size)); +} +