GCC47: Add local modifications
[dragonfly.git] / contrib / cvs-1.12 / lib / pagealign_alloc.h
1 /* Memory allocation aligned to system page boundaries.
2
3    Copyright (C) 2005 Free Software Foundation, Inc.
4
5    This program is free software; you can redistribute it and/or modify it
6    under the terms of the GNU General Public License as published
7    by the Free Software Foundation; either version 2, or (at your option)
8    any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    General Public License for more details.
14
15    You should have received a copy of the GNU General Public
16    License along with this program; if not, write to the Free Software
17    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
18    USA.  */
19
20 #ifndef _PAGEALIGN_ALLOC_H
21 # define _PAGEALIGN_ALLOC_H
22
23 # include <stddef.h>
24
25 /* Allocate a block of memory of SIZE bytes, aligned on a system page
26    boundary.
27    If SIZE is not a multiple of the system page size, it will be rounded up
28    to the next multiple.
29    Return a pointer to the start of the memory block. Upon allocation failure,
30    return NULL and set errno.  */
31 extern void *pagealign_alloc (size_t size);
32
33 /* Like pagealign_alloc, except it exits the program if the allocation
34    fails.  */
35 extern void *pagealign_xalloc (size_t size);
36
37 /* Free a memory block.
38    PTR must be a non-NULL pointer returned by pagealign_alloc or
39    pagealign_xalloc.  */
40 extern void pagealign_free (void *ptr);
41
42 #endif /* _PAGEALIGN_ALLOC_H */