1 /* Allocate memory on a page boundary.
2 Copyright (C) 1991 Free Software Foundation, Inc. */
4 /* Copyright (c) 2010. The SimGrid Team.
5 * All rights reserved. */
7 /* This program is free software; you can redistribute it and/or modify it
8 * under the terms of the license (GNU LGPL) which comes with this package. */
11 #include "mmprivate.h"
14 /* Cache the pagesize for the current host machine. Note that if the host
15 does not readily provide a getpagesize() function, we need to emulate it
16 elsewhere, not clutter up this file with lots of kluges to try to figure
19 static size_t cache_pagesize;
20 #if NEED_DECLARATION_GETPAGESIZE
21 extern int getpagesize PARAMS((void));
24 void *mvalloc(void *md, size_t size)
26 if (cache_pagesize == 0) {
27 cache_pagesize = getpagesize();
30 return (mmemalign(md, cache_pagesize, size));
33 /* Useless prototype to make gcc happy */
34 void *valloc(size_t size);
36 void *valloc(size_t size)
38 return mvalloc(NULL, size);