5.4. Data consistency and durability
5.4 Data consistency and durability
This section contains a brief overview of data and metadata consistency and durability issues when doing I/O.
With respect to durability, GNU Fortran makes no effort to ensure that data is committed to stable storage. If this is required, the GNU Fortran programmer can use the intrinsic FNUM
to retrieve the low level file descriptor corresponding to an open Fortran unit. Then, using e.g. the ISO_C_BINDING
feature, one can call the underlying system call to flush dirty data to stable storage, such as fsync
on POSIX, _commit
on MingW, or fcntl(fd,
F_FULLSYNC, 0)
on Mac OS X. The following example shows how to call fsync:
! Declare the interface for POSIX fsync function interface function fsync (fd) bind(c,name="fsync