xref: /illumos-gate/usr/src/man/man2/sync.2 (revision 8119dad84d6416f13557b0ba8e2aaf9064cbcfd3)
1.\"
2.\"  Copyright 1989 AT&T  Copyright (c) 1997, Sun Microsystems, Inc.  All Rights Reserved
3.\" Copyright 2024 Oxide Computer Company
4.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
5.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
6.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7.Dd July 2, 2024
8.Dt SYNC 2
9.Os
10.Sh NAME
11.Nm sync
12.Nd update super block
13.Sh SYNOPSIS
14.In unistd.h
15.Ft void
16.Fo sync
17.Fa void
18.Fc
19.Sh DESCRIPTION
20The
21.Fn sync
22function writes all information in memory that should be on disk, including
23modified super blocks, modified inodes, and delayed block I/O.
24.Pp
25Unlike
26.Xr fsync 3C ,
27which completes the writing before it returns,
28.Fn sync
29schedules but does not necessarily complete the writing before returning.
30To perform a blocking synchronization of a single file system, use the
31.Xr syncfs 3C
32function.
33.Sh USAGE
34The
35.Fn sync
36function should be used by applications that examine a file system, such as
37.Xr fsck 8 ,
38.Xr df 8 ,
39and is mandatory before rebooting.
40.Sh INTERFACE STABILITY
41.Sy Committed
42.Sh SEE ALSO
43.Xr fsync 3C ,
44.Xr syncfs 3C ,
45.Xr attributes 7 ,
46.Xr standards 7 ,
47.Xr df 8 ,
48.Xr fsck 8
49