Scroll to navigation

SYNC(2) Linux Programmer's Manual SYNC(2)

NOME

sync - svuota i buffer della cache del disco

SINTASSI

#include <unistd.h>
 
void sync(void);
 

Test delle funzioni e requisiti delle macro per glibc (vedere feature_test_macros(7)):
 
sync(): _BSD_SOURCE || _XOPEN_SOURCE >= 500

DESCRIZIONE

sync() prima riversa gli inode nei buffer, poi i buffer sul disco.

ERRORI

Questa funzione termina sempre con successo.

CONFORME A

SVr4, 4.3BSD, POSIX.1-2001.

NOTE

A partire da glibc 2.2.2 il prototipo Linux è come elencato sopra, seguendo i vari standard. In libc4, libc5, e glibc fino a 2.2.1 era "int sync(void)", e sync() restituiva sempre 0.

BACHI

Secondo le specifiche degli standard (per esempio, POSIX.1-2001), sync() programma le scritture, ma potrebbe tornare prima che la scrittura sia eseguita. Tuttavia, a partire dalla versione 1.3.20 di Linux, essa aspetta. (Questo ancora non garantisce l'integrità dei dati: i dischi moderni hanno grandi cache).

VEDERE ANCHE

bdflush(2), fdatasync(2), fsync(2), sync(8), update(8)
26 luglio 2007 Linux