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