4.4BSD snapshot (revision 8.1); add 1993 to copyright
[unix-history] / usr / src / lib / libc / sys / sync.2
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" %sccs.include.redist.man%
.\"
.\" @(#)sync.2 8.1 (Berkeley) %G%
.\"
.Dd
.Dt SYNC 2
.Os BSD 4
.Sh NAME
.Nm sync
.Nd "synchronize disk block in-core status with that on disk"
.Sh SYNOPSIS
.Fd #include <unistd.h>
.Ft void
.Fn sync void
.Sh DESCRIPTION
The
.Fn sync
function forces a write of dirty (modified) buffers
in the block buffer cache out
to disk. The kernel keeps this information in core to reduce
the number of disk I/O transfers required by the system.
As information in the cache is lost after a system crash a
.Fn sync
call is issued
frequently
by the user process
.Xr update 8
(about every 30 seconds).
.Pp
The function
.Xr fsync 2
may be used to synchronize individual file descriptor
attributes.
.Sh SEE ALSO
.Xr fsync 2 ,
.Xr sync 8 ,
.Xr update 8
.Sh BUGS
.Fn Sync
may return before the buffers are completely flushed.
.Sh HISTORY
A
.Nm
function call appeared in Version 6 AT&T UNIX.