fsync man page on SmartOS

Man page or keyword search:  
man Server   16655 pages
apropos Keyword Search (all sections)
Output format
SmartOS logo
[printable version]

FSYNC(3C)							     FSYNC(3C)

       fsync - synchronize changes to a file

       #include <unistd.h>

       int fsync(int fildes);

       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	opera‐
       tions  to  synchronized	file  integrity completion (see fcntl.h(3HEAD)
       definition of O_SYNC.)

       The fsync() function forces all currently queued I/O operations associ‐
       ated  with the file indicated by the file descriptor fildes to the syn‐
       chronized I/O completion state. All I/O	operations  are	 completed  as
       defined for synchronized I/O file integrity completion.

       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.

       The fsync() function will fail if:

		    The fildes argument is not a valid file descriptor.

		    A  signal was caught during execution of the fsync() func‐

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

		    There was no free space remaining on the device containing
		    the file.

		    Remote connection timed out. This occurs when the file  is
		    on	an  NFS file system mounted with the  soft option. See

       In the event that any  of  the  queued  I/O  operations	fail,  fsync()
       returns the error conditions defined for read(2) and write(2).

       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	 noti‐
       fied by the device driver that the write has taken place.

       See attributes(5) for descriptions of the following attributes:

       │Interface Stability │ Committed		│
       │MT-Level	    │ Async-Signal-Safe │
       │Standard	    │ See standards(5). │

       mount_nfs(1M),	read(2),  sync(2),  write(2),  fcntl.h(3HEAD),	fdata‐
       sync(3C), attributes(5), standards(5)

				  Feb 5, 2008			     FSYNC(3C)

List of man pages available for SmartOS

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net