diff options
author | 1996-06-11 03:25:10 +0000 | |
---|---|---|
committer | 1996-06-11 03:25:10 +0000 | |
commit | ff823cfe83f973d63eb8d7dbaaf4f9ab4bcd9c51 (patch) | |
tree | 8c478d0fec27d92f73dea603cd4766f901444e19 | |
parent | Use beep() with ncurses (diff) | |
download | wireguard-openbsd-ff823cfe83f973d63eb8d7dbaaf4f9ab4bcd9c51.tar.xz wireguard-openbsd-ff823cfe83f973d63eb8d7dbaaf4f9ab4bcd9c51.zip |
Kernel-implementation of update(8) my me
-rw-r--r-- | etc/rc | 3 | ||||
-rw-r--r-- | share/man/man8/Makefile | 4 | ||||
-rw-r--r-- | share/man/man8/update.8 | 72 | ||||
-rw-r--r-- | sys/kern/init_main.c | 32 | ||||
-rw-r--r-- | sys/kern/vfs_bio.c | 181 | ||||
-rw-r--r-- | sys/kern/vfs_cluster.c | 4 | ||||
-rw-r--r-- | sys/sys/buf.h | 5 | ||||
-rw-r--r-- | sys/sys/vnode.h | 3 | ||||
-rw-r--r-- | sys/ufs/mfs/mfsnode.h | 4 | ||||
-rw-r--r-- | usr.sbin/Makefile | 4 | ||||
-rw-r--r-- | usr.sbin/update/Makefile | 7 | ||||
-rw-r--r-- | usr.sbin/update/update.8 | 75 | ||||
-rw-r--r-- | usr.sbin/update/update.c | 76 |
13 files changed, 299 insertions, 171 deletions
@@ -1,4 +1,4 @@ -# $OpenBSD: rc,v 1.13 1996/06/10 07:15:17 deraadt Exp $ +# $OpenBSD: rc,v 1.14 1996/06/11 03:25:10 tholo Exp $ # System startup script run by init on autoboot # or after single-user. @@ -200,7 +200,6 @@ if [ -f /var/account/acct ]; then fi echo -n standard daemons: -echo -n ' update'; update echo -n ' cron'; cron echo '.' diff --git a/share/man/man8/Makefile b/share/man/man8/Makefile index 32cd2146d74..46d9febc758 100644 --- a/share/man/man8/Makefile +++ b/share/man/man8/Makefile @@ -1,9 +1,9 @@ -# $OpenBSD: Makefile,v 1.3 1996/04/22 01:28:14 deraadt Exp $ +# $OpenBSD: Makefile,v 1.4 1996/06/11 03:25:11 tholo Exp $ # $NetBSD: Makefile,v 1.13 1996/03/28 21:36:40 mark Exp $ # @(#)Makefile 8.1 (Berkeley) 6/5/93 MAN= adduser.8 compat_linux.8 compat_sunos.8 diskless.8 intro.8 rc.8 \ - sticky.8 yp.8 + sticky.8 update.8 yp.8 SUBDIR= man8.amiga man8.arm32 man8.atari man8.hp300 man8.i386 man8.mac68k \ man8.sparc man8.sun3 man8.tahoe man8.vax diff --git a/share/man/man8/update.8 b/share/man/man8/update.8 new file mode 100644 index 00000000000..7c77595fb14 --- /dev/null +++ b/share/man/man8/update.8 @@ -0,0 +1,72 @@ +.\" +.\" Copyright (c) 1996 SigmaSoft, Th. Lockert +.\" 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. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by SigmaSoft, Th. Lockert. +.\" 4. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. +.\" +.\" $OpenBSD: update.8,v 1.1 1996/06/11 03:25:12 tholo Exp $ +.\" +.Dd June 8, 1996 +.Dt UPDATE 8 +.Os +.Sh NAME +.Nm update +.Nd flush internal filesystem caches to disk frequently +.Sh SYNOPSIS +.Nm update +.Sh DESCRIPTION +The +.Nm update +command no longer exists, but has been incorporated into +the kernel where it will flush dirty buffers that has not +been touched for thirty seconds or more. +.Pp +The same effect can be seen by using the +.Xr sync 8 +command, although the in-kernel +.Nm update +process will do this in a staggered manner. +.Sh SEE ALSO +.Xr sync 2 , +.Xr fsck 8 , +.Xr init 8 , +.Xr sync 8 +.Sh BUGS +It is possible on some systems, that a +.Xr sync +occuring simultaneously with a crash may cause +file system damage. See +.Xr fsck 8 . +.Sh HISTORY +An +.Nm update +command appeared in +.At v6 . +.Pp +The +.Nm update +command was incorporated into the kernel in +.Ox 1.2 . diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index eb953d519b3..8cca8948dca 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init_main.c,v 1.10 1996/06/10 07:25:54 deraadt Exp $ */ +/* $OpenBSD: init_main.c,v 1.11 1996/06/11 03:25:12 tholo Exp $ */ /* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */ /* @@ -113,6 +113,7 @@ struct timeval runtime; static void start_init __P((struct proc *)); static void start_pagedaemon __P((struct proc *)); +static void start_update __P((struct proc *)); /* XXX return int so gcc -Werror won't complain */ int main __P((void *)); @@ -372,6 +373,20 @@ main(framep) cpu_set_kpc(pfind(2), start_pagedaemon); #endif + /* Create process 3 (the update daemon). */ + if (sys_fork(p, NULL, rval)) + panic("fork update"); +#ifdef cpu_set_init_frame /* XXX should go away */ + if (rval[1]) { + /* + * Now in process 3. + */ + start_update(curproc); + } +#else + cpu_set_kpc(pfind(3), start_update); +#endif + /* The scheduler is an infinite loop. */ scheduler(); /* NOTREACHED */ @@ -518,3 +533,18 @@ start_pagedaemon(p) vm_pageout(); /* NOTREACHED */ } + +static void +start_update(p) + struct proc *p; +{ + + /* + * Now in process 3. + */ + pageproc = p; + p->p_flag |= P_INMEM | P_SYSTEM; /* XXX */ + bcopy("update", curproc->p_comm, sizeof ("update")); + vn_update(); + /* NOTREACHED */ +} diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 698f645ead3..bc7ce981dc3 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_bio.c,v 1.5 1996/05/02 13:12:29 deraadt Exp $ */ +/* $OpenBSD: vfs_bio.c,v 1.6 1996/06/11 03:25:13 tholo Exp $ */ /* $NetBSD: vfs_bio.c,v 1.43 1996/04/22 01:38:59 christos Exp $ */ /*- @@ -59,6 +59,7 @@ #include <sys/malloc.h> #include <sys/resourcevar.h> #include <sys/conf.h> +#include <sys/kernel.h> #include <vm/vm.h> @@ -143,6 +144,7 @@ bufinit() register int i; int base, residual; + TAILQ_INIT(&bdirties); for (dp = bufqueues; dp < &bufqueues[BQUEUES]; dp++) TAILQ_INIT(dp); bufhashtbl = hashinit(nbuf, M_CACHE, &bufhash); @@ -298,6 +300,12 @@ bwrite(bp) } wasdelayed = ISSET(bp->b_flags, B_DELWRI); CLR(bp->b_flags, (B_READ | B_DONE | B_ERROR | B_DELWRI)); + /* + * If this was a delayed write, remove it from the + * list of dirty blocks now + */ + if (wasdelayed) + TAILQ_REMOVE(&bdirties, bp, b_synclist); if (!sync) { /* @@ -368,18 +376,51 @@ void bdwrite(bp) struct buf *bp; { + int setit; /* * If the block hasn't been seen before: * (1) Mark it as having been seen, * (2) Charge for the write. * (3) Make sure it's on its vnode's correct block list, + * (4) If a buffer is rewritten, move it to end of dirty list */ + bp->b_synctime = time.tv_sec + 30; if (!ISSET(bp->b_flags, B_DELWRI)) { + /* + * Add the buffer to the list of dirty blocks. + * If it is the first entry on the list, schedule + * a timeout to flush it to disk + */ + TAILQ_INSERT_TAIL(&bdirties, bp, b_synclist); + if (bdirties.tqh_first == bp) + timeout((void (*)__P((void *)))wakeup, + &bdirties, 30 * hz); SET(bp->b_flags, B_DELWRI); curproc->p_stats->p_ru.ru_oublock++; /* XXX */ reassignbuf(bp, bp->b_vp); } + else { + /* + * The buffer has been rewritten. Move it to the + * end of the dirty block list, and if it was the + * first entry before being moved, reschedule the + * timeout + */ + if (bdirties.tqh_first == bp) { + untimeout((void (*)__P((void *)))wakeup, + &bdirties); + setit = 1; + } + else + setit = 0; + TAILQ_REMOVE(&bdirties, bp, b_synclist); + TAILQ_INSERT_TAIL(&bdirties, bp, b_synclist); + if (setit && bdirties.tqh_first != bp) + timeout((void (*)__P((void *)))wakeup, + &bdirties, + (bdirties.tqh_first->b_synctime - time.tv_sec) * hz); + } /* If this is a tape block, write the block now. */ if (bdevsw[major(bp->b_dev)].d_type == D_TAPE) { @@ -406,6 +447,142 @@ bawrite(bp) } /* + * Write out dirty buffers if they have been on the dirty + * list for more than 30 seconds; scan for such buffers + * once a second. + */ +void +vn_update() +{ + struct mount *mp, *nmp; + struct timespec ts; + struct vnode *vp; + struct buf *bp; + int async, s; + + /* + * In case any buffers got scheduled for write before the + * process got started (should never happen) + */ + untimeout((void (*)__P((void *)))wakeup, + &bdirties); + for (;;) { + s = splbio(); + /* + * Schedule a wakeup when the next buffer is to + * be flushed to disk. If no buffers are enqueued, + * a wakeup will be scheduled at the time a new + * buffer is enqueued + */ + if ((bp = bdirties.tqh_first) != NULL) + timeout((void (*)__P((void *)))wakeup, + &bdirties, (bp->b_synctime - time.tv_sec) * hz); + tsleep(&bdirties, PZERO - 1, "dirty", 0); + /* + * Walk the dirty block list, starting an asyncroneous + * write of any block that has timed out + */ + while ((bp = bdirties.tqh_first) != NULL && + bp->b_synctime <= time.tv_sec) { + /* + * If the block is currently busy (perhaps being + * written), move it to the end of the dirty list + * and go to the next block + */ + if (ISSET(bp->b_flags, B_BUSY)) { + TAILQ_REMOVE(&bdirties, bp, b_synclist); + TAILQ_INSERT_TAIL(&bdirties, bp, b_synclist); + bp->b_synctime = time.tv_sec + 30; + continue; + } + /* + * Remove the block from the per-vnode dirty + * list and mark it as busy + */ + bremfree(bp); + SET(bp->b_flags, B_BUSY); + splx(s); + /* + * Start an asyncroneous write of the buffer. + * Note that this will also remove the buffer + * from the dirty list + */ + bawrite(bp); + s = splbio(); + } + splx(s); + /* + * We also need to flush out modified vnodes + */ + for (mp = mountlist.cqh_last; + mp != (void *)&mountlist; + mp = nmp) { + /* + * Get the next pointer in case we hang of vfs_busy() + * while being unmounted + */ + nmp = mp->mnt_list.cqe_prev; + /* + * The lock check below is to avoid races with mount + * and unmount + */ + if ((mp->mnt_flag & (MNT_MLOCK | MNT_RDONLY | MNT_MPBUSY)) == 0 && + !vfs_busy(mp)) { + /* + * Turn off the file system async flag until + * we are done writing out vnodes + */ + async = mp->mnt_flag & MNT_ASYNC; + mp->mnt_flag &= ~MNT_ASYNC; + /* + * Walk the vnode list for the file system, + * writing each modified vnode out + */ +loop: + for (vp = mp->mnt_vnodelist.lh_first; + vp != NULL; + vp = vp->v_mntvnodes.le_next) { + /* + * If the vnode is no longer associated + * with the file system in question, skip + * it + */ + if (vp->v_mount != mp) + goto loop; + /* + * If the vnode is currently locked, + * ignore it + */ + if (VOP_ISLOCKED(vp)) + continue; + /* + * Lock the vnode, start a write and + * release the vnode + */ + if (vget(vp, 1)) + goto loop; + TIMEVAL_TO_TIMESPEC(&time, &ts); + VOP_UPDATE(vp, &ts, &ts, 0); + vput(vp); + } + /* + * Restore the file system async flag if it + * were previously set for this file system + */ + mp->mnt_flag |= async; + /* + * Get the next pointer again as the next + * file system might have been unmounted + * while we were flushing vnodes + */ + nmp = mp->mnt_list.cqe_prev; + vfs_unbusy(mp); + } + } + } +} + +/* * Release a buffer on to the free lists. * Described in Bach (p. 46). */ @@ -450,6 +627,8 @@ brelse(bp) */ if (bp->b_vp) brelvp(bp); + if (ISSET(bp->b_flags, B_DELWRI)) + TAILQ_REMOVE(&bdirties, bp, b_synclist); CLR(bp->b_flags, B_DELWRI); if (bp->b_bufsize <= 0) /* no data */ diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c index e0f8be723b1..ad792afff1f 100644 --- a/sys/kern/vfs_cluster.c +++ b/sys/kern/vfs_cluster.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_cluster.c,v 1.4 1996/05/02 13:12:33 deraadt Exp $ */ +/* $OpenBSD: vfs_cluster.c,v 1.5 1996/06/11 03:25:13 tholo Exp $ */ /* $NetBSD: vfs_cluster.c,v 1.12 1996/04/22 01:39:05 christos Exp $ */ /*- @@ -719,6 +719,8 @@ redo: bp->b_bufsize += size; tbp->b_bufsize -= size; + if (tbp->b_flags & B_DELWRI) + TAILQ_REMOVE(&bdirties, tbp, b_synclist); tbp->b_flags &= ~(B_READ | B_DONE | B_ERROR | B_DELWRI); /* * We might as well AGE the buffer here; it's either empty, or diff --git a/sys/sys/buf.h b/sys/sys/buf.h index ef98b8853c8..888eca306c6 100644 --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: buf.h,v 1.4 1996/04/18 21:40:46 niklas Exp $ */ +/* $OpenBSD: buf.h,v 1.5 1996/06/11 03:25:14 tholo Exp $ */ /* $NetBSD: buf.h,v 1.24 1996/02/18 11:55:45 fvdl Exp $ */ /* @@ -54,6 +54,8 @@ struct buf { LIST_ENTRY(buf) b_hash; /* Hash chain. */ LIST_ENTRY(buf) b_vnbufs; /* Buffer's associated vnode. */ TAILQ_ENTRY(buf) b_freelist; /* Free list position if not active. */ + TAILQ_ENTRY(buf) b_synclist; /* List of diry buffers to be written out */ + long b_synctime; /* Time this buffer should be flushed */ struct buf *b_actf, **b_actb; /* Device driver queue when active. */ struct proc *b_proc; /* Associated proc; NULL if kernel. */ volatile long b_flags; /* B_* flags. */ @@ -158,6 +160,7 @@ struct buf *swbuf; /* Swap I/O buffer headers. */ int nswbuf; /* Number of swap I/O buffer headers. */ struct buf bswlist; /* Head of swap I/O buffer headers free list. */ struct buf *bclnlist; /* Head of cleaned page list. */ +TAILQ_HEAD(, buf) bdirties; /* Dirty buffer list for update daemon */ __BEGIN_DECLS void allocbuf __P((struct buf *, int)); diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index bd7705de932..1ec111930ab 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vnode.h,v 1.4 1996/04/18 21:41:19 niklas Exp $ */ +/* $OpenBSD: vnode.h,v 1.5 1996/06/11 03:25:15 tholo Exp $ */ /* $NetBSD: vnode.h,v 1.38 1996/02/29 20:59:05 cgd Exp $ */ /* @@ -381,6 +381,7 @@ int vinvalbuf __P((struct vnode *vp, int save, struct ucred *cred, struct proc *p, int slpflag, int slptimeo)); void vprint __P((char *label, struct vnode *vp)); int vn_bwrite __P((void *ap)); +void vn_update __P((void)); int vn_close __P((struct vnode *vp, int flags, struct ucred *cred, struct proc *p)); int vn_closefile __P((struct file *fp, struct proc *p)); diff --git a/sys/ufs/mfs/mfsnode.h b/sys/ufs/mfs/mfsnode.h index 2dddd23056f..d37f7ba4e68 100644 --- a/sys/ufs/mfs/mfsnode.h +++ b/sys/ufs/mfs/mfsnode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mfsnode.h,v 1.2 1996/02/27 07:15:49 niklas Exp $ */ +/* $OpenBSD: mfsnode.h,v 1.3 1996/06/11 03:25:15 tholo Exp $ */ /* $NetBSD: mfsnode.h,v 1.3 1996/02/09 22:31:31 christos Exp $ */ /* @@ -85,5 +85,5 @@ struct mfsnode { #define mfs_valloc mfs_badop #define mfs_vfree mfs_badop #define mfs_truncate mfs_badop -#define mfs_update mfs_badop +#define mfs_update nullop #define mfs_bwrite vn_bwrite diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index 8eca7953fa4..478339f8529 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.12 1996/06/04 07:56:00 niklas Exp $ +# $OpenBSD: Makefile,v 1.13 1996/06/11 03:25:16 tholo Exp $ # not yet done: catman @@ -11,7 +11,7 @@ SUBDIR= ac accton arp bootpd bootpgw bootpef bootptest \ rarpd rbootd rdconfig rdate repquota rmt \ rpc.bootparamd rpc.pcnfsd rwhod \ sa sendmail sliplogin slstats spray sysctl \ - syslogd tcpdump timed traceroute trpt trsp update \ + syslogd tcpdump timed traceroute trpt trsp \ vipw vnconfig ypbind yppoll ypset \ ypserv zdump zic diff --git a/usr.sbin/update/Makefile b/usr.sbin/update/Makefile deleted file mode 100644 index 392a41c4c6f..00000000000 --- a/usr.sbin/update/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# from: @(#)Makefile 5.5 (Berkeley) 6/29/90 -# $Id: Makefile,v 1.1.1.1 1995/10/18 08:48:30 deraadt Exp $ - -PROG= update -MAN= update.8 - -.include <bsd.prog.mk> diff --git a/usr.sbin/update/update.8 b/usr.sbin/update/update.8 deleted file mode 100644 index 0201451b96f..00000000000 --- a/usr.sbin/update/update.8 +++ /dev/null @@ -1,75 +0,0 @@ -.\" Copyright (c) 1991 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. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the University of -.\" California, Berkeley and its contributors. -.\" 4. 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. -.\" -.\" from: @(#)update.8 6.5 (Berkeley) 8/5/91 -.\" $Id: update.8,v 1.1.1.1 1995/10/18 08:48:30 deraadt Exp $ -.\" -.Dd August 5, 1991 -.Dt UPDATE 8 -.Os -.Sh NAME -.Nm update -.Nd flush internal filesystem caches to disk frequently -.Sh SYNOPSIS -.Nm update -.Sh DESCRIPTION -The -.Nm update -command helps protect the integrity of disk volumes -by flushing -volatile cached filesystem data -to disk at thirty second intervals. -.Nm Update -uses the -.Xr sync 2 -function call to do the task. -.Pp -.Nm Update -is commonly invoked at startup time by -.Xr rc 8 -when the system goes multi-user. -.Sh SEE ALSO -.Xr sync 2 , -.Xr fsck 8 , -.Xr init 8 , -.Xr rc 8 , -.Xr sync 8 -.Sh BUGS -It is possible on some systems, that a -.Xr sync -occuring simultaneously with a crash may cause -file system damage. See -.Xr fsck 8 . -.Sh HISTORY -An -.Nm update -command appeared in -.At v6 . diff --git a/usr.sbin/update/update.c b/usr.sbin/update/update.c deleted file mode 100644 index ca6b15ce204..00000000000 --- a/usr.sbin/update/update.c +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * Copyright (c) 1987, 1990 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. 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. - */ - -#ifndef lint -char copyright[] = -"@(#) Copyright (c) 1987, 1990 The Regents of the University of California.\n\ - All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -/*static char sccsid[] = "from: @(#)update.c 5.1 (Berkeley) 6/6/91";*/ -static char rcsid[] = "$Id: update.c,v 1.1.1.1 1995/10/18 08:48:30 deraadt Exp $"; -#endif /* not lint */ - -#include <sys/time.h> -#include <signal.h> -#include <stdlib.h> -#include <stdio.h> -#include <unistd.h> - -main() -{ - struct itimerval value; - void mysync(); - - daemon(0, 0); - - (void)signal(SIGALRM, mysync); - - value.it_interval.tv_sec = 30; - value.it_interval.tv_usec = 0; - value.it_value = value.it_interval; - if (setitimer(ITIMER_REAL, &value, NULL)) { - perror("update: setitimer"); - exit(1); - } - for (;;) - sigpause(sigblock(0L)); - /* NOTREACHED */ -} - -void -mysync() -{ - (void)sync(); -} |