1FSYNC(2) System Calls Manual FSYNC(2)
2
3
4
6 fsync - synchronize a file's in-core state with that on disk
7
9 fsync(fd)
10 int fd;
11
13 Fsync causes all modified data and attributes of fd to be moved to a
14 permanent storage device. This normally results in all in-core modi‐
15 fied copies of buffers for the associated file to be written to a disk.
16
17 Fsync should be used by programs that require a file to be in a known
18 state, for example, in building a simple transaction facility.
19
21 A 0 value is returned on success. A -1 value indicates an error.
22
24 The fsync fails if:
25
26 [EBADF] Fd is not a valid descriptor.
27
28 [EINVAL] Fd refers to a socket, not to a file.
29
30 [EIO] An I/O error occurred while reading from or writing to
31 the file system.
32
34 sync(2), sync(8), update(8)
35
36
37
384.2 Berkeley Distribution May 22, 1986 FSYNC(2)