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
11

NAME

13       posix_madvise —  memory  advisory  information  and  alignment  control
14       (ADVANCED REALTIME)
15

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

EXAMPLES

83       None.
84

APPLICATION USAGE

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

RATIONALE

90       None.
91

FUTURE DIRECTIONS

93       None.
94

SEE ALSO

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