OSDN Git Service

(split) LDP v3.30, v3.31 の定型的な変更内容を反映。
[linuxjm/LDP_man-pages.git] / draft / man2 / msync.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (C) 1996 Andries Brouwer (aeb@cwi.nl)
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 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
26 .\"         all rights reserved.
27 .\" Translated Sun Feb 23 19:45:43 JST 1997
28 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
29 .\" Updated and revised Fri Oct 24 23:34:51 JST 2003
30 .\"         by Suzuki Takashi.
31 .\" Updated 2007-01-01 by Kentaro Shirakata <argrath@ub32.org>
32 .\"
33 .\"WORD: in-core                ¥á¥â¥ê¾å¤Î
34 .\"
35 .TH MSYNC 2 2008-04-22 "Linux" "Linux Programmer's Manual"
36 .\"O .SH NAME
37 .SH Ì¾Á°
38 .\"O msync \- synchronize a file with a memory map
39 msync \- ¥Õ¥¡¥¤¥ë¤ò¥Þ¥Ã¥×¤·¤¿¥á¥â¥ê¤ÈƱ´ü¤µ¤»¤ë
40 .\"O .SH SYNOPSIS
41 .SH ½ñ¼°
42 .B #include <sys/mman.h>
43 .sp
44 .BI "int msync(void *" addr ", size_t " length ", int " flags );
45 .\"O .SH DESCRIPTION
46 .SH ÀâÌÀ
47 .\"O .BR msync ()
48 .\"O flushes changes made to the in-core copy of a file that was mapped
49 .\"O into memory using
50 .\"O .BR mmap (2)
51 .\"O back to disk.
52 .\"O Without use of this call
53 .\"O there is no guarantee that changes are written back before
54 .\"O .BR munmap (2)
55 .\"O is called.
56 .\"O To be more precise, the part of the file that
57 .\"O corresponds to the memory area starting at
58 .\"O .I addr
59 .\"O and having length
60 .\"O .I length
61 .\"O is updated.
62 .BR msync ()
63 ¤Ï
64 .BR mmap (2)
65 ¤ò»È¤Ã¤Æ¥á¥â¥ê¤Ë¥Þ¥Ã¥×¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤Î¡¢
66 ¥á¥â¥ê¾å¤Î¥³¥Ô¡¼¤Ë¤Ê¤µ¤ì¤¿Êѹ¹¤ò¥Ç¥£¥¹¥¯¤ËÈ¿±Ç¤µ¤»¤ë¡£
67 ¤³¤Î´Ø¿ô¤ò»ÈÍѤ·¤Ê¤¤¤È¡¢
68 .BR munmap (2)
69 ¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¤Þ¤ÇÊѹ¹¤¬½ñ¤­Ìᤵ¤ì¤ëÊݾڤϤʤ¤¡£
70 ¤è¤êÀµ³Î¤Ë¤Ï¡¢¥Õ¥¡¥¤¥ë¤Î¤¦¤Á
71 .I addr
72 ¤«¤é»Ï¤Þ¤êŤµ
73 .I length
74 ¤Î¥á¥â¥êÎΰè¤ËÂбþ¤¹¤ëÉôʬ¤¬¹¹¿·¤µ¤ì¤ë¡£
75
76 .\"O The
77 .\"O .I flags
78 .\"O argument may have the bits
79 .\"O .BR MS_ASYNC ,
80 .\"O .BR MS_SYNC ,
81 .\"O and
82 .\"O .B MS_INVALIDATE
83 .\"O set, but not both
84 .\"O .B MS_ASYNC
85 .\"O and
86 .\"O .BR MS_SYNC .
87 .I flags
88 °ú¿ô¤Ë¤Ï¥Ó¥Ã¥È
89 .BR MS_ASYNC ,
90 .BR MS_SYNC ,
91 .B MS_INVALIDATE
92 ¤òÀßÄꤹ¤ë¤³¤È¤¬¤Ç¤­¤ë¤¬¡¢
93 .B MS_ASYNC
94 ¤È
95 .B MS_SYNC
96 ¤òƱ»þ¤Ë»ØÄꤹ¤ë¤³¤È¤Ï¤Ç¤­¤Ê¤¤¡£
97 .\"O .B MS_ASYNC
98 .\"O specifies that an update be scheduled, but the call
99 .\"O returns immediately.
100 .B MS_ASYNC
101 ¤Ï¹¹¿·¤òͽÄê¤ËÁȤ߹þ¤à¤³¤È¤òɽ¤·¡¢¸Æ¤Ó½Ð¤·¤Ïľ¤Á¤ËÊ֤롣
102 .\"O .B MS_SYNC
103 .\"O asks for an update and waits for it to complete.
104 .B MS_SYNC
105 ¤Ï¹¹¿·¤òÍ׵ᤷ¡¢¹¹¿·¤¬´°Î»¤¹¤ë¤Þ¤ÇÂԤġ£
106 .\"O .B MS_INVALIDATE
107 .\"O asks to invalidate other mappings of the same file
108 .\"O (so that they can be updated with the fresh values just written).
109 .B MS_INVALIDATE
110 ¤Ï(¤¿¤Ã¤¿º£½ñ¤­¹þ¤ó¤À¿·¤·¤¤Ãͤǥޥåԥ󥰤ò¹¹¿·¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¤è¤¦¤Ë)
111 Ʊ¤¸¥Õ¥¡¥¤¥ë¤ËÂФ¹¤ë¾¤Î¥Þ¥Ã¥Ô¥ó¥°¤ò̵¸ú¤Ë¤¹¤ë¤³¤È¤òÍ׵᤹¤ë¡£
112 .\"O .SH "RETURN VALUE"
113 .SH ÊÖ¤êÃÍ
114 .\"O On success, zero is returned.
115 .\"O On error, \-1 is returned, and
116 .\"O .I errno
117 .\"O is set appropriately.
118 À®¸ù¤·¤¿¾ì¹ç¡¢ 0 ¤¬Ê֤롣¥¨¥é¡¼¤Î¾ì¹ç¡¢ \-1 ¤¬Ê֤ꡢ
119 .I errno
120 ¤¬Å¬ÀÚ¤ËÀßÄꤵ¤ì¤ë¡£
121 .\"O .SH ERRORS
122 .SH ¥¨¥é¡¼
123 .TP
124 .B EBUSY
125 .\"O .B MS_INVALIDATE
126 .\"O was specified in
127 .\"O .IR flags ,
128 .\"O and a memory lock exists for the specified address range.
129 I flags
130 ¤Ë
131 .B MS_INVALIDATE
132 ¤¬»ØÄꤵ¤ì¤¿¤¬¡¢»ØÄꤵ¤ì¤¿¥¢¥É¥ì¥¹ÈϰϤ˥í¥Ã¥¯¤¬Â¸ºß¤¹¤ë¡£
133 .TP
134 .B EINVAL
135 .\"O .I addr
136 .\"O is not a multiple of PAGESIZE; or any bit other than
137 .\"O .BR MS_ASYNC " | " MS_INVALIDATE " | " MS_SYNC
138 .\"O is set in
139 .\"O .IR flags ;
140 .\"O or both
141 .\"O .B MS_SYNC
142 .\"O and
143 .\"O .B MS_ASYNC
144 .\"O are set in
145 .\"O .IR flags .
146 .I addr
147 ¤¬ PAGESIZE ¤ÎÇÜ¿ô¤Ç¤Ê¤¤¡£¤Þ¤¿¤Ï¡¢
148 .I flags
149 ¤Ë
150 .BR MS_ASYNC ¡¢ MS_INVALIDATE ¡¢ MS_SYNC
151 °Ê³°¤Î¥Ó¥Ã¥È¤¬ÀßÄꤵ¤ì¤¿¡£
152 ¤Þ¤¿¤Ï¡¢
153 .I flags
154 ¤Ë
155 .B MS_SYNC
156 ¤È
157 .B MS_ASYNC
158 ¤ÎξÊý¤¬ÀßÄꤵ¤ì¤¿¡£
159 .TP
160 .B ENOMEM
161 .\"O The indicated memory (or part of it) was not mapped.
162 »ØÄꤵ¤ì¤¿¥á¥â¥ê (¤Þ¤¿¤Ï¤½¤Î°ìÉô) ¤¬¥Þ¥Ã¥×¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
163 .\"O .SH "CONFORMING TO"
164 .SH ½àµò
165 POSIX.1-2001.
166
167 .\"O This call was introduced in Linux 1.3.21, and then used
168 .\"O .B EFAULT
169 .\"O instead of
170 .\"O .BR ENOMEM .
171 .\"O In Linux 2.4.19 this was changed to the POSIX value
172 .\"O .BR ENOMEM .
173 ¤³¤Î´Ø¿ô¤Ï Linux 1.3.21 ¤ÇƳÆþ¤µ¤ì¤¿¤¬¡¢
174 .B ENOMEM
175 ¤Ç¤Ï¤Ê¤¯
176 .B EFAULT
177 ¤¬»È¤ï¤ì¤Æ¤¤¤¿¡£
178 ¤³¤ì¤Ï Linux 2.4.19 ¤Ç POSIX ¤Ë¤ª¤±¤ëÃÍ
179 .B ENOMEM
180 ¤ËÊѹ¹¤µ¤ì¤¿¡£
181 .\"O .SH AVAILABILITY
182 .SH ²ÄÍÑÀ­
183 .\"O On POSIX systems on which
184 .\"O .BR msync ()
185 .\"O is available, both
186 .\"O .B _POSIX_MAPPED_FILES
187 .\"O and
188 .\"O .B _POSIX_SYNCHRONIZED_IO
189 .\"O are defined in \fI<unistd.h>\fP to a value greater than 0.
190 .\"O (See also
191 .\"O .BR sysconf (3).)
192 .BR msync ()
193 ¤¬»ÈÍѲÄǽ¤Ê POSIX ¥·¥¹¥Æ¥à¤Ç¤Ï
194 .B _POSIX_MAPPED_FILES
195 ¤È
196 .B _POSIX_SYNCHRONIZED_IO
197 ¤ÎξÊý¤¬ \fI<unistd.h>\fP ¤Ç 0 ¤è¤êÂ礭¤¤ÃͤËÄêµÁ¤µ¤ì¤ë¡£
198 .RB ( sysconf (3)
199 ¤ò»²¾È¤¹¤ë¤³¤È¡£ )
200 .\"O .\" POSIX.1-2001: It shall be defined to -1 or 0 or 200112L.
201 .\"O .\" -1: unavailable, 0: ask using sysconf().
202 .\"O .\" glibc defines them to 1.
203 .\" POSIX.1-2001: ¤³¤ì¤é¤ÎÃͤϠ-1 ¤Þ¤¿¤Ï 0 ¤Þ¤¿¤Ï 200112L ¤ÈÄêµÁ¤µ¤ì¤ë¡£
204 .\" -1 ¤Ï»ÈÍÑÉÔ²Äǽ¡¢ 0 ¤Ï sysconf() ¤ËÌ䤤¹ç¤ï¤»¤ë
205 .\" glibc ¤Ç¤Ï 1 ¤ÈÄêµÁ¤·¤Æ¤¤¤ë¡£
206 .\"O .SH "SEE ALSO"
207 .SH ´ØÏ¢¹àÌÜ
208 .BR mmap (2)
209 .br
210 B.O. Gallmeister, POSIX.4, O'Reilly, pp. 128-129 and 389-391.