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