8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / man / man3c / posix_madvise.3c
blob8fd67505a693f144cba6086adc35a708a2d6a95d
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_MADVISE 3C "Jul 14, 2008"
12 .SH NAME
13 posix_madvise \- memory advisory information
14 .SH SYNOPSIS
15 .LP
16 .nf
17 #include <sys/mman.h>
19 \fBint\fR \fBposix_madvise\fR(\fBvoid *\fR\fIaddr\fR, \fBsize_t\fR \fIlen\fR, \fBint\fR \fIadvice\fR);
20 .fi
22 .SH DESCRIPTION
23 .sp
24 .LP
25 The \fBposix_madvise()\fR function advises the system on the expected behavior
26 of the application with respect to the data in the memory starting at address
27 \fIaddr\fR, and continuing for \fIlen\fR bytes. The system may use this
28 information to optimize handling of the specified data. The
29 \fBposix_madvise()\fR function has no effect on the semantics of access to
30 memory in the specified range, although it may affect the performance of
31 access.
32 .sp
33 .LP
34 The advice to be applied to the memory range is specified by the \fIadvice\fR
35 parameter and may be one of the following values:
36 .sp
37 .ne 2
38 .na
39 \fB\fBPOSIX_MADV_NORMAL\fR\fR
40 .ad
41 .RS 25n
42 Specifies that the application has no advice to give on its behavior with
43 respect to the specified range. It is the default characteristic if no advice
44 is given for a range of memory.
45 .RE
47 .sp
48 .ne 2
49 .na
50 \fB\fBPOSIX_MADV_SEQUENTIAL\fR\fR
51 .ad
52 .RS 25n
53 Specifies that the application expects to access the specified range
54 sequentially from lower addresses to higher addresses.
55 .RE
57 .sp
58 .ne 2
59 .na
60 \fB\fBPOSIX_MADV_RANDOM\fR\fR
61 .ad
62 .RS 25n
63 Specifies that the application expects to access the specified range in a
64 random order.
65 .RE
67 .sp
68 .ne 2
69 .na
70 \fB\fBPOSIX_MADV_WILLNEED\fR\fR
71 .ad
72 .RS 25n
73 Specifies that the application expects to access the specified range in the
74 near future.
75 .RE
77 .sp
78 .ne 2
79 .na
80 \fB\fBPOSIX_MADV_DONTNEED\fR\fR
81 .ad
82 .RS 25n
83 Specifies that the application expects that it will not access the specified
84 range in the near future.
85 .RE
87 .sp
88 .LP
89 These values are defined in \fB<sys/mman.h>\fR
90 .SH RETURN VALUES
91 .sp
92 .LP
93 Upon successful completion, \fBposix_madvise()\fR returns zero. Otherwise, an
94 error number is returned to indicate the error.
95 .SH ERRORS
96 .sp
97 .LP
98 The \fBposix_madvise()\fR function will fail if:
99 .sp
100 .ne 2
102 \fB\fBEINVAL\fR\fR
104 .RS 10n
105 The value of \fIadvice\fR is invalid.
109 .ne 2
111 \fB\fBENOMEM\fR\fR
113 .RS 10n
114 Addresses in the range starting at \fIaddr\fR and continuing for \fIlen\fR
115 bytes are partly or completely outside the range allowed for the address space
116 of the calling process.
121 The \fBposix_madvise()\fR function may fail if:
123 .ne 2
125 \fB\fBEINVAL\fR\fR
127 .RS 10n
128 The value of \fIlen\fR is zero.
131 .SH ATTRIBUTES
134 See \fBattributes\fR(5) for descriptions of the following attributes:
139 box;
140 c | c
141 l | l .
142 ATTRIBUTE TYPE  ATTRIBUTE VALUE
144 Interface Stability     Committed
146 MT-Level        MT-Safe
148 Standard        See \fBstandards\fR(5).
151 .SH SEE ALSO
154 \fBmmap\fR(2), \fBmadvise\fR(3C), posix_madvise(3C), \fBattributes\fR(5),
155 \fBstandards\fR(5)