2d63eb15f21100f540eef3aacc9b035122db1b36
[gnulib.git] / 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
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, or NULL if the allocation
30    failed.  */
31 extern void *pagealign_alloc (size_t size);
32
33 /* Free a memory block.
34    PTR must be a pointer returned by pagealign_alloc.  */
35 extern void pagealign_free (void *ptr);
36
37 #endif /* _PAGEALIGN_ALLOC_H */