1POSIX_MEMALIGN(P) POSIX Programmer's Manual POSIX_MEMALIGN(P)
2
3
4
6 posix_memalign - aligned memory allocation (ADVANCED REALTIME)
7
9 #include <stdlib.h>
10
11 int posix_memalign(void **memptr, size_t alignment, size_t size);
12
13
15 The posix_memalign() function shall allocate size bytes aligned on a
16 boundary specified by alignment, and shall return a pointer to the
17 allocated memory in memptr. The value of alignment shall be a multiple
18 of sizeof( void *), that is also a power of two. Upon successful com‐
19 pletion, the value pointed to by memptr shall be a multiple of align‐
20 ment.
21
22 The free() function shall deallocate memory that has previously been
23 allocated by posix_memalign().
24
26 Upon successful completion, posix_memalign() shall return zero; other‐
27 wise, an error number shall be returned to indicate the error.
28
30 The posix_memalign() function shall fail if:
31
32 EINVAL The value of the alignment parameter is not a power of two mul‐
33 tiple of sizeof( void *).
34
35 ENOMEM There is insufficient memory available with the requested align‐
36 ment.
37
38
39 The following sections are informative.
40
42 None.
43
45 The posix_memalign() function is part of the Advisory Information
46 option and need not be provided on all implementations.
47
49 None.
50
52 None.
53
55 free() , malloc() , the Base Definitions volume of
56 IEEE Std 1003.1-2001, <stdlib.h>
57
59 Portions of this text are reprinted and reproduced in electronic form
60 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
61 -- Portable Operating System Interface (POSIX), The Open Group Base
62 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
63 Electrical and Electronics Engineers, Inc and The Open Group. In the
64 event of any discrepancy between this version and the original IEEE and
65 The Open Group Standard, the original IEEE and The Open Group Standard
66 is the referee document. The original Standard can be obtained online
67 at http://www.opengroup.org/unix/online.html .
68
69
70
71IEEE/The Open Group 2003 POSIX_MEMALIGN(P)