xref: /original-bsd/lib/libc/sys/sync.2 (revision c3e32dec)
1.\" Copyright (c) 1980, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)sync.2	8.1 (Berkeley) 06/04/93
7.\"
8.Dd
9.Dt SYNC 2
10.Os BSD 4
11.Sh NAME
12.Nm sync
13.Nd "synchronize disk block in-core status with that on disk"
14.Sh SYNOPSIS
15.Fd #include <unistd.h>
16.Ft void
17.Fn sync void
18.Sh DESCRIPTION
19The
20.Fn sync
21function forces a write of dirty (modified) buffers
22in the block buffer cache out
23to disk. The kernel keeps this information in core to reduce
24the number of disk I/O transfers required by the system.
25As information in the cache is lost after a system crash a
26.Fn sync
27call is issued
28frequently
29by the user process
30.Xr update 8
31(about every 30 seconds).
32.Pp
33The function
34.Xr fsync 2
35may be used to synchronize individual file descriptor
36attributes.
37.Sh SEE ALSO
38.Xr fsync 2 ,
39.Xr sync 8 ,
40.Xr update 8
41.Sh BUGS
42.Fn Sync
43may return before the buffers are completely flushed.
44.Sh HISTORY
45A
46.Nm
47function call appeared in Version 6 AT&T UNIX.
48