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

NAME

6       posix_madvise  -  memory  advisory  information  and  alignment control
7       (ADVANCED REALTIME)
8

SYNOPSIS

10       #include <sys/mman.h>
11
12       int posix_madvise(void *addr, size_t len, int advice);
13
14

DESCRIPTION

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

RETURN VALUE

64       Upon successful completion, posix_madvise() shall return  zero;  other‐
65       wise, an error number shall be returned to indicate the error.
66

ERRORS

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

EXAMPLES

88       None.
89

APPLICATION USAGE

91       The posix_madvise() function is part of the Advisory Information option
92       and need not be provided on all implementations.
93

RATIONALE

95       None.
96

FUTURE DIRECTIONS

98       None.
99

SEE ALSO

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