2000-02-26 Mark Kettenis <kettenis@gnu.org>
[deliverable/binutils-gdb.git] / mmalloc / mvalloc.c
CommitLineData
c906108c
SS
1/* Allocate memory on a page boundary.
2 Copyright (C) 1991 Free Software Foundation, Inc.
3
4The GNU C Library is free software; you can redistribute it and/or
5modify it under the terms of the GNU Library General Public License as
6published by the Free Software Foundation; either version 2 of the
7License, or (at your option) any later version.
8
9The GNU C Library is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12Library General Public License for more details.
13
14You should have received a copy of the GNU Library General Public
15License along with the GNU C Library; see the file COPYING.LIB. If
16not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17Boston, MA 02111-1307, USA. */
18
19#include "mmprivate.h"
20
21/* Cache the pagesize for the current host machine. Note that if the host
22 does not readily provide a getpagesize() function, we need to emulate it
23 elsewhere, not clutter up this file with lots of kluges to try to figure
24 it out. */
25
26static size_t cache_pagesize;
ff4e7bb2 27#if NEED_DECLARATION_GETPAGESIZE
c906108c 28extern int getpagesize PARAMS ((void));
ff4e7bb2 29#endif
c906108c
SS
30
31PTR
32mvalloc (md, size)
33 PTR md;
34 size_t size;
35{
36 if (cache_pagesize == 0)
37 {
38 cache_pagesize = getpagesize ();
39 }
40
41 return (mmemalign (md, cache_pagesize, size));
42}
43
44
45PTR
46valloc (size)
47 size_t size;
48{
49 return mvalloc ((PTR) NULL, size);
50}
This page took 0.039653 seconds and 4 git commands to generate.