1POSIX_MADVISE(3P)          POSIX Programmer's Manual         POSIX_MADVISE(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

NAME

12       posix_madvise -  memory  advisory  information  and  alignment  control
13       (ADVANCED REALTIME)
14

SYNOPSIS

16       #include <sys/mman.h>
17
18       int posix_madvise(void *addr, size_t len, int advice);
19
20

DESCRIPTION

22       The  posix_madvise() function need only be supported if either the Mem‐
23       ory Mapped Files or the Shared Memory Objects options are supported.
24
25       The posix_madvise() function shall advise  the  implementation  on  the
26       expected  behavior  of  the application with respect to the data in the
27       memory starting at address addr, and  continuing  for  len  bytes.  The
28       implementation  may  use  this  information to optimize handling of the
29       specified data. The posix_madvise() function shall have  no  effect  on
30       the  semantics  of access to memory in the specified range, although it
31       may affect the performance of access.
32
33       The implementation may require that addr be  a  multiple  of  the  page
34       size,  which  is  the  value  returned by sysconf() when the name value
35       _SC_PAGESIZE is used.
36
37       The advice to be applied to the memory range is specified by the advice
38       parameter and may be one of the following values:
39
40       POSIX_MADV_NORMAL
41
42              Specifies  that  the  application  has  no advice to give on its
43              behavior with respect to the specified range. It is the  default
44              characteristic if no advice is given for a range of memory.
45
46       POSIX_MADV_SEQUENTIAL
47
48              Specifies  that  the application expects to access the specified
49              range sequentially from lower addresses to higher addresses.
50
51       POSIX_MADV_RANDOM
52
53              Specifies that the application expects to access  the  specified
54              range in a random order.
55
56       POSIX_MADV_WILLNEED
57
58              Specifies  that  the application expects to access the specified
59              range in the near future.
60
61       POSIX_MADV_DONTNEED
62
63              Specifies that the application expects that it will  not  access
64              the specified range in the near future.
65
66
67       These values are defined in the <sys/mman.h> header.
68

RETURN VALUE

70       Upon  successful  completion, posix_madvise() shall return zero; other‐
71       wise, an error number shall be returned to indicate the error.
72

ERRORS

74       The posix_madvise() function shall fail if:
75
76       EINVAL The value of advice is invalid.
77
78       ENOMEM Addresses in the range starting at addr and continuing  for  len
79              bytes are partly or completely outside the range allowed for the
80              address space of the calling process.
81
82
83       The posix_madvise() function may fail if:
84
85       EINVAL The value of addr is not a multiple of  the  value  returned  by
86              sysconf() when the name value _SC_PAGESIZE is used.
87
88       EINVAL The value of len is zero.
89
90
91       The following sections are informative.
92

EXAMPLES

94       None.
95

APPLICATION USAGE

97       The posix_madvise() function is part of the Advisory Information option
98       and need not be provided on all implementations.
99

RATIONALE

101       None.
102

FUTURE DIRECTIONS

104       None.
105

SEE ALSO

107       mmap(), posix_fadvise(), sysconf(),  the  Base  Definitions  volume  of
108       IEEE Std 1003.1-2001, <sys/mman.h>
109
111       Portions  of  this text are reprinted and reproduced in electronic form
112       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
113       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
114       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
115       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
116       event of any discrepancy between this version and the original IEEE and
117       The  Open Group Standard, the original IEEE and The Open Group Standard
118       is the referee document. The original Standard can be  obtained  online
119       at http://www.opengroup.org/unix/online.html .
120
121
122
123IEEE/The Open Group                  2003                    POSIX_MADVISE(3P)
Impressum