.\" Hey Emacs! This file is -*- nroff -*- source. .\" .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu) .\" .\" 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. .\" .\" Modified 21 Aug 1994 by Michael Chastain : .\" Removed note about old libc (pre-4.5.26) translating to 'sync'. .\" Modified 15 Apr 1995 by Michael Chastain : .\" Added `see also' section. .\" Modified 13 Apr 1996 by Markus Kuhn .\" Added remarks about fdatasync. .\" Modified 31 Jan 1997 by Eric S. Raymond .\" Modified 18 Apr 2001 by Andi Kleen .\" Fix description to describe what it really does; add a few caveats. .\" Translated 25 Dec 1995 Miguel A. Sepulveda (miguel@typhoon.harvard.edu) .\" Modified 1 Jul 1996 Miguel A. Sepulveda (angel@vivaldi.princeton.edu) .\" Spanish version updated Mon 21 Jul 1997 by Nicolás Lichtmaier .\" Revisado por Miguel Pérez Ibars el 11-noviembre-2004 .\" .TH FSYNC 2 "18 abril 2001" "Linux 1.3.85" "Manual del Programador de Linux" .SH NOMBRE fsync, fdatasync \- sincroniza el estado completo en memoria de un fichero con el del disco .SH SINOPSIS .B #include .sp .BI "int fsync(int " fd ); .sp .BI "int fdatasync(int " fd ); .SH DESCRIPCIÓN .B fsync copia todas las partes que están en memoria de un fichero a disco, y espera hasta que el dispositivo avise de que todas las partes se encuentran en almacenamiento estable. También actualiza información de estado de metadatos. No garantiza necesariamente que la entrada en el directorio que contiene el fichero haya llegado también a disco. Para ello se necesita también una llamada explícita a .B fsync sobre el descriptor de fichero del directorio. .B fdatasync hace lo mismo que .B fsync pero solo vacía los datos de usuario, no los meta datos como el valor mtime o el valor atime. .SH "VALOR DEVUELTO" En caso de éxito, devuelve 0. En caso de error, \-1, y la variable .I errno toma un valor apropiado. .SH ERRORES .TP .B EBADF .B fd no es un descriptor de fichero válido para escribir. .TP .BR EROFS ", " EINVAL .B fd está enlazado a un fichero especial que no admite sincronización. .TP .B EIO Ha ocurrido un error durante la sincronización. .SH OBSERVACIONES En caso de que el disco duro tenga habilitada la escritura en caché, los datos pueden no estar realmente en almacenamiento permanente cuando .BR fsync / fdatasync regrese. .\" Vea .\" .BR hdparm (8) .\" para saber como desactivar esa caché en los discos IDE. .LP Cuando se monta un sistema de ficheros ext2 con la opción .IR sync , las entradas de directorio son sincronizadas implícitamente también por .BR fsync . .LP En versiones del núcleo anteriores a la 2.4, .B fsync puede ser ineficiente sobre ficheros grandes. Una alternativa puede ser usar la opción .I O_SYNC en .BR open (2). .SH "CONFORME A" POSIX.1b (anteriormente POSIX.4) .SH "VÉASE TAMBIÉN" .BR bdflush (2), .BR open (2), .BR sync (2), .\" .BR hdparm (8), .BR mount (8), .BR update (8), .BR sync (8)