one too many levels of indirection (from ks@purdue)
[unix-history] / usr / src / lib / libc / sys / fsync.2
CommitLineData
76a31391
KM
1.\" Copyright (c) 1983 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
b4c94b6d 5.\" @(#)fsync.2 6.2 (Berkeley) %G%
76a31391 6.\"
bc55b6ca 7.TH FSYNC 2 ""
76a31391
KM
8.UC 5
9.SH NAME
10fsync \- synchronize a file's in-core state with that on disk
11.SH SYNOPSIS
12.ft B
13fsync(fd)
14.br
15int fd;
16.ft R
17.SH DESCRIPTION
18.I Fsync
19causes all modified data and attributes of \fIfd\fP
20to be moved to a permanent storage device.
21This normally results in all in-core modified copies
22of buffers for the associated file to be written to a disk.
23.PP
24.I Fsync
b4c94b6d 25should be used by programs that require a file to be
76a31391
KM
26in a known state; for example in building a simple transaction
27facility.
28.SH "RETURN VALUE
29A 0 value is returned on success. A \-1 value indicates
30an error.
31.SH "ERRORS
32The \fIfsync\fP fails if:
33.TP 15
34[EBADF]
35\fIFd\fP is not a valid descriptor.
36.TP 15
37[EINVAL]
38\fIFd\fP refers to a socket, not to a file.
39.SH "SEE ALSO"
40sync(2), sync(8), update(8)