BSD 4_2 development
[unix-history] / usr / man / man2 / fsync.2
CommitLineData
fca9ff2c
C
1.TH FSYNC 2 "12 February 1983"
2.UC 4
3.SH NAME
4fsync \- synchronize a file's in-core state with that on disk
5.SH SYNOPSIS
6.ft B
7fsync(fd)
8.br
9int fd;
10.ft R
11.SH DESCRIPTION
12.I Fsync
13causes all modified data and attributes of \fIfd\fP
14to be moved to a permanent storage device.
15This normally results in all in-core modified copies
16of buffers for the associated file to be written to a disk.
17.PP
18.I Fsync
19should be used by programs which require a file to be
20in a known state; for example in building a simple transaction
21facility.
22.SH "RETURN VALUE
23A 0 value is returned on success. A \-1 value indicates
24an error.
25.SH "ERRORS
26The \fIfsync\fP fails if:
27.TP 15
28[EBADF]
29\fIFd\fP is not a valid descriptor.
30.TP 15
31[EINVAL]
32\fIFd\fP refers to a socket, not to a file.
33.SH "SEE ALSO"
34sync(2), sync(8), update(8)
35.SH BUGS
36The current implementation of this call is expensive for large files.