]>
Commit | Line | Data |
---|---|---|
4d810f5f SH |
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 | |
266bdc1f | 16 | not, see <http://www.gnu.org/licenses/>. |
4d810f5f SH |
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> | |
9613b659 | 22 | #include <unistd.h> |
742b3c93 | 23 | #include <malloc.h> |
4d810f5f | 24 | |
af017216 | 25 | |
4d810f5f SH |
26 | static size_t pagesize; |
27 | ||
28 | __ptr_t valloc (size_t size) | |
29 | { | |
30 | if (pagesize == 0) | |
9613b659 | 31 | pagesize = getpagesize (); |
4d810f5f | 32 | |
9613b659 | 33 | return memalign(pagesize, size); |
4d810f5f | 34 | } |