1posix_memalign(3C) Standard C Library Functions posix_memalign(3C)
2
3
4
6 posix_memalign - aligned memory allocation
7
9 #include <sys/mman.h>
10
11 int posix_memalign(void **memptr, size_t alignment, size_t size);
12
13
15 The posix_memalign() function allocates size bytes aligned on a bound‐
16 ary specified by alignment, and returns a pointer to the allocated mem‐
17 ory in memptr. The value of alignment must be a power of two multiple
18 of sizeof(void *).
19
20
21 Upon successful completion, the value pointed to by memptr will be a
22 multiple of alignment.
23
24
25 If the size of the space requested is 0, the value returned in memptr
26 will be a null pointer.
27
28
29 The free(3C) function will deallocate memory that has previously been
30 allocated by posix_memalign().
31
33 Upon successful completion, posix_memalign() returns zero. Otherwise,
34 an error number is returned to indicate the error.
35
37 The posix_memalign() function will fail if:
38
39 EINVAL The value of the alignment parameter is not a power of two
40 multiple of sizeof(void *).
41
42
43 ENOMEM There is insufficient memory available with the requested
44 alignment.
45
46
48 See attributes(5) for descriptions of the following attributes:
49
50
51
52
53 ┌─────────────────────────────┬─────────────────────────────┐
54 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
55 ├─────────────────────────────┼─────────────────────────────┤
56 │Interface Stability │Committed │
57 ├─────────────────────────────┼─────────────────────────────┤
58 │MT-Level │MT-Safe │
59 ├─────────────────────────────┼─────────────────────────────┤
60 │Standard │See standards(5). │
61 └─────────────────────────────┴─────────────────────────────┘
62
64 free(3C), malloc(3C), memalign(3C), attributes(5), standards(5)
65
66
67
68SunOS 5.11 14 Jul 2008 posix_memalign(3C)