File: madvise.2

package info (click to toggle)
manpages-ja 0.5.0.0.20080615-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 20,508 kB
  • ctags: 1
  • sloc: sh: 13,690; perl: 157; makefile: 114
file content (232 lines) | stat: -rw-r--r-- 7,438 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" Copyright (C) 2001 David Gez <davidge@jazzfree.com>
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date.  The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein.  The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Based on comments from mm/filemap.c. Last modified on 10-06-2001
.\" Modified, 25 Feb 2002, Michael Kerrisk, <mtk.manpages@gmail.com>
.\"    Added notes on MADV_DONTNEED
.\"
.\" Japanese Version Copyright (c) 2001 NAKANO Takeo all rights reserved.
.\" Translated Thu Aug 16 2001 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
.\" Updated Tue 8 Oct 2002 by NAKANO Takeo
.\" Updated 2007-01-08, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.43
.\"
.TH MADVISE 2 2007-07-26 "Linux" "Linux Programmer's Manual"
.SH ̾
madvise \- Ѥ˴ؤ륢ɥХͿ
.SH 
.B #include <sys/mman.h>
.sp
.BI "int madvise(void *" start ", size_t " length ", int " advice );
.sp
.in -4n
glibc εǽޥ׷
.RB ( feature_test_macros (7)
):
.in
.sp
.BR madvise ():
_BSD_SOURCE
.SH 
.BR madvise ()
ƥॳϡɥ쥹
.I start
Ϥޤ
.I length
ХȤΥ֥åΥڡϤɤɤ
ͥ˥ɥХ롣
Ѥȡ
ץꥱ󤫤饫ͥˡ
ޥåפ줿䶦ͭɤΤ褦˰äƤۤ뤳ȤǤ
ͥϤ˱ɤߤ䥭åʤɤŬڤʼˡǤ롣
ΥϥץꥱưΤΤˤϱƶʤ
.RB ( MADV_DONTNEED
ξ) 
ǽˤϱƶ롣
ʤΥɥХ뤫ɤϥͥǤ롣
.LP
ɥХϥѥ᡼
.I advice
ˤäͿ롣ʲΤ줫Ǥ롣
.TP
.B MADV_NORMAL
̤ʰϹԤʤ줬ǥեȤǤ롣
.TP
.B MADV_RANDOM
ڡȤϥʽǹԤ줽
(äơɤߤϤޤ̤ʤ)
.TP
.B MADV_SEQUENTIAL
ڡȤϥ󥷥ʽǹԤ줽
(äͿϰϤΥڡѶŪɤߤƤɤ
ޤä®䤫˲ɤ)
.TP
.B MADV_WILLNEED
ᤤ˥줽
(äƤΥڡ򺣤ΤɤߤƤȤ)
.TP
.B MADV_DONTNEED
Ф餯Ϥʤ
(ǥץꥱͿϰϤν򽪤Ƥ롣
äƥͥϤ˴Ϣ꥽ɤ)
ʹߤϰϤΥڡؤΥȡ
Ϥ뤬Ƥޥå׸Υե뤫ɤľȤˤʤ
.RB ( mmap (2)
򸫤) 
ޤϸե뤬ʤޥåץڡǤ
äȤ 0 ᤬Ԥ뤳Ȥˤʤ롣
.TP
.BR MADV_REMOVE " (Linux 2.6.16 ʹ)"
ꤵ줿ϰϤΥڡȴϢХå󥰥ȥ롣
ߤΤȤ
.\" 2.6.18-rc5
shmfs/tmpfs бƤ롣
¾Υե륷ƥǤ
.B ENOSYS
֤롣
.\" Databases want to use this feature to drop a section of their
.\" bufferpool (shared memory segments) - without writing back to
.\" disk/swap space. This feature is also useful for supporting
.\" hot-plug memory on UML.
.TP
.BR MADV_DONTFORK " (Linux 2.6.16 ʹ)"
.\" See http://lwn.net/Articles/171941/
.BR fork (2)
Ԥ줿塢ꤵ줿ϰϤΥڡҥץѤǤʤ褦ˤ롣
εǽϡ񤭹߻ԡ (copy-on-write) ǡ
.BR fork (2)
θǿƥץڡ˽񤭹ߤԤä
ڡʪ֤Ѳʤ褦ˤΤͭǤ
(ڡκ֤ϥϡɥΥڡ DMA žԤ褦ʾ
򵯤Ȥ)
.\" [PATCH] madvise MADV_DONTFORK/MADV_DOFORK
.\" Currently, copy-on-write may change the physical address of
.\" a page even if the user requested that the page is pinned in
.\" memory (either by mlock or by get_user_pages). This happens
.\" if the process forks meanwhile, and the parent writes to that
.\" page.  As a result, the page is orphaned: in case of
.\" get_user_pages, the application will never see any data hardware
.\" DMA's into this page after the COW.  In case of mlock'd memory,
.\" the parent is not getting the realtime/security benefits of mlock.
.\"
.\" In particular, this affects the Infiniband modules which do DMA from
.\" and into user pages all the time.
.\"
.\" This patch adds madvise options to control whether memory range is
.\" inherited across fork. Useful e.g. for when hardware is doing DMA
.\" from/into these pages.  Could also be useful to an application
.\" wanting to speed up its forks by cutting large areas out of
.\" consideration.
.TP
.BR MADV_DOFORK " (Linux 2.6.16 ʹ)"
.B MADV_DONTFORK
αƶäǥեȤư᤹
Ĥޤꡢ
.BR fork (2)
ǥޥåԥ󥰤ϷѾ褦ˤʤ롣
.SH ֤
.BR madvise ()
 0 ֤
顼 \-1 ֤
.I errno
Ŭڤͤꤹ롣
.SH 顼
.TP
.B EAGAIN
餫Υͥ꥽ŪѤǤʤä
.TP
.B EBADF
ꤷޥåפ¸ߤ뤬եǤϤʤȤޥåפƤ롣
.TP
.B EINVAL
.\" .I len
.\" is zero,
.I len
ͤ顢
.I start
ڡǤʤ
.I advice
ͤǤʤ
ץꥱ󤬥å줿ڡ䶦ͭڡ
.RB ( MADV_DONTNEED
) 褦ȤƤ롢ʤɡ
.TP
.B EIO
.RB ( MADV_WILLNEED
ξ) ϰϤΥڡ󥰤Ԥȡ
ץ RSS (resident set size) κͤۤƤޤ
.\"nakano RSS 줬ޤä?
.TP
.B ENOMEM
.RB ( MADV_WILLNEED
ξ) ꤬­ꤺڡ󥰤˼Ԥ
.TP
.B ENOMEM
ꤷϰϤΥɥ쥹ߥޥåפƤʤ
뤤ϥץΥɥ쥹֤ˤʤ
.SH 
POSIX.1b.
POSIX.1-2001 Ǥϡ
.BR posix_madvise (3)

.B POSIX_MADV_NORMAL
ʤɤȤȤ˵ҤƤ
(줾ο񤤤ϤǽҤ٤Τ˶ᤤ)
ե륢ФƤ
.BR posix_fadvise (2)
Ȥδؿ¸ߤ롣

.BR MADV_REMOVE ,
.BR MADV_DONTFORK ,
.B MADV_DOFORK
 Linux ͭǤ롣
.SH 
.SS "Linux Ǥ"
ߤ Linux μ (2.4.0) Ǥϡ
Υƥॳ򥢥ɥХȤ̿ȸƤ롣
äƤΥɥХФ̾ԤưԲǽʾϡ
顼֤Ȥ (嵭 顼 εҤ򻲾)
ο񤤤ɸȤϰۤʤ롣
.LP
Linux μǤ
.I start
Υɥ쥹ϥڡͤǤʤФʤʤޤ
.I length
 0 ǤäƤ⹽ʤ
ޤ Linux Ǥ
.BR madvise ()
Ǥϡꤵ줿ɥ쥹ϰϤ˥ޥåפƤʤʬȡ
̵뤷ƻĤʬ˥ɥХŬѤ
(ƥॳФƤϤ
.B ENOMEM
֤)
.\" .SH 
.\" .BR madvise ()
.\" ؿ 4.4BSD Ǻǽо줷
.SH Ϣ
.BR getrlimit (2),
.BR mincore (2),
.BR mmap (2),
.BR mprotect (2),
.BR msync (2),
.BR munmap (2)