O nás     Inzerce     KontaktSpolehlivé informace o IT již od roku 2011
Hledat
Nepřehlédněte: Usnadní vám práci: Pozoruhodné IT produkty pro rok 2024
Správa dokumentů
Digitální transformace
Informační systémy
Hlavní rubriky: Informační systémy, Mobilní technologie, Datová centra, Sítě, IT bezpečnost, Software, Hardware, Zkušenosti a názory, Speciály

Pozoruhodné IT produkty 2024
E-knihy o IT zdarma
Manuál Linux
[Linux manuál]

fsync, fdatasync: synchronizovat kompletní stav jádra souboru se stavem na disku

Originální popis anglicky: fsync, fdatasync - synchronize a file's complete in-core state with that on disk

Návod, kniha: Linux Programmer's Manual

STRUČNĚ

#include <unistd.h>
 
int fsync(int fd);
 
int fdatasync(int fd);

POPIS / INSTRUKCE

fsync copies all in-core parts of a file to disk, and waits until the device reports that all parts are on stable storage. It also updates metadata stat information. It does not necessarily ensure that the entry in the directory containing the file has also reached disk. For that an explicit fsync on the file descriptor of the directory is also needed.
 
fdatasync does the same as fsync but only flushes user data, not the meta data like the mtime or atime.
 

NÁVRATOVÁ HODNOTA

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

CHYBY / ERRORY

EBADF
fd is not a valid file descriptor open for writing.
EIO
An error occurred during synchronization.
EROFS, EINVAL
fd is bound to a special file which does not support synchronization.

NOTES

In case the hard disk has write cache enabled, the data may not really be on permanent storage when fsync/fdatasync return.
When an ext2 file system is mounted with the sync option, directory entries are also implicitly synced by fsync.
On kernels before 2.4, fsync on big files can be inefficient. An alternative might be to use the O_SYNC flag to open(2).

ODPOVÍDAJÍCÍ

POSIX.1b (formerly POSIX.4)

SOUVISEJÍCÍ

bdflush(2), open(2), sync(2) mount(8), sync(8), update(8)
2001-04-18 Linux 1.3.85
©2011-2024 BusinessIT.cz, ISSN 1805-0522 | Názvy použité v textech mohou být ochrannými známkami příslušných vlastníků.
Provozovatel: Bispiral, s.r.o., kontakt: BusinessIT(at)Bispiral.com | Inzerce: Best Online Media, s.r.o., zuzana@online-media.cz
O vydavateli | Pravidla webu BusinessIT.cz a ochrana soukromí | Používáme účetní program Money S3 | pg(8946)