1posix_madvise(3C)        Standard C Library Functions        posix_madvise(3C)
2
3
4

NAME

6       posix_madvise - memory advisory information
7

SYNOPSIS

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

DESCRIPTION

15       The  posix_madvise() function advises the system on the expected behav‐
16       ior of the application with respect to the data in the memory  starting
17       at  address addr, and continuing for len bytes. The system may use this
18       information to optimize handling of the specified data. The  posix_mad‐
19       vise()  function  has no effect on the semantics of access to memory in
20       the specified range, although it may affect the performance of access.
21
22
23       The advice to be applied to the memory range is specified by the advice
24       parameter and may be one of the following values:
25
26       POSIX_MADV_NORMAL        Specifies  that  the application has no advice
27                                to give on its behavior with  respect  to  the
28                                specified  range. It is the default character‐
29                                istic if no advice is given  for  a  range  of
30                                memory.
31
32
33       POSIX_MADV_SEQUENTIAL    Specifies  that  the  application  expects  to
34                                access the specified range  sequentially  from
35                                lower addresses to higher addresses.
36
37
38       POSIX_MADV_RANDOM        Specifies  that  the  application  expects  to
39                                access the specified range in a random order.
40
41
42       POSIX_MADV_WILLNEED      Specifies  that  the  application  expects  to
43                                access the specified range in the near future.
44
45
46       POSIX_MADV_DONTNEED      Specifies that the application expects that it
47                                will not access the  specified  range  in  the
48                                near future.
49
50
51
52       These values are defined in <sys/mman.h>
53

RETURN VALUES

55       Upon successful completion, posix_madvise() returns zero. Otherwise, an
56       error number is returned to indicate the error.
57

ERRORS

59       The posix_madvise() function will fail if:
60
61       EINVAL    The value of advice is invalid.
62
63
64       ENOMEM    Addresses in the range starting at addr  and  continuing  for
65                 len  bytes are partly or completely outside the range allowed
66                 for the address space of the calling process.
67
68
69
70       The posix_madvise() function may fail if:
71
72       EINVAL    The value of len is zero.
73
74

ATTRIBUTES

76       See attributes(5) for descriptions of the following attributes:
77
78
79
80
81       ┌─────────────────────────────┬─────────────────────────────┐
82       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
83       ├─────────────────────────────┼─────────────────────────────┤
84       │Interface Stability          │Committed                    │
85       ├─────────────────────────────┼─────────────────────────────┤
86       │MT-Level                     │MT-Safe                      │
87       ├─────────────────────────────┼─────────────────────────────┤
88       │Standard                     │See standards(5).            │
89       └─────────────────────────────┴─────────────────────────────┘
90

SEE ALSO

92       mmap(2), madvise(3C), posix_madvise(3C), attributes(5), standards(5)
93
94
95
96SunOS 5.11                        14 Jul 2008                posix_madvise(3C)
Impressum