Man page - syncfs(2)

Packages contains this manual

Available languages:

en fr it pl nl ja ru ro de

Manual

SYNC

名 前
書 式
説 明
返 り 値
エ ラ ー
バ ー ジ ョ ン
準 拠
注 意
バ グ
関 連 項 目
こ の 文 書 に つ い て

名 前

sync, syncfs - フ ァ イ ル シ ス テ ム キ ャ ッ シ ュ を デ ィ ス ク に 書 き 込 む

書 式

#include <unistd.h>

void sync(void);

int syncfs(int fd );

glibc 向 け の 機 能 検 査 マ ク ロ の 要 件 ( feature_test_macros (7) 参 照 ):

sync ():

_XOPEN_SOURCE >= 500
|| /* Since glibc 2.19: */ _DEFAULT_SOURCE
|| /* Glibc versions <= 2.19: */ _BSD_SOURCE

syncfs ():

_GNU_SOURCE

説 明

sync () causes all pending modifications to filesystem metadata and cached file data to be written to the underlying filesystems.

syncfs () は sync () と 同 様 だ が 、 オ ー プ ン さ れ た フ ァ イ ル デ ィ ス ク リ プ タ ー fd が 参 照 す る フ ァ イ ル を 含 む フ ァ イ ル シ ス テ ム だ け を 同 期 す る 点 が 異 な る 。

返 り 値

syncfs () は 成 功 す る と 0 を 返 す 。 エ ラ ー が 発 生 し た 場 合 は -1 を 返 し 、 errno に エ ラ ー を 示 す 値 を 設 定 す る 。

エ ラ ー

sync () は 常 に 成 功 す る 。

syncfs () は 少 な く と も 以 下 の 理 由 で 失 敗 す る 可 能 性 が あ る :

EBADF

fd が 有 効 な フ ァ イ ル デ ィ ス ク リ プ タ ー で な い 。 。

EIO

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.

ENOSPC

Disk space was exhausted while synchronizing.

ENOSPC , EDQUOT

Data was written to a files on NFS or another filesystem which does not allocate space at the time of a write (2) system call, and some previous write failed due to insufficient storage space.

バ ー ジ ョ ン

syncfs () は Linux 2.6.39 で 初 め て 登 場 し た 。 ラ イ ブ ラ リ に よ る サ ポ ー ト は glibc バ ー ジ ョ ン 2.14 で 追 加 さ れ た 。

準 拠

sync (): POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.

syncfs () is Linux 固 有 で あ る 。

注 意

Linux で の sync () の プ ロ ト タ イ プ は 、 さ ま ざ ま な 標 準 規 格 で の 規 定 に 準 拠 し 、 glibc 2.2.2 か ら 上 述 の よ う に な っ た 。 glibc 2.2.1 以 前 で は プ ロ ト タ イ プ は "int sync(void)" で 、 sync () は 常 に 0 を 返 し て い た 。

According to the standard specification (e.g., POSIX.1-2001), sync () schedules the writes, but may return before the actual writing is done. However Linux waits for I/O completions, and thus sync () or syncfs () provide the same guarantees as fsync () called on every file in the system or filesystem respectively.

In mainline kernel versions prior to 5.8, syncfs () will fail only when passed a bad file descriptor ( EBADF ). Since Linux 5.8, syncfs () will also report an error if one or more inodes failed to be written back since the last syncfs () call.

バ グ

Before version 1.3.20 Linux did not wait for I/O to complete before returning.

関 連 項 目

sync (1), fdatasync (2), fsync (2)

こ の 文 書 に つ い て

こ の man ペ ー ジ は Linux man-pages プ ロ ジ ェ ク ト の リ リ ー ス 5.10 の 一 部 で あ る 。 プ ロ ジ ェ ク ト の 説 明 と バ グ 報 告 に 関 す る 情 報 は https://www.kernel.org/doc/man-pages/ に 書 か れ て い る 。