Commit | Line | Data |
---|---|---|
88b3ccf2 KB |
1 | .\" Copyright (c) 1983 The Regents of the University of California. |
2 | .\" All rights reserved. | |
76a31391 | 3 | .\" |
88b3ccf2 KB |
4 | .\" Redistribution and use in source and binary forms are permitted |
5 | .\" provided that the above copyright notice and this paragraph are | |
6 | .\" duplicated in all such forms and that any documentation, | |
7 | .\" advertising materials, and other materials related to such | |
8 | .\" distribution and use acknowledge that the software was developed | |
9 | .\" by the University of California, Berkeley. The name of the | |
10 | .\" University may not be used to endorse or promote products derived | |
11 | .\" from this software without specific prior written permission. | |
12 | .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
13 | .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
14 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
15 | .\" | |
16 | .\" @(#)fsync.2 6.5 (Berkeley) %G% | |
76a31391 | 17 | .\" |
bc55b6ca | 18 | .TH FSYNC 2 "" |
76a31391 KM |
19 | .UC 5 |
20 | .SH NAME | |
21 | fsync \- synchronize a file's in-core state with that on disk | |
22 | .SH SYNOPSIS | |
23 | .ft B | |
24 | fsync(fd) | |
25 | .br | |
26 | int fd; | |
27 | .ft R | |
28 | .SH DESCRIPTION | |
29 | .I Fsync | |
30 | causes all modified data and attributes of \fIfd\fP | |
31 | to be moved to a permanent storage device. | |
32 | This normally results in all in-core modified copies | |
33 | of buffers for the associated file to be written to a disk. | |
34 | .PP | |
35 | .I Fsync | |
b4c94b6d | 36 | should be used by programs that require a file to be |
7b12e899 | 37 | in a known state, for example, in building a simple transaction |
76a31391 KM |
38 | facility. |
39 | .SH "RETURN VALUE | |
40 | A 0 value is returned on success. A \-1 value indicates | |
41 | an error. | |
42 | .SH "ERRORS | |
43 | The \fIfsync\fP fails if: | |
44 | .TP 15 | |
45 | [EBADF] | |
46 | \fIFd\fP is not a valid descriptor. | |
47 | .TP 15 | |
48 | [EINVAL] | |
49 | \fIFd\fP refers to a socket, not to a file. | |
fd690c8b KM |
50 | .TP 15 |
51 | [EIO] | |
52 | An I/O error occurred while reading from or writing to the file system. | |
76a31391 KM |
53 | .SH "SEE ALSO" |
54 | sync(2), sync(8), update(8) |