1POSIX_MEMALIGN(3P)         POSIX Programmer's Manual        POSIX_MEMALIGN(3P)
2
3
4

PROLOG

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
11

NAME

13       posix_memalign — aligned memory allocation (ADVANCED REALTIME)
14

SYNOPSIS

16       #include <stdlib.h>
17
18       int posix_memalign(void **memptr, size_t alignment, size_t size);
19

DESCRIPTION

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 power of
24       two multiple of sizeof(void *).
25
26       Upon  successful  completion, the value pointed to by memptr shall be a
27       multiple of alignment.
28
29       If the size of the space requested is 0, the  behavior  is  implementa‐
30       tion-defined;  the  value  returned  in  memptr  shall be either a null
31       pointer or a unique pointer.
32
33       The free() function shall deallocate memory that  has  previously  been
34       allocated by posix_memalign().
35

RETURN VALUE

37       Upon  successful completion, posix_memalign() shall return zero; other‐
38       wise, an error number shall be returned to indicate the error.
39

ERRORS

41       The posix_memalign() function shall fail if:
42
43       EINVAL The value of the alignment parameter is not a power of two  mul‐
44              tiple of sizeof(void *).
45
46       ENOMEM There is insufficient memory available with the requested align‐
47              ment.
48
49       The following sections are informative.
50

EXAMPLES

52       None.
53

APPLICATION USAGE

55       The posix_memalign() function  is  part  of  the  Advisory  Information
56       option and need not be provided on all implementations.
57

RATIONALE

59       None.
60

FUTURE DIRECTIONS

62       None.
63

SEE ALSO

65       free(), malloc()
66
67       The Base Definitions volume of POSIX.1‐2008, <stdlib.h>
68
70       Portions  of  this text are reprinted and reproduced in electronic form
71       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
72       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
73       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
74       cal  and  Electronics  Engineers,  Inc  and  The  Open Group.  (This is
75       POSIX.1-2008 with the 2013 Technical Corrigendum  1  applied.)  In  the
76       event of any discrepancy between this version and the original IEEE and
77       The Open Group Standard, the original IEEE and The Open Group  Standard
78       is  the  referee document. The original Standard can be obtained online
79       at http://www.unix.org/online.html .
80
81       Any typographical or formatting errors that appear  in  this  page  are
82       most likely to have been introduced during the conversion of the source
83       files to man page format. To report such errors,  see  https://www.ker
84       nel.org/doc/man-pages/reporting_bugs.html .
85
86
87
88IEEE/The Open Group                  2013                   POSIX_MEMALIGN(3P)
Impressum