1 /* Memory allocation aligned to system page boundaries.
3 Copyright (C) 2005 Free Software Foundation, Inc.
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)
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.
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,
20 #ifndef _PAGEALIGN_ALLOC_H
21 # define _PAGEALIGN_ALLOC_H
25 /* Allocate a block of memory of SIZE bytes, aligned on a system page
27 If SIZE is not a multiple of the system page size, it will be rounded up
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
);
33 /* Like pagealign_alloc, except it exits the program if the allocation
35 extern void *pagealign_xalloc (size_t size
);
37 /* Free a memory block.
38 PTR must be a non-NULL pointer returned by pagealign_alloc or
40 extern void pagealign_free (void *ptr
);
42 #endif /* _PAGEALIGN_ALLOC_H */