Mercurial > hg > octave-nkf > gnulib-hg
annotate lib/pagealign_alloc.h @ 6912:314715e0260d
Merge from coreutils.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Mon, 03 Jul 2006 08:32:46 +0000 |
parents | a48fb0e98c8c |
children | bbbbbf4cd1c5 |
rev | line source |
---|---|
5673 | 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 | |
5848
a48fb0e98c8c
*** empty log message ***
Paul Eggert <eggert@cs.ucla.edu>
parents:
5678
diff
changeset
|
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
5673 | 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. | |
5678
6868adf039ec
Note pagealign_alloc() sets errno on failure.
Bruno Haible <bruno@clisp.org>
parents:
5675
diff
changeset
|
29 Return a pointer to the start of the memory block. Upon allocation failure, |
6868adf039ec
Note pagealign_alloc() sets errno on failure.
Bruno Haible <bruno@clisp.org>
parents:
5675
diff
changeset
|
30 return NULL and set errno. */ |
5673 | 31 extern void *pagealign_alloc (size_t size); |
32 | |
5675
9fb0004d9fa6
Check or don't check for allocation failure? Provide both alternatives.
Bruno Haible <bruno@clisp.org>
parents:
5673
diff
changeset
|
33 /* Like pagealign_alloc, except it exits the program if the allocation |
9fb0004d9fa6
Check or don't check for allocation failure? Provide both alternatives.
Bruno Haible <bruno@clisp.org>
parents:
5673
diff
changeset
|
34 fails. */ |
9fb0004d9fa6
Check or don't check for allocation failure? Provide both alternatives.
Bruno Haible <bruno@clisp.org>
parents:
5673
diff
changeset
|
35 extern void *pagealign_xalloc (size_t size); |
9fb0004d9fa6
Check or don't check for allocation failure? Provide both alternatives.
Bruno Haible <bruno@clisp.org>
parents:
5673
diff
changeset
|
36 |
5673 | 37 /* Free a memory block. |
5675
9fb0004d9fa6
Check or don't check for allocation failure? Provide both alternatives.
Bruno Haible <bruno@clisp.org>
parents:
5673
diff
changeset
|
38 PTR must be a non-NULL pointer returned by pagealign_alloc or |
9fb0004d9fa6
Check or don't check for allocation failure? Provide both alternatives.
Bruno Haible <bruno@clisp.org>
parents:
5673
diff
changeset
|
39 pagealign_xalloc. */ |
5673 | 40 extern void pagealign_free (void *ptr); |
41 | |
42 #endif /* _PAGEALIGN_ALLOC_H */ |