unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (SunOS-4.1.3)
Page:
Section:
Apropos / Subsearch:
optional field

FSYNC(2)                      System Calls Manual                     FSYNC(2)



NAME
       fsync - synchronize a file's in-core state with that on disk

SYNOPSIS
       int fsync(fd)

       int fd;

DESCRIPTION
       fsync()  moves  all  modified  data and attributes of fd to a permanent
       storage device: all in-core modified copies of buffers for the  associ-
       ated  file  have  been  written to a disk when the call returns.  Note:
       this is different than sync(2) which schedules disk I/O for  all  files
       (as  though  an  fsync() had been done on all files) but returns before
       the I/O completes.

       fsync() should be used by programs which require a  file  to  be  in  a
       known state; for example, a program which contains a simple transaction
       facility might use it to ensure that all modifications  to  a  file  or
       files caused by a transaction were recorded on disk.

RETURN VALUES
       fsync() returns:

       0      on success.

       -1     on failure and sets errno to indicate the error.

ERRORS
       EBADF          fd is not a valid descriptor.

       EINVAL         fd refers to a socket, not a file.

       EIO            An  I/O  error occurred while reading from or writing to
                      the file system.

SEE ALSO
       cron(8), sync(2)



                                21 January 1990                       FSYNC(2)