Commit | Line | Data |
---|---|---|
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 | .\" | |
7b12e899 | 5 | .\" @(#)fsync.2 6.4 (Berkeley) %G% |
76a31391 | 6 | .\" |
bc55b6ca | 7 | .TH FSYNC 2 "" |
76a31391 KM |
8 | .UC 5 |
9 | .SH NAME | |
10 | fsync \- synchronize a file's in-core state with that on disk | |
11 | .SH SYNOPSIS | |
12 | .ft B | |
13 | fsync(fd) | |
14 | .br | |
15 | int fd; | |
16 | .ft R | |
17 | .SH DESCRIPTION | |
18 | .I Fsync | |
19 | causes all modified data and attributes of \fIfd\fP | |
20 | to be moved to a permanent storage device. | |
21 | This normally results in all in-core modified copies | |
22 | of buffers for the associated file to be written to a disk. | |
23 | .PP | |
24 | .I Fsync | |
b4c94b6d | 25 | should be used by programs that require a file to be |
7b12e899 | 26 | in a known state, for example, in building a simple transaction |
76a31391 KM |
27 | facility. |
28 | .SH "RETURN VALUE | |
29 | A 0 value is returned on success. A \-1 value indicates | |
30 | an error. | |
31 | .SH "ERRORS | |
32 | The \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. | |
fd690c8b KM |
39 | .TP 15 |
40 | [EIO] | |
41 | An I/O error occurred while reading from or writing to the file system. | |
76a31391 KM |
42 | .SH "SEE ALSO" |
43 | sync(2), sync(8), update(8) |