OSDN Git Service

(split) Convert release and draft pages to UTF-8.
[linuxjm/LDP_man-pages.git] / release / 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 .SH 名前
37 msync \- ファイルをマップしたメモリと同期させる
38 .SH 書式
39 .B #include <sys/mman.h>
40 .sp
41 .BI "int msync(void *" addr ", size_t " length ", int " flags );
42 .SH 説明
43 .BR msync ()
44
45 .BR mmap (2)
46 を使ってメモリにマップされたファイルの、
47 メモリ上のコピーになされた変更をディスクに反映させる。
48 この関数を使用しないと、
49 .BR munmap (2)
50 が呼び出されるまで変更が書き戻される保証はない。
51 より正確には、ファイルのうち
52 .I addr
53 から始まり長さ
54 .I length
55 のメモリ領域に対応する部分が更新される。
56
57 .I flags
58 引数にはビット
59 .BR MS_ASYNC ,
60 .BR MS_SYNC ,
61 .B MS_INVALIDATE
62 を設定することができるが、
63 .B MS_ASYNC
64
65 .B MS_SYNC
66 を同時に指定することはできない。
67 .B MS_ASYNC
68 は更新を予定に組み込むことを表し、呼び出しは直ちに返る。
69 .B MS_SYNC
70 は更新を要求し、更新が完了するまで待つ。
71 .B MS_INVALIDATE
72 は(たった今書き込んだ新しい値でマッピングを更新することができるように)
73 同じファイルに対する他のマッピングを無効にすることを要求する。
74 .SH 返り値
75 成功した場合、 0 が返る。エラーの場合、 \-1 が返り、
76 .I errno
77 が適切に設定される。
78 .SH エラー
79 .TP
80 .B EBUSY
81 I flags
82
83 .B MS_INVALIDATE
84 が指定されたが、指定されたアドレス範囲にロックが存在する。
85 .TP
86 .B EINVAL
87 .I addr
88 が PAGESIZE の倍数でない。または、
89 .I flags
90
91 .BR MS_ASYNC 、 MS_INVALIDATE 、 MS_SYNC
92 以外のビットが設定された。
93 または、
94 .I flags
95
96 .B MS_SYNC
97
98 .B MS_ASYNC
99 の両方が設定された。
100 .TP
101 .B ENOMEM
102 指定されたメモリ (またはその一部) がマップされていない。
103 .SH 準拠
104 POSIX.1-2001.
105
106 この関数は Linux 1.3.21 で導入されたが、
107 .B ENOMEM
108 ではなく
109 .B EFAULT
110 が使われていた。
111 これは Linux 2.4.19 で POSIX における値
112 .B ENOMEM
113 に変更された。
114 .SH 可用性
115 .BR msync ()
116 が使用可能な POSIX システムでは
117 .B _POSIX_MAPPED_FILES
118
119 .B _POSIX_SYNCHRONIZED_IO
120 の両方が \fI<unistd.h>\fP で 0 より大きい値に定義される。
121 .RB ( sysconf (3)
122 を参照すること。 )
123 .\" POSIX.1-2001: これらの値は -1 または 0 または 200112L と定義される。
124 .\" -1 は使用不可能、 0 は sysconf() に問い合わせる
125 .\" glibc では 1 と定義している。
126 .SH 関連項目
127 .BR mmap (2)
128 .br
129 B.O. Gallmeister, POSIX.4, O'Reilly, pp. 128-129 and 389-391.