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));
25 mvalloc (void *md, size_t size)
27 if (cache_pagesize == 0)
29 cache_pagesize = getpagesize ();
32 return (mmemalign (md, cache_pagesize, size));
35 /* Useless prototype to make gcc happy */
36 void* valloc (size_t size);
38 void* valloc (size_t size) {
39 return mvalloc (NULL, size);