OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / release / man2 / madvise.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (C) 2001 David Gez <davidge@jazzfree.com>
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .\" Based on comments from mm/filemap.c. Last modified on 10-06-2001
26 .\" Modified, 25 Feb 2002, Michael Kerrisk, <mtk.manpages@gmail.com>
27 .\"    Added notes on MADV_DONTNEED
28 .\" FIXME
29 .\" 2.6.32 added MADV_HWPOISON, MADV_MERGEABLE, and MADV_UNMERGEABLE
30 .\" 2.6.33 added MADV_SOFT_OFFLINE
31 .\"
32 .\" Japanese Version Copyright (c) 2001 NAKANO Takeo all rights reserved.
33 .\" Translated Thu Aug 16 2001 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
34 .\" Updated Tue 8 Oct 2002 by NAKANO Takeo
35 .\" Updated 2007-01-08, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.43
36 .\"
37 .TH MADVISE 2 2008-04-22 "Linux" "Linux Programmer's Manual"
38 .SH Ì¾Á°
39 madvise \- ¥á¥â¥êÍøÍѤ˴ؤ¹¤ë¥¢¥É¥Ð¥¤¥¹¤òÍ¿¤¨¤ë
40 .SH ½ñ¼°
41 .B #include <sys/mman.h>
42 .sp
43 .BI "int madvise(void *" addr ", size_t " length ", int " advice );
44 .sp
45 .in -4n
46 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
47 .RB ( feature_test_macros (7)
48 »²¾È):
49 .in
50 .sp
51 .BR madvise ():
52 _BSD_SOURCE
53 .SH ÀâÌÀ
54 .BR madvise ()
55 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢¥¢¥É¥ì¥¹
56 .I addr
57 ¤«¤é¤Ï¤¸¤Þ¤ë
58 .I length
59 ¥Ð¥¤¥È¤Î¥á¥â¥ê¥Ö¥í¥Ã¥¯¤Î¥Ú¡¼¥¸¥ó¥°Æþ½ÐÎϤò¤É¤¦°·¤¨¤ÐÎɤ¤¤«¡¢
60 ¥«¡¼¥Í¥ë¤Ë¥¢¥É¥Ð¥¤¥¹¤¹¤ë¡£
61 ¤³¤ì¤òÍѤ¤¤ë¤È¡¢
62 ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤«¤é¥«¡¼¥Í¥ë¤Ë¡¢
63 ¥Þ¥Ã¥×¤µ¤ì¤¿¥á¥â¥ê¤ä¶¦Í­¥á¥â¥ê¤ò¤É¤Î¤è¤¦¤Ë°·¤Ã¤Æ¤Û¤·¤¤¤«ÅÁ¤¨¤ë¤³¤È¤¬¤Ç¤­¡¢
64 ¥«¡¼¥Í¥ë¤Ï¤½¤ì¤Ë±þ¤¸¤ÆÀèÆɤߤ䥭¥ã¥Ã¥·¥å¤Ê¤É¤ÎŬÀڤʼêË¡¤òÁªÂò¤Ç¤­¤ë¡£
65 ¤³¤Î¥³¡¼¥ë¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ÎÆ°ºî¤½¤Î¤â¤Î¤Ë¤Ï±Æ¶Á¤·¤Ê¤¤
66 .RB ( MADV_DONTNEED
67 ¤Î¾ì¹ç¤ÏÊÌ) ¤¬¡¢
68 À­Ç½¤Ë¤Ï±Æ¶Á¤·¤¦¤ë¡£
69 ¤Ê¤ª¤³¤Î¥¢¥É¥Ð¥¤¥¹¤ò¼õ¤±Æþ¤ì¤ë¤«¤É¤¦¤«¤Ï¥«¡¼¥Í¥ë¤ËǤ¤µ¤ì¤ë¡£
70 .LP
71 ¥¢¥É¥Ð¥¤¥¹¤Ï°ú¤­¿ô
72 .I advice
73 ¤Ë¤è¤Ã¤ÆÍ¿¤¨¤ë¡£°Ê²¼¤Î¤¤¤º¤ì¤«¤ò»ØÄê¤Ç¤­¤ë¡£
74 .TP
75 .B MADV_NORMAL
76 ÆÃÊ̤ʰ·¤¤¤Ï¹Ô¤ï¤Ê¤¤¡£¤³¤ì¤¬¥Ç¥Õ¥©¥ë¥È¤Ç¤¢¤ë¡£
77 .TP
78 .B MADV_RANDOM
79 ¥Ú¡¼¥¸»²¾È¤Ï¥é¥ó¥À¥à¤Ê½ç½ø¤Ç¹Ô¤ï¤ì¤½¤¦¤À¡£
80 (¤·¤¿¤¬¤Ã¤Æ¡¢ÀèÆɤߤϤ¢¤Þ¤ê¸ú²Ì¤¬¤Ê¤µ¤½¤¦¤À¡£)
81 .TP
82 .B MADV_SEQUENTIAL
83 ¥Ú¡¼¥¸»²¾È¤Ï¥·¡¼¥±¥ó¥·¥ã¥ë¤Ê½ç½ø¤Ç¹Ô¤ï¤ì¤½¤¦¤À¡£
84 (¤·¤¿¤¬¤Ã¤ÆÍ¿¤¨¤¿ÈϰϤΥڡ¼¥¸¤ÏÀѶËŪ¤ËÀèÆɤߤ·¤Æ¤ª¤¯¤ÈÎɤ¤¤À¤í¤¦¡£
85 ¤Þ¤¿¥¢¥¯¥»¥¹¤¬½ª¤ï¤Ã¤¿¤é®¤ä¤«¤Ë²òÊü¤·¤ÆÎɤ¤¡£)
86 .TP
87 .B MADV_WILLNEED
88 ¶á¤¤¾­Íè¤Ë¥¢¥¯¥»¥¹¤µ¤ì¤½¤¦¤À¡£
89 (¤·¤¿¤¬¤Ã¤Æ¤³¤ì¤é¤Î¥Ú¡¼¥¸¤òº£¤Î¤¦¤Á¤ËÀèÆɤߤ·¤Æ¤ª¤¯¤È¤¤¤¤¤À¤í¤¦¡£)
90 .TP
91 .B MADV_DONTNEED
92 ¤·¤Ð¤é¤¯¥¢¥¯¥»¥¹¤Ï¤Ê¤µ¤½¤¦¤À¡£
93 (¸½»þÅÀ¤Ç¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ÏÍ¿¤¨¤¿ÈϰϤνèÍý¤ò½ª¤¨¤Æ¤¤¤ë¡£
94 ¤·¤¿¤¬¤Ã¤Æ¥«¡¼¥Í¥ë¤Ï¤³¤ì¤Ë´ØÏ¢¤¹¤ë¥ê¥½¡¼¥¹¤ò²òÊü¤·¤ÆÎɤ¤¡£)
95 ¤³¤ì°Ê¹ß¤³¤ÎÈϰϤΥڡ¼¥¸¤Ø¤Î¥¢¥¯¥»¥¹¤¬¤¢¤ë¤È¡¢
96 À®¸ù¤Ï¤¹¤ë¤¬¡¢¥á¥â¥ê¤ÎÆâÍƤò¥Þ¥Ã¥×¸µ¤Î¥Õ¥¡¥¤¥ë¤«¤é¥í¡¼¥É¤·Ä¾¤¹¤³¤È¤Ë¤Ê¤ë
97 .RB ( mmap (2)
98 ¤ò¸«¤è) ¤«¡¢
99 ¤Þ¤¿¤Ï¸µ¥Õ¥¡¥¤¥ë¤¬¤Ê¤¤¥Þ¥Ã¥×¥Ú¡¼¥¸¤Ç¤Ï
100 ¥¢¥¯¥»¥¹¤¬¤¢¤Ã¤¿¤È¤­¤Ë 0 Ëä¤á¤¬¹Ô¤ï¤ì¤ë¤³¤È¤Ë¤Ê¤ë¡£
101 .TP
102 .BR MADV_REMOVE " (Linux 2.6.16 °Ê¹ß)"
103 »ØÄꤵ¤ì¤¿ÈϰϤΥڡ¼¥¸¤È´ØÏ¢¤¹¤ë¥Ð¥Ã¥­¥ó¥°¥¹¥È¥¢¤ò²òÊü¤¹¤ë¡£
104 ¸½ºß¤Î¤È¤³¤í¡¢
105 .\" 2.6.18-rc5
106 shmfs/tmpfs ¤À¤±¤¬¤³¤ì¤ËÂбþ¤·¤Æ¤¤¤ë¡£
107 ¾¤Î¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Ç¤Ï
108 .B ENOSYS
109 ¤¬ÊÖ¤µ¤ì¤ë¡£
110 .\" Databases want to use this feature to drop a section of their
111 .\" bufferpool (shared memory segments) - without writing back to
112 .\" disk/swap space. This feature is also useful for supporting
113 .\" hot-plug memory on UML.
114 .TP
115 .BR MADV_DONTFORK " (Linux 2.6.16 °Ê¹ß)"
116 .\" See http://lwn.net/Articles/171941/
117 .BR fork (2)
118 ¤¬¹Ô¤ï¤ì¤¿¸å¡¢»ØÄꤵ¤ì¤¿ÈϰϤΥڡ¼¥¸¤ò»Ò¥×¥í¥»¥¹¤¬ÍøÍѤǤ­¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¡£
119 ¤³¤Îµ¡Ç½¤Ï¡¢½ñ¤­¹þ¤ß»þ¥³¥Ô¡¼ (copy-on-write) Êý¼°¤Ç¡¢
120 .BR fork (2)
121 ¤Î¸å¤Ç¿Æ¥×¥í¥»¥¹¤¬¥Ú¡¼¥¸¤Ë½ñ¤­¹þ¤ß¤ò¹Ô¤Ã¤¿¾ì¹ç¤Ë
122 ¥Ú¡¼¥¸¤ÎʪÍý°ÌÃÖ¤¬ÊѲ½¤·¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¤Î¤ËÍ­¸ú¤Ç¤¢¤ë
123 (¥Ú¡¼¥¸¤ÎºÆÇÛÃ֤ϥϡ¼¥É¥¦¥§¥¢¤¬¤½¤Î¥Ú¡¼¥¸¤Ë DMA Å¾Á÷¤ò¹Ô¤¦¤è¤¦¤Ê¾ì¹ç¤Ë
124 ÌäÂê¤òµ¯¤³¤¹¤³¤È¤¬¤¢¤ë)¡£
125 .\" [PATCH] madvise MADV_DONTFORK/MADV_DOFORK
126 .\" Currently, copy-on-write may change the physical address of
127 .\" a page even if the user requested that the page is pinned in
128 .\" memory (either by mlock or by get_user_pages). This happens
129 .\" if the process forks meanwhile, and the parent writes to that
130 .\" page.  As a result, the page is orphaned: in case of
131 .\" get_user_pages, the application will never see any data hardware
132 .\" DMA's into this page after the COW.  In case of mlock'd memory,
133 .\" the parent is not getting the realtime/security benefits of mlock.
134 .\"
135 .\" In particular, this affects the Infiniband modules which do DMA from
136 .\" and into user pages all the time.
137 .\"
138 .\" This patch adds madvise options to control whether memory range is
139 .\" inherited across fork. Useful e.g. for when hardware is doing DMA
140 .\" from/into these pages.  Could also be useful to an application
141 .\" wanting to speed up its forks by cutting large areas out of
142 .\" consideration.
143 .\"
144 .\" SEE ALSO: http://lwn.net/Articles/171941/
145 .\" "Tweaks to madvise() and posix_fadvise()", 14 Feb 2006
146 .TP
147 .BR MADV_DOFORK " (Linux 2.6.16 °Ê¹ß)"
148 .B MADV_DONTFORK
149 ¤Î±Æ¶Á¤ò¼è¤ê¾Ã¤·¡¢¥Ç¥Õ¥©¥ë¥È¤ÎÆ°ºî¤ËÌ᤹¡£
150 ¤Ä¤Þ¤ê¡¢
151 .BR fork (2)
152 ¤ÎÁ°¸å¤Ç¥Þ¥Ã¥Ô¥ó¥°¤Ï·Ñ¾µ¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤ë¡£
153 .SH ÊÖ¤êÃÍ
154 .BR madvise ()
155 ¤ÏÀ®¸ù¤¹¤ë¤È 0 ¤òÊÖ¤¹¡£
156 ¥¨¥é¡¼¤¬µ¯¤³¤ë¤È \-1 ¤òÊÖ¤·¡¢
157 .I errno
158 ¤òŬÀÚ¤ÊÃͤËÀßÄꤹ¤ë¡£
159 .SH ¥¨¥é¡¼
160 .TP
161 .B EAGAIN
162 ²¿¤é¤«¤Î¥«¡¼¥Í¥ë¥ê¥½¡¼¥¹¤¬°ì»þŪ¤ËÍøÍѤǤ­¤Ê¤«¤Ã¤¿¡£
163 .TP
164 .B EBADF
165 »ØÄꤷ¤¿¥Þ¥Ã¥×¤Ï¸ºß¤¹¤ë¤¬¡¢¥Õ¥¡¥¤¥ë¤Ç¤Ï¤Ê¤¤¤È¤³¤í¤ò¥Þ¥Ã¥×¤·¤Æ¤¤¤ë¡£
166 .TP
167 .B EINVAL
168 .\" .I len
169 .\" is zero,
170 .I len
171 ¤ÎÃͤ¬Éé¡¢
172 .I addr
173 ¤¬¥Ú¡¼¥¸¶­³¦¤Ç¤Ê¤¤¡¢
174 .I advice
175 ¤¬Àµ¤·¤¤ÃͤǤʤ¤¡¢
176 ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤¬¥í¥Ã¥¯¤µ¤ì¤¿¥Ú¡¼¥¸¤ä¶¦Í­¥Ú¡¼¥¸¤ò
177 .RB ( MADV_DONTNEED
178 ¤Ç) ²òÊü¤·¤è¤¦¤È¤·¤Æ¤¤¤ë¡¢¤Ê¤É¡£
179 .TP
180 .B EIO
181 .RB ( MADV_WILLNEED
182 ¤Î¾ì¹ç) ¤³¤ÎÈϰϤΥڡ¼¥¸¥ó¥°¤ò¹Ô¤¦¤È¡¢
183 ¥×¥í¥»¥¹¤Î RSS (resident set size) ¤ÎºÇÂçÃͤò±Û¤¨¤Æ¤·¤Þ¤¦¡£
184 .\"nakano RSS ¤ÏÌõ¸ì¤¬¤¢¤ê¤Þ¤·¤¿¤Ã¤±?
185 .TP
186 .B ENOMEM
187 .RB ( MADV_WILLNEED
188 ¤Î¾ì¹ç) ¥á¥â¥ê¤¬Â­¤ê¤º¡¢¥Ú¡¼¥¸¥ó¥°¤Ë¼ºÇÔ¤·¤¿¡£
189 .TP
190 .B ENOMEM
191 »ØÄꤷ¤¿ÈϰϤΥ¢¥É¥ì¥¹¤¬¡¢¸½ºß¥Þ¥Ã¥×¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
192 ¤¢¤ë¤¤¤Ï¥×¥í¥»¥¹¤Î¥¢¥É¥ì¥¹¶õ´Ö¤ÎÆâÉô¤Ë¤Ê¤¤¡£
193 .SH ½àµò
194 POSIX.1b.
195 POSIX.1-2001 ¤Ç¤Ï¡¢
196 .BR posix_madvise (3)
197 .\" FIXME . Write a posix_fadvise(3) page.
198 ¤ò
199 .B POSIX_MADV_NORMAL
200 ¤Ê¤É¤ÎÄê¿ô¤È¤È¤â¤Ëµ­½Ò¤·¤Æ¤¤¤¿
201 (¤½¤ì¤¾¤ì¤Î¿¶¤ëÉñ¤¤¤Ï¤³¤³¤Ç½Ò¤Ù¤¿¤â¤Î¤Ë¶á¤¤)¡£
202 ¥Õ¥¡¥¤¥ë¥¢¥¯¥»¥¹¤ËÂФ·¤Æ¤â
203 .BR posix_fadvise (2)
204 ¤È¤¤¤¦Îà»÷¤Î´Ø¿ô¤¬Â¸ºß¤¹¤ë¡£
205
206 .BR MADV_REMOVE ,
207 .BR MADV_DONTFORK ,
208 .B MADV_DOFORK
209 ¤Ï Linux ¸ÇÍ­¤Ç¤¢¤ë¡£
210 .SH Ãí°Õ
211 .SS "Linux ¤Ç¤ÎÃí°Õ"
212 ¸½ºß¤Î Linux ¤Î¼ÂÁõ (2.4.0) ¤Ç¤Ï¡¢
213 ¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤ò¥¢¥É¥Ð¥¤¥¹¤È¤¤¤¦¤è¤ê¤ÏÌ¿Îá¤È¸«¤Æ¤¤¤ë¡£
214 ¤·¤¿¤¬¤Ã¤Æ¤³¤Î¥¢¥É¥Ð¥¤¥¹¤ËÂФ·¤ÆÄ̾ï¹Ô¤ï¤ì¤ëÆ°ºî¤¬ÉÔ²Äǽ¤Ê¾ì¹ç¤Ï¡¢
215 ¥¨¥é¡¼¤òÊÖ¤¹¤³¤È¤¬¤¢¤ë (¾åµ­¤Î ¥¨¥é¡¼ ¤Îµ­½Ò¤ò»²¾È)¡£
216 ¤³¤Î¿¶Éñ¤¤¤Ïɸ½à¤È¤Ï°Û¤Ê¤ë¡£
217 .LP
218 Linux ¤Î¼ÂÁõ¤Ç¤Ï
219 .I addr
220 ¤Î¥¢¥É¥ì¥¹¤Ï¥Ú¡¼¥¸¶­³¦¤ÎÃͤǤʤ±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£¤Þ¤¿
221 .I length
222 ¤Ï 0 ¤Ç¤¢¤Ã¤Æ¤â¹½¤ï¤Ê¤¤¡£
223 ¤Þ¤¿ Linux ÈǤÎ
224 .BR madvise ()
225 ¤Ç¤Ï¡¢»ØÄꤵ¤ì¤¿¥¢¥É¥ì¥¹ÈϰϤ˥ޥåפµ¤ì¤Æ¤¤¤Ê¤¤Éôʬ¤¬¤¢¤ë¤È¡¢
226 ¤³¤ì¤é¤ò̵»ë¤·¤Æ»Ä¤ê¤ÎÉôʬ¤Ë¥¢¥É¥Ð¥¤¥¹¤òŬÍѤ¹¤ë
227 (¤·¤«¤·¥·¥¹¥Æ¥à¥³¡¼¥ë¤ËÂФ·¤Æ¤Ï¤Á¤ã¤ó¤È
228 .B ENOMEM
229 ¤òÊÖ¤¹)¡£
230 .\" .SH Îò»Ë
231 .\" .BR madvise ()
232 .\" ´Ø¿ô¤Ï 4.4BSD ¤ÇºÇ½é¤ËÅо줷¤¿¡£
233 .SH ´ØÏ¢¹àÌÜ
234 .BR getrlimit (2),
235 .BR mincore (2),
236 .BR mmap (2),
237 .BR mprotect (2),
238 .BR msync (2),
239 .BR munmap (2)