1madv.so.1(1)                     User Commands                    madv.so.1(1)
2
3
4

NAME

6       madv.so.1 - madv library
7

SYNOPSIS

9       /usr/lib/madv.so.1
10
11

DESCRIPTION

13       The madv.so.1 shared object provides a means by which the VM advice can
14       be selectively configured for a launched process (or processes) and its
15       descendants.  To  enable  madv.so.1,  the  following string needs to be
16       present in the environment (see ld.so.1(1)) along with one or more MADV
17       environment variables:
18
19         LD_PRELOAD=$LD_PRELOAD:madv.so.1
20
21
22

ENVIRONMENT VARIABLES

24       If the madv.so.1 shared object is specified in the LD_PRELOAD list, the
25       following environment variables are read by the madv shared  object  to
26       determine to which created process(es) to apply the specified advice.
27
28       MADV=advice                MADV  specifies the VM advice to use for all
29                                  heap, shared memory, and mmap regions in the
30                                  process  address                 space. This
31                                  advice is applied to all created processes.
32
33                                  Values for advice correspond  to  values  in
34                                  <sys/mman.h>  used in madvise(3C) to specify
35                                  memory access patterns:
36                                    normal
37                                    random
38                                    sequential
39                                    access_lwp
40                                    access_many
41                                    access_default
42
43
44       MADVCFGFILE=config-file    config-file is a text  file  which  contains
45                                  one  or  more  madv configuration entries of
46                                  the form:
47
48                                    exec-name exec-args:advice-opts
49
50
51                                  Advice specified in config-file takes prece‐
52                                  dence  over that specified by the MADV envi‐
53                                  ronment variable. When  MADVCFGFILE  is  not
54                                  set,    advice    is    taken    from   file
55                                  /etc/madv.conf if it exists.
56
57                                  exec-name specifies the name of an  applica‐
58                                  tion or executable. The corresponding advice
59                                  is set  for  newly  created  processes  (see
60                                  getexecname(3C))  that match the first exec-
61                                  name found in the file.
62
63                                  exec-name can be a  full  pathname,  a  base
64                                  name,  or  a  pattern  string. See File Name
65                                  Generation in sh(1) for a discussion of pat‐
66                                  tern matching.
67
68                                  exec-args is an optionally specified pattern
69                                  string to match against arguments. Advice is
70                                  set  only  if  exec-args is not specified or
71                                  occurs within the arguments to exec-name.
72
73                                  advice-opts is a comma-separated list speci‐
74                                  fying   the   advice   for   various  memory
75                                  region(s):
76
77                                  madv=advice          Applies  to  all  heap,
78                                                       shared memory, and mmap
79                                                       regions in the  process
80                                                       address space.
81
82
83                                  heap=advice          The  heap is defined to
84                                                       be the  brk  area  (see
85                                                       brk(2)). Applies to the
86                                                       existing heap  and  for
87                                                       any   additional   heap
88                                                       memory allocated in the
89                                                       future.
90
91
92                                  shm=advice           Shared  memory segments
93                                  ism=advice           (see shmat(2)) attached
94                                  dism=advice          using  any  flags, flag
95                                                       SHM_SHARE_MMU, or  flag
96                                                       SHM_PAGEABLE    respec‐
97                                                       tively. Options ism and
98                                                       dism   take  precedence
99                                                       over option shm.
100
101
102                                  map=advice           Mappings    established
103                                  mapshared=advice     through  mmap(2)  using
104                                  mapprivate=advice    any     flags,     flag
105                                  mapanon=advice       MAP_SHARED,        flag
106                                                       MAP_PRIVATE,  or   flag
107                                                       MAP_ANON, respectively.
108                                                       Options mapshared, map‐
109                                                       private,   and  mapanon
110                                                       take  precedence   over
111                                                       option    map.   Option
112                                                       mapanon  takes   prece‐
113                                                       dence   over  mapshared
114                                                       and mapprivate.
115
116
117
118       MADVERRFILE=pathname       By default, error messages  are  logged  via
119                                  syslog(3C)  using level LOG_ERR and facility
120                                  LOG_USER. If MADVERRFILE  contains  a  valid
121                                  pathname  (such  as /dev/stderr), error mes‐
122                                  sages will be logged there instead.
123
124

EXAMPLES

126       Example 1 Applying advice to all ISM segments
127
128
129       The following configuration applies advice  to  all  ISM  segments  for
130       application /usr/bin/foo:
131
132
133         example$ LD_PRELOAD=$LD_PRELOAD:madv.so.1
134         example$ MADVCFGFILE=madvcfg
135         example$ export LD_PRELOAD MADVCFGFILE
136         example$ cat $MADVCFGFILE
137             /usr/bin/foo:ism=access_lwp
138
139
140
141       Example 2 Setting advice for all applications with exception
142
143
144       The  following  configuration sets advice for all applications with the
145       exception of ls.
146
147
148         example$ LD_PRELOAD=$LD_PRELOAD:madv.so.1
149         example$ MADV=access_many
150         example$ MADVCFGFILE=madvcfg
151         example$ export LD_PRELOAD MADV MADVCFGFILE
152         example$ cat $MADVCFGFILE
153             ls:
154
155
156
157       Example 3 Precedence rules (continuation from Example 2)
158
159
160       Because MADVCFGFILE takes precedence over MADV, specifying '*' (pattern
161       match all) for the exec-name of the last madv configuration entry would
162       be equivalent to setting MADV. The following is equivalent  to  example
163       2:
164
165
166         example$ LD_PRELOAD=$LD_PRELOAD:madv.so.1
167         example$ MADVCFGFILE=madvcfg
168         example$ export LD_PRELOAD MADVCFGFILE
169         example$ cat $MADVCFGFILE
170             ls:
171             *:madv=access_many
172
173
174
175       Example 4 Applying advice for different regions
176
177
178       The following configuration applies one type of advice for mmap regions
179       and different advice for heap and shared memory regions  for  a  select
180       set of applications with exec names that begin with foo:
181
182
183         example$ LD_PRELOAD=$LD_PRELOAD:madv.so.1
184         example$ MADVCFGFILE=madvcfg
185         example$ export LD_PRELOAD MADVCFGFILE
186         example$ cat $MADVCFGFILE
187             foo*:madv=access_many,heap=sequential,shm=access_lwp
188
189
190
191       Example 5 Applying advice selectively
192
193
194       The following configuration applies advice for the heap of applications
195       beginning with ora that have ora1 as an argument:
196
197
198         example$ LD_PRELOAD=$LD_PRELOAD:madv.so.1
199         example$ MADVCFGFILE=madvcfg
200         example$ export LD_PRELOAD MADVCFGFILE
201         example$ cat $MADVCFGFILE
202             ora* ora1:heap=access_many
203
204
205

FILES

207       /etc/madv.conf     Configuration file
208
209

ATTRIBUTES

211       See attributes(5) for descriptions of the following attributes:
212
213
214
215
216       ┌─────────────────────────────┬─────────────────────────────┐
217       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
218       ├─────────────────────────────┼─────────────────────────────┤
219       │Availability                 │SUNWesu (32-bit)             │
220       ├─────────────────────────────┼─────────────────────────────┤
221       │                             │SUNWesxu (64-bit)            │
222       ├─────────────────────────────┼─────────────────────────────┤
223       │Interface Stability          │Unstable                     │
224       └─────────────────────────────┴─────────────────────────────┘
225

SEE ALSO

227       cat(1), ld.so.1(1), proc(1), sh(1), brk(2), exec(2), fork(2),  mmap(2),
228       memcntl(2),   shmat(2),   getexecname(3C),   madvise(3C),   syslog(3C),
229       proc(4), attributes(5)
230

NOTES

232       The advice is inherited. A child process has the same advice         as
233       its  parent.  On  exec()  (see  exec(2)), the advice is set back to the
234       default system advice unless different advice has been  configured  via
235       the madv shared object.
236
237
238       Advice  is  only applied to mmap regions explicitly created by the user
239       program. Those regions established by the run-time linker or by  system
240       libraries  making  direct  system calls (for example, libthread alloca‐
241       tions for thread stacks) are not affected.
242
243
244
245SunOS 5.11                        15 Feb 2002                     madv.so.1(1)
Impressum