OSDN Git Service

(split) LDP: draft snapshot generated from latest ja.po files.
[linuxjm/LDP_man-pages.git] / draft / man2 / sync.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992
4 .\" and Copyright (c) 2011 Michael Kerrisk <mtk.manpages@gmail.com>
5 .\"
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein.  The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\"
26 .\" Modified by Michael Haardt <michael@moria.de>
27 .\" Modified Sat Jul 24 12:02:47 1993 by Rik Faith <faith@cs.unc.edu>
28 .\" Modified 15 Apr 1995 by Michael Chastain <mec@shell.portal.com>:
29 .\"   Added reference to `bdflush(2)'.
30 .\" Modified 960414 by Andries Brouwer <aeb@cwi.nl>:
31 .\"   Added the fact that since 1.3.20 sync actually waits.
32 .\" Modified Tue Oct 22 22:27:07 1996 by Eric S. Raymond <esr@thyrsus.com>
33 .\" Modified 2001-10-10 by aeb, following Michael Kerrisk.
34 .\" 2011-09-07, mtk, Added syncfs() documentation,
35 .\"
36 .\"*******************************************************************
37 .\"
38 .\" This file was generated with po4a. Translate the source file.
39 .\"
40 .\"*******************************************************************
41 .TH SYNC 2 2012\-02\-12 Linux "Linux Programmer's Manual"
42 .SH 名前
43 sync, syncfs \- バッファキャッシュをディスクに書き込む
44 .SH 書式
45 \fB#include <unistd.h>\fP
46 .sp
47 \fBvoid sync(void);\fP
48 .sp
49 \fBint syncfs(int \fP\fIfd\fP\fB);\fP
50 .sp
51 .in -4n
52 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
53 .in
54 .sp
55 \fBsync\fP():
56 .ad l
57 .RS 4
58 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
59 .RE
60 .ad
61 .sp
62 \fBsyncfs\fP():
63 .ad l
64 .RS 4
65 _GNU_SOURCE
66 .RE
67 .ad
68 .SH 説明
69 \fBsync\fP() を呼び出すと、バッファされたファイルのメタデータとデータ本体に
70 対して行われた全ての変更が、対応するファイルシステムに書き込まれる。
71
72 \fBsyncfs\fP() は \fBsync\fP() と同様だが、オープンされたファイルディスクリプタ \fIfd\fP
73 が参照するファイルを含むファイルシステムだけを同期する点が異なる。
74 .SH 返り値
75 \fBsyncfs\fP() は成功すると 0 を返す。エラーが発生した場合は \-1 を返し、
76 \fIerrno\fP にエラーを示す値を設定する。
77 .SH エラー
78 \fBsync\fP() は常に成功する。
79
80 \fBsyncfs\fP() は少なくとも以下の理由で失敗する可能性がある:
81 .TP 
82 \fBEBADF\fP
83 \fIfd\fP が有効なファイルディスクリプタでない。。
84 .SH バージョン
85 \fBsyncfs\fP() は Linux 2.6.39 で初めて登場した。
86 .SH 準拠
87 \fBsync\fP(): SVr4, 4.3BSD, POSIX.1\-2001.
88
89 \fBsyncfs\fP() is Linux 固有である。
90 .SH 注意
91 Linux での \fBsync\fP() のプロトタイプは、さまざまな標準規格での規定に準拠し、
92 glibc 2.2.2 から上述のようになった。
93 libc4, libc5 と、2.2.1 までの glibc ではプロトタイプは "int sync(void)" で、
94 \fBsync\fP()  は常に 0 を返していた。
95 .SH バグ
96 標準規格 (例えば POSIX.1\-2001) によると、
97 \fBsync\fP()
98 は書き込むことを予定に
99 組み込むのみで実際に書き込みが終了する前に戻ってもよいことになっている。
100 一方で Linux はバージョン 1.3.20 からは書き込みが終了するまで待つ。
101 (最近のディスクは大きなキャッシュを持っているため、
102  これはデータの完全性 (data integrity) までは保証していない。)
103 .SH 関連項目
104 \fBbdflush\fP(2), \fBfdatasync\fP(2), \fBfsync\fP(2), \fBsync\fP(8), \fBupdate\fP(8)