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

DESCRIPTION

21       The  posix_madvise()  function  shall  advise the implementation on the
22       expected behavior of the application with respect to the  data  in  the
23       memory  starting  at  address  addr,  and continuing for len bytes. The
24       implementation may use this information to  optimize  handling  of  the
25       specified  data.  The  posix_madvise() function shall have no effect on
26       the semantics of access to memory in the specified range,  although  it
27       may affect the performance of access.
28
29       The  implementation  may  require  that  addr be a multiple of the page
30       size, which is the value returned by  sysconf()  when  the  name  value
31       _SC_PAGESIZE is used.
32
33       The advice to be applied to the memory range is specified by the advice
34       parameter and may be one of the following values:
35
36       POSIX_MADV_NORMAL
37             Specifies that the application has  no  advice  to  give  on  its
38             behavior  with  respect to the specified range. It is the default
39             characteristic if no advice is given for a range of memory.
40
41       POSIX_MADV_SEQUENTIAL
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             Specifies  that  the  application expects to access the specified
47             range in a random order.
48
49       POSIX_MADV_WILLNEED
50             Specifies that the application expects to  access  the  specified
51             range in the near future.
52
53       POSIX_MADV_DONTNEED
54             Specifies  that  the  application expects that it will not access
55             the specified range in the near future.
56
57       These values are defined in the <sys/mman.h> header.
58

RETURN VALUE

60       Upon successful completion, posix_madvise() shall return  zero;  other‐
61       wise, an error number shall be returned to indicate the error.
62

ERRORS

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

EXAMPLES

82       None.
83

APPLICATION USAGE

85       The posix_madvise() function is part of the Advisory Information option
86       and need not be provided on all implementations.
87

RATIONALE

89       None.
90

FUTURE DIRECTIONS

92       None.
93

SEE ALSO

95       mmap(), posix_fadvise(), sysconf()
96
97       The Base Definitions volume of POSIX.1‐2017, <sys_mman.h>
98
100       Portions  of  this text are reprinted and reproduced in electronic form
101       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
102       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
103       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
104       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
105       event of any discrepancy between this version and the original IEEE and
106       The  Open Group Standard, the original IEEE and The Open Group Standard
107       is the referee document. The original Standard can be  obtained  online
108       at http://www.opengroup.org/unix/online.html .
109
110       Any  typographical  or  formatting  errors that appear in this page are
111       most likely to have been introduced during the conversion of the source
112       files  to  man page format. To report such errors, see https://www.ker
113       nel.org/doc/man-pages/reporting_bugs.html .
114
115
116
117IEEE/The Open Group                  2017                    POSIX_MADVISE(3P)
Impressum