.\" Hey Emacs! This file is -*- nroff -*- source. .\" .\" Copyright (C) 1996 Andries Brouwer (aeb@cwi.nl) .\" Copyright (C) 1996 Markus Kuhn. .\" .\" [This version merged from two independently written pages - aeb] .\" .\" 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. .\" .\" 1996-04-12 Andries Brouwer .\" 1996-04-13 Markus Kuhn .\" .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya .\" all rights reserved. .\" Translated Sat Feb 22 20:10:07 JST 1997 .\" by HANATAKA Shinya .\" Modified Mon May 5 19:46:46 JST 1997 .\" by HANATAKA Shinya .\" Updated & Modified Wed May 19 03:24:56 JST 2004 .\" by Yuichi SATO .\" .\"WORD: core メモリ .\"WORD: synchronize 同期させる .\"WORD: buffer バッファー .\"WORD: flush フラッシュ .\"WORD: access time アクセス時刻 .\"WORD: database データベース .\"WORD: modification time 修正時刻 .\"WORD: inode inode .\"WORD: descriptor ディスクリプター .\" .TH FDATASYNC 2 2007-07-26 "Linux" "Linux Programmer's Manual" .\"O .SH NAME .SH 名前 .\"O fdatasync \- synchronize a file's in-core data with that on disk fdatasync \- ファイルのメモリ上のデータをディスク上のものと同期させる .\"O .SH SYNOPSIS .SH 書式 .B #include .sp .BI "int fdatasync(int " fd ); .sp .in -4n .\"O Feature Test Macro Requirements for glibc (see .\"O .BR feature_test_macros (7)): glibc 向けの機能検査マクロの要件 .RB ( feature_test_macros (7) 参照): .in .sp .BR fdatasync (): _POSIX_C_SOURCE\ >=\ 199309L || _XOPEN_SOURCE\ >=\ 500 .\"O .SH DESCRIPTION .SH 説明 .\"O .BR fdatasync () .\"O flushes all data buffers of a file to disk (before the system .\"O call returns). .\"O It resembles .\"O .BR fsync (2) .\"O but is not required to update metadata such as the file last access time. .BR fdatasync () は (システム・コールから戻る前に) ファイルの全てのデータ・バッファーを ディスクにフラッシュ (flush) する。これは .BR fsync (2) に似ているが、ファイルの最終アクセス時刻といったメタデータを更新しない。 .\"O Applications that access databases or log files often write a tiny .\"O data fragment (e.g., one line in a log file) and then call .\"O .BR fsync (2) .\"O immediately in order to ensure that the written data is physically .\"O stored on the harddisk. .\"O Unfortunately, .\"O .BR fsync (2) .\"O will always initiate two write operations: one for the newly written .\"O data and another one in order to update the modification time stored .\"O in the inode. .\"O If the modification time is not a part of the transaction .\"O concept .\"O .BR fdatasync () .\"O can be used to avoid unnecessary inode disk write operations. データベースにアクセスしたり、ログ・ファイルに書き込むような アプリケーションはしばしば小さなデータの断片 (例えばログ・ファイルの一行) を書き込み、それがハードディスクに物理的に格納されることを保証する ために、すぐに .BR fsync (2) を呼び出す。不幸なことに、 .BR fsync (2) は常に二回の書き込み操作を行なう: 一つは新しく書き込まれたデータを、 もう一つは inode の修正時刻を更新するために。修正時刻がトラザンクション に関係なければ、 .BR fdatasync () を使用することで不必要なディスクへの inode の書き込み処理を 避けることができる。 .\"O .SH "RETURN VALUE" .SH 返り値 .\"O On success, zero is returned. .\"O On error, \-1 is returned, and .\"O .I errno .\"O is set appropriately. 成功した場合は 0 が返される。エラーの場合は \-1 を返し、 .I errno に適切な値が設定される。 .\"O .SH ERRORS .SH エラー .TP .B EBADF .\"O .I fd .\"O is not a valid file descriptor open for writing. .I fd が書き込みのためにオープンされた有効なファイル・ディスクリプターではない。 .TP .B EIO .\"O An error occurred during synchronization. 同期操作の間にエラーが起こった。 .TP .BR EROFS ", " EINVAL .\"O .I fd .\"O is bound to a special file which does not support synchronization. .I fd が同期操作をサポートしていない特殊なファイルを参照している。 .\"O .SH "CONFORMING TO" .SH 準拠 POSIX.1-2001. .\"O .SH AVAILABILITY .SH 可用性 .\"O On POSIX systems on which .\"O .BR fdatasync () .\"O is available, .\"O .B _POSIX_SYNCHRONIZED_IO .\"O is defined in .\"O .I .\"O to a value greater than 0. .\"O (See also .\"O .BR sysconf (3).) .BR fdatasync () が利用可能な POSIX システムでは、 .I において .B _POSIX_SYNCHRONIZED_IO が 0 より大きい値に定義されている .RB ( sysconf (3) を参照すること)。 .\"O .\" POSIX.1-2001: It shall be defined to -1 or 0 or 200112L. .\"O .\" -1: unavailable, 0: ask using sysconf(). .\"O .\" glibc defines them to 1. .\" POSIX.1-2001 では、この値を -1, 0, 200112L の .\" どれかに定義すべきとしている。 .\" -1 は使用不可、0 は sysconf() を使って尋ねるという意味である。 .\" glibc では、この値を 1 としている。 .\"O .SH NOTES .SH 注意 .\"O In Linux 2.2 and earlier, .\"O .BR fdatasync () .\"O is equivalent to .\"O .BR fsync (2), .\"O and so has no performance advantage. Linux 2.2 以前では、 .BR fdatasync () は .BR fsync (2) と等価であり、したがって性能上の利点もない。 .\"O .SH "SEE ALSO" .SH 関連項目 .BR fsync (2), .BR sync_file_range (2) .br B.O. Gallmeister, POSIX.4, O'Reilly, pp. 220-223 and 343.