Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fcntl(2)

fcntl(5)

open(2)

select(2)

sync(2)

sync(1M)

fsync(2)

NAME

fsync − synchronize a file’s in-core state with its state on disk

SYNOPSIS

#include <unistd.h>

int fsync(int fildes);

DESCRIPTION

fsync() causes all modified data and attributes of fildes to be moved to a permanent storage device.  This normally results in all in-core modified copies of buffers for the associated file to be written to a disk.  fsync() applies to ordinary files, and applies to block special devices on systems which permit I/O to block special devices. 

fsync() should be used by programs that require a file to be in a known state; such as when building a simple transaction facility. 

RETURN VALUE

fsync() returns 0 on success or −1 if an error error occurs, and sets errno to indicate the error. 

ERRORS

fsync fails if any of the following conditions are encountered:

[EBADF] fildes is not a valid descriptor. 

[EINVAL] fildes refers to a file type to which fsync() does not apply. 

WARNINGS

The current implementation of this function is inefficient for large files. 

AUTHOR

fsync() was developed by the the University of California, Berkeley and HP. 

SEE ALSO

fcntl(2), fcntl(5), open(2), select(2), sync(2), sync(1M). 

STANDARDS CONFORMANCE

fsync(): AES, XPG3, XPG4

Hewlett-Packard Company  —  HP-UX Release 9.0: August 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026