8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / man / man3c / posix_memalign.3c
blob431218a8262f5923b3f71b0677c6f0679fb98489
1 '\" te
2 .\" Copyright (c) 2001, the Institute of Electrical and Electronics Engineers, Inc. and The Open Group. All Rights Reserved.
3 .\" Portions Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
4 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
7 .\"  This notice shall appear on any product containing this material.
8 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
9 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
10 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
11 .TH POSIX_MEMALIGN 3C "Jul 14, 2008"
12 .SH NAME
13 posix_memalign \- aligned memory allocation
14 .SH SYNOPSIS
15 .LP
16 .nf
17 #include <sys/mman.h>
19 \fBint\fR \fBposix_memalign\fR(\fBvoid **\fR\fImemptr\fR, \fBsize_t\fR \fIalignment\fR, \fBsize_t\fR \fIsize\fR);
20 .fi
22 .SH DESCRIPTION
23 .sp
24 .LP
25 The \fBposix_memalign()\fR function allocates size bytes aligned on a boundary
26 specified by alignment, and returns a pointer to the allocated memory in
27 \fImemptr\fR. The value of alignment must be a power of two multiple of
28 \fBsizeof\fR(\fBvoid *\fR).
29 .sp
30 .LP
31 Upon successful completion, the value pointed to by \fImemptr\fR will be a
32 multiple of alignment.
33 .sp
34 .LP
35 If the size of the space requested is 0, the value returned in \fImemptr\fR
36 will be a null pointer.
37 .sp
38 .LP
39 The \fBfree\fR(3C) function will deallocate memory that has previously been
40 allocated by \fBposix_memalign()\fR.
41 .SH RETURN VALUES
42 .sp
43 .LP
44 Upon successful completion, \fBposix_memalign()\fR returns zero. Otherwise, an
45 error number is returned to indicate the error.
46 .SH ERRORS
47 .sp
48 .LP
49 The \fBposix_memalign()\fR function will fail if:
50 .sp
51 .ne 2
52 .na
53 \fB\fBEINVAL\fR\fR
54 .ad
55 .RS 10n
56 The value of the alignment parameter is not a power of two multiple of
57 \fBsizeof\fR(\fBvoid *\fR).
58 .RE
60 .sp
61 .ne 2
62 .na
63 \fB\fBENOMEM\fR\fR
64 .ad
65 .RS 10n
66 There is insufficient memory available with the requested alignment.
67 .RE
69 .SH ATTRIBUTES
70 .sp
71 .LP
72 See \fBattributes\fR(5) for descriptions of the following attributes:
73 .sp
75 .sp
76 .TS
77 box;
78 c | c
79 l | l .
80 ATTRIBUTE TYPE  ATTRIBUTE VALUE
82 Interface Stability     Committed
84 MT-Level        MT-Safe
86 Standard        See \fBstandards\fR(5).
87 .TE
89 .SH SEE ALSO
90 .sp
91 .LP
92 \fBfree\fR(3C), \fBmalloc\fR(3C), \fBmemalign\fR(3C), \fBattributes\fR(5),
93 \fBstandards\fR(5)