.\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992 .\" and Copyright (c) 2011 Michael Kerrisk .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\" Modified by Michael Haardt .\" Modified Sat Jul 24 12:02:47 1993 by Rik Faith .\" Modified 15 Apr 1995 by Michael Chastain : .\" Added reference to `bdflush(2)'. .\" Modified 960414 by Andries Brouwer : .\" Added the fact that since 1.3.20 sync actually waits. .\" Modified Tue Oct 22 22:27:07 1996 by Eric S. Raymond .\" Modified 2001-10-10 by aeb, following Michael Kerrisk. .\" 2011-09-07, mtk, Added syncfs() documentation, .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 1997 Daisuke Sato .\" all rights reserved. .\" Translated Sat Apr 19 15:22:53 JST 1997 .\" by Daisuke Sato .\" Modified Sun Mar 21 17:23:38 JST 1999 .\" by HANATAKA Shinya .\" Updated Tue Oct 16 JST 2001 by Kentaro Shirakata .\" Updated Mon Sep 8 JST 2003 by Kentaro Shirakata .\" .TH SYNC 2 2020\-08\-13 Linux "Linux Programmer's Manual" .SH 名前 sync, syncfs \- ファイルシステムキャッシュをディスクに書き込む .SH 書式 \fB#include \fP .PP \fBvoid sync(void);\fP .PP \fBint syncfs(int \fP\fIfd\fP\fB);\fP .PP .RS -4 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .RE .PP \fBsync\fP(): .ad l .RS 4 .\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED _XOPEN_SOURCE\ >=\ 500 || /* Since glibc 2.19: */ _DEFAULT_SOURCE || /* Glibc versions <= 2.19: */ _BSD_SOURCE .RE .ad .PP \fBsyncfs\fP(): .ad l .RS 4 _GNU_SOURCE .RE .ad .SH 説明 \fBsync\fP() causes all pending modifications to filesystem metadata and cached file data to be written to the underlying filesystems. .PP \fBsyncfs\fP() は \fBsync\fP() と同様だが、オープンされたファイルディスクリプター \fIfd\fP が参照するファイルを含むファイルシステムだけを同期する点が異なる。 .SH 返り値 \fBsyncfs\fP() は成功すると 0 を返す。エラーが発生した場合は \-1 を返し、 \fIerrno\fP にエラーを示す値を設定する。 .SH エラー \fBsync\fP() は常に成功する。 .PP \fBsyncfs\fP() は少なくとも以下の理由で失敗する可能性がある: .TP \fBEBADF\fP \fIfd\fP が有効なファイルディスクリプターでない。。 .TP \fBEIO\fP An error occurred during synchronization. This error may relate to data written to any file on the filesystem, or on metadata related to the filesystem itself. .TP \fBENOSPC\fP Disk space was exhausted while synchronizing. .TP \fBENOSPC\fP, \fBEDQUOT\fP Data was written to a files on NFS or another filesystem which does not allocate space at the time of a \fBwrite\fP(2) system call, and some previous write failed due to insufficient storage space. .SH バージョン \fBsyncfs\fP() は Linux 2.6.39 で初めて登場した。 ライブラリによるサポートは glibc バージョン 2.14 で追加された。 .SH 準拠 \fBsync\fP(): POSIX.1\-2001, POSIX.1\-2008, SVr4, 4.3BSD. .PP \fBsyncfs\fP() is Linux 固有である。 .SH 注意 Linux での \fBsync\fP() のプロトタイプは、さまざまな標準規格での規定に準拠し、 glibc 2.2.2 から上述のようになった。 glibc 2.2.1 以前ではプロトタイプは "int sync(void)" で、 \fBsync\fP() は常に 0 を返していた。 .PP According to the standard specification (e.g., POSIX.1\-2001), \fBsync\fP() schedules the writes, but may return before the actual writing is done. However Linux waits for I/O completions, and thus \fBsync\fP() or \fBsyncfs\fP() provide the same guarantees as \fBfsync\fP() called on every file in the system or filesystem respectively. .PP .\" commit 735e4ae5ba28c886d249ad04d3c8cc097dad6336 In mainline kernel versions prior to 5.8, \fBsyncfs\fP() will fail only when passed a bad file descriptor (\fBEBADF\fP). Since Linux 5.8, \fBsyncfs\fP() will also report an error if one or more inodes failed to be written back since the last \fBsyncfs\fP() call. .SH バグ Before version 1.3.20 Linux did not wait for I/O to complete before returning. .SH 関連項目 \fBsync\fP(1), \fBfdatasync\fP(2), \fBfsync\fP(2) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は \%https://www.kernel.org/doc/man\-pages/ に書かれている。