Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

fdatasync(2) [hpux man page]

fsync(2)							System Calls Manual							  fsync(2)

NAME
fsync, fdatasync - synchronize a file's in-core and on-disk states SYNOPSIS
DESCRIPTION
and cause all modified data and attributes of fildes to be moved to a permanent storage device. This normally results in all in-core modi- fied copies of buffers for the associated file to be written to a disk. and apply to ordinary files, and apply to block special devices on systems which permit I/O to block special devices. and should be used by programs that require a file to be in a known state, such as when building a simple transaction facility. causes all modified data and file attributes of fildes required to retrieve the data to be written to disk. causes all modified data and all file attributes of fildes (including access time, modification time and status change time) to be written to disk. Together, and constitute support for File Synchronization. RETURN VALUE
and return 0 on success or -1 if an error occurs, and set to indicate the error. ERRORS
fsync and fdatasync fail if any of the following conditions are encountered: [EBADF] fildes is not a valid descriptor. [EINVAL] fildes refers to a file type to which or does not apply. WARNINGS
The current implementation of these functions is inefficient for large files. AUTHOR
was developed by the University of California, Berkeley and HP. SEE ALSO
fcntl(2), fcntl(5), open(2), select(2), sync(2), sync(1M), unistd(5). STANDARDS CONFORMANCE
fsync(2)

Check Out this Related Man Page

fsync(3C)						   Standard C Library Functions 						 fsync(3C)

NAME
fsync - synchronize changes to a file SYNOPSIS
#include <unistd.h> int fsync(int fildes); DESCRIPTION
The fsync() function moves all modified data and attributes of the file descriptor fildes to a storage device. When fsync() returns, all in-memory modified copies of buffers associated with fildes have been written to the physical medium. The fsync() function is different from sync(), which schedules disk I/O for all files but returns before the I/O completes. The fsync() function forces all outstanding data operations to synchronized file integrity completion (see fcntl.h(3HEAD) definition of O_SYNC.) The fsync() function forces all currently queued I/O operations associated with the file indicated by the file descriptor fildes to the synchronized I/O completion state. All I/O operations are completed as defined for synchronized I/O file integrity completion. RETURN VALUES
Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error. If the fsync() function fails, outstanding I/O operations are not guaranteed to have been completed. ERRORS
The fsync() function will fail if: EBADF The fildes argument is not a valid file descriptor. EINTR A signal was caught during execution of the fsync() function. EIO An I/O error occurred while reading from or writing to the file system. ENOSPC There was no free space remaining on the device containing the file. ETIMEDOUT Remote connection timed out. This occurs when the file is on an NFS file system mounted with the soft option. See mount_nfs(1M). In the event that any of the queued I/O operations fail, fsync() returns the error conditions defined for read(2) and write(2). USAGE
The fsync() function should be used by applications that require that a file be in a known state. For example, an application that contains a simple transaction facility might use fsync() to ensure that all changes to a file or files caused by a given transaction were recorded on a storage medium. The manner in which the data reach the physical medium depends on both implementation and hardware. The fsync() function returns when notified by the device driver that the write has taken place. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |MT-Level |Async-Signal-Safe | +-----------------------------+-----------------------------+ |Standard |See standards(5). | +-----------------------------+-----------------------------+ SEE ALSO
mount_nfs(1M), read(2), sync(2), write(2), fcntl.h(3HEAD), fdatasync(3C), attributes(5), standards(5) SunOS 5.11 5 Feb 2008 fsync(3C)
Man Page