1 /* Allocate memory on a page boundary.
2    Copyright (C) 1991, 1992 Free Software Foundation, Inc.
3 
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
8 
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 Library General Public License for more details.
13 
14 You should have received a copy of the GNU Library General Public
15 License along with this library; see the file COPYING.LIB.  If
16 not, see <http://www.gnu.org/licenses/>.
17 
18    The author may be reached (Email) at the address mike@@ai.mit.edu,
19    or (US mail) as Mike Haertel c/o Free Software Foundation.  */
20 
21 #include <stdlib.h>
22 #include <unistd.h>
23 #include <malloc.h>
24 
25 
26 static size_t pagesize;
27 
valloc(size_t size)28 __ptr_t valloc (size_t size)
29 {
30 	if (pagesize == 0)
31 		pagesize = getpagesize ();
32 
33 	return memalign(pagesize, size);
34 }
35