OSDN Git Service

(split) LDP: Restore and add Copyrights for draft pages
[linuxjm/LDP_man-pages.git] / draft / man2 / sync.2
1 .\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992
2 .\" and Copyright (c) 2011 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
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 .\" %%%LICENSE_END
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 .\"
42 .\" Japanese Version Copyright (c) 1997 Daisuke Sato
43 .\"         all rights reserved.
44 .\" Translated Sat Apr 19 15:22:53 JST 1997
45 .\"         by Daisuke Sato
46 .\" Modified Sun Mar 21 17:23:38 JST 1999
47 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
48 .\" Updated Tue Oct 16 JST 2001 by Kentaro Shirakata <argrath@ub32.org>
49 .\" Updated Mon Sep  8 JST 2003 by Kentaro Shirakata <argrath@ub32.org>
50 .\"
51 .TH SYNC 2 2012\-05\-04 Linux "Linux Programmer's Manual"
52 .SH 名前
53 sync, syncfs \- バッファキャッシュをディスクに書き込む
54 .SH 書式
55 \fB#include <unistd.h>\fP
56 .sp
57 \fBvoid sync(void);\fP
58 .sp
59 \fBint syncfs(int \fP\fIfd\fP\fB);\fP
60 .sp
61 .in -4n
62 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
63 .in
64 .sp
65 \fBsync\fP():
66 .ad l
67 .RS 4
68 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
69 .RE
70 .ad
71 .sp
72 \fBsyncfs\fP():
73 .ad l
74 .RS 4
75 _GNU_SOURCE
76 .RE
77 .ad
78 .SH 説明
79 \fBsync\fP() を呼び出すと、バッファされたファイルのメタデータとデータ本体に
80 対して行われた全ての変更が、対応するファイルシステムに書き込まれる。
81
82 \fBsyncfs\fP() は \fBsync\fP() と同様だが、オープンされたファイルディスクリプタ \fIfd\fP
83 が参照するファイルを含むファイルシステムだけを同期する点が異なる。
84 .SH 返り値
85 \fBsyncfs\fP() は成功すると 0 を返す。エラーが発生した場合は \-1 を返し、
86 \fIerrno\fP にエラーを示す値を設定する。
87 .SH エラー
88 \fBsync\fP() は常に成功する。
89
90 \fBsyncfs\fP() は少なくとも以下の理由で失敗する可能性がある:
91 .TP 
92 \fBEBADF\fP
93 \fIfd\fP が有効なファイルディスクリプタでない。。
94 .SH バージョン
95 \fBsyncfs\fP() は Linux 2.6.39 で初めて登場した。
96 ライブラリによるサポートは glibc バージョン 2.14 で追加された。
97 .SH 準拠
98 \fBsync\fP(): SVr4, 4.3BSD, POSIX.1\-2001.
99
100 \fBsyncfs\fP() is Linux 固有である。
101 .SH 注意
102 Linux での \fBsync\fP() のプロトタイプは、さまざまな標準規格での規定に準拠し、
103 glibc 2.2.2 から上述のようになった。
104 libc4, libc5 と、2.2.1 までの glibc ではプロトタイプは "int sync(void)" で、
105 \fBsync\fP()  は常に 0 を返していた。
106 .SH バグ
107 標準規格 (例えば POSIX.1\-2001) によると、
108 \fBsync\fP()
109 は書き込むことを予定に
110 組み込むのみで実際に書き込みが終了する前に戻ってもよいことになっている。
111 一方で Linux はバージョン 1.3.20 からは書き込みが終了するまで待つ。
112 (最近のディスクは大きなキャッシュを持っているため、
113  これはデータの完全性 (data integrity) までは保証していない。)
114 .SH 関連項目
115 \fBbdflush\fP(2), \fBfdatasync\fP(2), \fBfsync\fP(2), \fBsync\fP(8), \fBupdate\fP(8)
116 .SH この文書について
117 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部
118 である。プロジェクトの説明とバグ報告に関する情報は
119 http://www.kernel.org/doc/man\-pages/ に書かれている。