This is gnu lib malloc from NetBSD verbatium, here is the version info
[unix-history] / gnu / lib / libmalloc / valloc.c
CommitLineData
ba0dcd80
RG
1/* Allocate memory on a page boundary.
2 Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
3
4This 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
9This 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 this library; see the file COPYING.LIB. If
16not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17Cambridge, MA 02139, USA.
18
19 The author may be reached (Email) at the address mike@ai.mit.edu,
20 or (US mail) as Mike Haertel c/o Free Software Foundation. */
21
22#ifndef _MALLOC_INTERNAL
23#define _MALLOC_INTERNAL
24#include <malloc.h>
25#endif
26
27#ifdef __GNU_LIBRARY__
28extern size_t __getpagesize __P ((void));
29#else
30#include "getpagesize.h"
31#define __getpagesize() getpagesize()
32#endif
33
34static size_t pagesize;
35
36__ptr_t
37valloc (size)
38 size_t size;
39{
40 if (pagesize == 0)
41 pagesize = __getpagesize ();
42
43 return memalign (pagesize, size);
44}