Upgrading sync
Change-Id: Ied34ebd1d2dc963f5a2af8fc3bbf8e6c94df61cf
This commit is contained in:
parent
b7ef8cfb52
commit
5f59a986e2
11 changed files with 145 additions and 60 deletions
|
@ -1,7 +1,7 @@
|
|||
# $NetBSD: Makefile,v 1.22 2007/12/31 15:31:24 ad Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||
|
||||
SUBDIR= cat date echo ed expr kill ln \
|
||||
mkdir pax pwd rm rmdir test
|
||||
SUBDIR= cat date echo ed expr kill ln ls \
|
||||
mkdir pax pwd rm rmdir sync test
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
|
7
bin/sync/Makefile
Normal file
7
bin/sync/Makefile
Normal file
|
@ -0,0 +1,7 @@
|
|||
# $NetBSD: Makefile,v 1.9 1997/07/20 22:38:07 christos Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||
|
||||
PROG= sync
|
||||
MAN= sync.8
|
||||
|
||||
.include <bsd.prog.mk>
|
72
bin/sync/sync.8
Normal file
72
bin/sync/sync.8
Normal file
|
@ -0,0 +1,72 @@
|
|||
.\" $NetBSD: sync.8,v 1.15 2003/08/07 09:05:42 agc Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1980, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. Neither the name of the University nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)sync.8 8.1 (Berkeley) 5/31/93
|
||||
.\"
|
||||
.Dd May 31, 1993
|
||||
.Dt SYNC 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm sync
|
||||
.Nd force completion of pending disk writes (flush cache)
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
program can be called to ensure that all disk writes have been
|
||||
completed before the processor is halted in a way not suitably done by
|
||||
.Xr reboot 8
|
||||
or
|
||||
.Xr halt 8 .
|
||||
Generally, it is preferable to use
|
||||
.Xr reboot 8
|
||||
or
|
||||
.Xr halt 8
|
||||
to shut down the system,
|
||||
as they may perform additional actions
|
||||
such as resynchronizing the hardware clock
|
||||
and flushing internal caches before performing a final
|
||||
.Nm .
|
||||
.Pp
|
||||
The
|
||||
.Nm
|
||||
program simply invokes the
|
||||
.Xr sync 2
|
||||
system call.
|
||||
.Sh SEE ALSO
|
||||
.Xr fsync 2 ,
|
||||
.Xr sync 2 ,
|
||||
.Xr halt 8 ,
|
||||
.Xr reboot 8
|
||||
.Sh HISTORY
|
||||
A
|
||||
.Nm
|
||||
command appeared in
|
||||
.At v6 .
|
59
bin/sync/sync.c
Normal file
59
bin/sync/sync.c
Normal file
|
@ -0,0 +1,59 @@
|
|||
/* $NetBSD: sync.c,v 1.13 2008/07/20 00:52:40 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__COPYRIGHT("@(#) Copyright (c) 1987, 1993\
|
||||
The Regents of the University of California. All rights reserved.");
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)sync.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: sync.c,v 1.13 2008/07/20 00:52:40 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int, char *[]);
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
setprogname(argv[0]);
|
||||
sync();
|
||||
exit(0);
|
||||
/* NOTREACHED */
|
||||
}
|
|
@ -24,7 +24,7 @@ SUBDIR= add_route arp ash at backup banner basename btrace cal \
|
|||
reboot remsync rev rget rlogin \
|
||||
rotate rsh rshd service setup shar acksize \
|
||||
sleep slip spell split sprofalyze sprofdiff srccrc \
|
||||
stty svclog svrctl swifi sync synctree sysenv \
|
||||
stty svclog svrctl swifi synctree sysenv \
|
||||
syslogd tail tcpd tcpdp tcpstat tee telnet \
|
||||
telnetd term termcap tget time touch tr \
|
||||
truncate tty udpstat umount uname unexpand \
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
PROG= sync
|
||||
BINDIR= /bin
|
||||
MAN=
|
||||
|
||||
.include <bsd.prog.mk>
|
|
@ -1,14 +0,0 @@
|
|||
/* sync - flush the file system buffers. Author: Andy Tanenbaum */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(void);
|
||||
|
||||
int main()
|
||||
{
|
||||
/* First prize in shortest useful program contest. */
|
||||
/* Highest comment/code ratio */
|
||||
sync();
|
||||
return(0);
|
||||
}
|
|
@ -58,8 +58,8 @@ PROG_DRIVERS+= acpi
|
|||
.if ${MACHINE_ARCH} == "earm"
|
||||
EXTRA+= rc.arm mylogin.sh ttys
|
||||
PROG_DRIVERS+= mmc tty gpio
|
||||
PROG_COMMANDS+= cp dd getty time sync sleep stty umount
|
||||
PROG_BIN+= cat ls rm
|
||||
PROG_COMMANDS+= cp dd getty time sleep stty umount
|
||||
PROG_BIN+= cat ls rm sync
|
||||
PROTO= proto.arm.small
|
||||
.endif # ${MACHINE_ARCH} == "earm"
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ MAN= add_route.8 backup.8 boot.8 btrace.8 \
|
|||
poweroff.8 printroot.8 pr_routes.8 pwdauth.8 rarpd.8 \
|
||||
rdate.8 readclock.8 reboot.8 repartition.8 \
|
||||
rshd.8 screendump.8 serial-ip.8 service.8 \
|
||||
setup.8 shutdown.8 slip.8 srccrc.8 sync.8 syslogd.8 tcpd.8 \
|
||||
setup.8 shutdown.8 slip.8 srccrc.8 syslogd.8 tcpd.8 \
|
||||
unix.8 update.8 usage.8 vbfs.8
|
||||
|
||||
MLINKS += httpd.8 in.httpd.8
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
.TH SYNC 8
|
||||
.SH NAME
|
||||
sync \- flush the cache to disk
|
||||
.SH SYNOPSIS
|
||||
\fBsync\fR
|
||||
.br
|
||||
.de FL
|
||||
.TP
|
||||
\\fB\\$1\\fR
|
||||
\\$2
|
||||
..
|
||||
.de EX
|
||||
.TP 20
|
||||
\\fB\\$1\\fR
|
||||
# \\$2
|
||||
..
|
||||
.SH EXAMPLES
|
||||
.TP 20
|
||||
.B sync
|
||||
# Write out all modified cache blocks
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
\s-1MINIX 3\s-1
|
||||
maintains a cache of recently used disk blocks.
|
||||
The
|
||||
.I sync
|
||||
command writes any modified cache blocks back to the disk.
|
||||
This is essential before stopping the system, and should be done before
|
||||
running any
|
||||
.I a.out
|
||||
program that might crash.
|
||||
.SH "SEE ALSO"
|
||||
.BR sync (2),
|
||||
.BR update (8),
|
||||
.BR shutdown (8).
|
|
@ -21,6 +21,7 @@
|
|||
2012/10/17 12:00:00,bin/pwd
|
||||
2011/08/29 14:48:46,bin/rm
|
||||
2011/08/29 14:49:38,bin/rmdir
|
||||
2012/10/17 12:00:00,bin/sync
|
||||
2012/10/17 12:00:00,bin/test
|
||||
2012/10/17 12:00:00,build.sh
|
||||
2012/10/17 12:00:00,common/dist/zlib
|
||||
|
|
Loading…
Reference in a new issue