Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/fsck_ffs If SIGINFO is received, display summary inform...



details:   https://anonhg.NetBSD.org/src/rev/39267e2e194d
branches:  trunk
changeset: 526564:39267e2e194d
user:      lukem <lukem%NetBSD.org@localhost>
date:      Mon May 06 03:17:43 2002 +0000

description:
If SIGINFO is received, display summary information to stderr.
Based on changes in FreeBSD, via Chuck Cranor <chuck%research.att.com@localhost>

diffstat:

 sbin/fsck_ffs/extern.h    |   3 ++-
 sbin/fsck_ffs/fsck.h      |   4 +++-
 sbin/fsck_ffs/fsck_ffs.8  |  17 +++++++++++++++--
 sbin/fsck_ffs/main.c      |   5 +++--
 sbin/fsck_ffs/pass1.c     |  11 +++++++++--
 sbin/fsck_ffs/pass1b.c    |  12 ++++++++++--
 sbin/fsck_ffs/pass2.c     |  11 +++++++++--
 sbin/fsck_ffs/pass3.c     |  13 +++++++++++--
 sbin/fsck_ffs/pass4.c     |  11 +++++++++--
 sbin/fsck_ffs/pass5.c     |  11 +++++++++--
 sbin/fsck_ffs/utilities.c |  11 +++++++++--
 11 files changed, 89 insertions(+), 20 deletions(-)

diffs (truncated from 337 to 300 lines):

diff -r e105175a0ede -r 39267e2e194d sbin/fsck_ffs/extern.h
--- a/sbin/fsck_ffs/extern.h    Mon May 06 03:02:59 2002 +0000
+++ b/sbin/fsck_ffs/extern.h    Mon May 06 03:17:43 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extern.h,v 1.13 2001/02/04 21:25:54 christos Exp $     */
+/*     $NetBSD: extern.h,v 1.14 2002/05/06 03:17:43 lukem Exp $        */
 
 /*
  * Copyright (c) 1994 James A. Jegers
@@ -58,6 +58,7 @@
 struct inoinfo *getinoinfo __P((ino_t));
 struct dinode  *ginode __P((ino_t));
 void           getpathname __P((char *, ino_t, ino_t));
+void           infohandler __P((int sig));
 void           inocleanup __P((void));
 void           inodirty __P((void));
 int            linkup __P((ino_t, ino_t));
diff -r e105175a0ede -r 39267e2e194d sbin/fsck_ffs/fsck.h
--- a/sbin/fsck_ffs/fsck.h      Mon May 06 03:02:59 2002 +0000
+++ b/sbin/fsck_ffs/fsck.h      Mon May 06 03:17:43 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fsck.h,v 1.27 2001/08/17 02:18:47 lukem Exp $  */
+/*     $NetBSD: fsck.h,v 1.28 2002/05/06 03:17:43 lukem Exp $  */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -217,6 +217,8 @@
 ufs_daddr_t n_blks;            /* number of blocks in use */
 ufs_daddr_t n_files;           /* number of files in use */
 
+int    got_siginfo;            /* received a SIGINFO */
+
 #define        clearinode(dp)  (*(dp) = zino)
 struct dinode zino;
 
diff -r e105175a0ede -r 39267e2e194d sbin/fsck_ffs/fsck_ffs.8
--- a/sbin/fsck_ffs/fsck_ffs.8  Mon May 06 03:02:59 2002 +0000
+++ b/sbin/fsck_ffs/fsck_ffs.8  Mon May 06 03:17:43 2002 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: fsck_ffs.8,v 1.28 2002/02/07 03:15:07 ross Exp $
+.\"    $NetBSD: fsck_ffs.8,v 1.29 2002/05/06 03:17:43 lukem Exp $
 .\"
 .\" Copyright (c) 1980, 1989, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -33,7 +33,7 @@
 .\"
 .\"    @(#)fsck.8      8.3 (Berkeley) 11/29/94
 .\"
-.Dd November 16, 2001
+.Dd May 6, 2001
 .Dt FSCK_FFS 8
 .Os
 .Sh NAME
@@ -97,6 +97,19 @@
 .Nm
 will finish the file system checks, then exit with an abnormal return status.
 .Pp
+If
+.Nm
+receives a
+.Dv SIGINFO
+signal
+(see the
+.Sy status
+argument for
+.Xr stty 1 ) ,
+a line will be written to the standard error output indicating
+the name of the device currently being checked, the current phase
+number and phase-specific progress information.
+.Pp
 Without the
 .Fl p
 option,
diff -r e105175a0ede -r 39267e2e194d sbin/fsck_ffs/main.c
--- a/sbin/fsck_ffs/main.c      Mon May 06 03:02:59 2002 +0000
+++ b/sbin/fsck_ffs/main.c      Mon May 06 03:17:43 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.40 2001/08/15 03:54:53 lukem Exp $  */
+/*     $NetBSD: main.c,v 1.41 2002/05/06 03:17:43 lukem Exp $  */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.6 (Berkeley) 5/14/95";
 #else
-__RCSID("$NetBSD: main.c,v 1.40 2001/08/15 03:54:53 lukem Exp $");
+__RCSID("$NetBSD: main.c,v 1.41 2002/05/06 03:17:43 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -166,6 +166,7 @@
                (void)signal(SIGINT, catch);
        if (preen)
                (void)signal(SIGQUIT, catchquit);
+       signal(SIGINFO, infohandler);
 
        while (argc-- > 0)
                (void)checkfilesys(blockcheck(*argv++), 0, 0L, 0);
diff -r e105175a0ede -r 39267e2e194d sbin/fsck_ffs/pass1.c
--- a/sbin/fsck_ffs/pass1.c     Mon May 06 03:02:59 2002 +0000
+++ b/sbin/fsck_ffs/pass1.c     Mon May 06 03:17:43 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pass1.c,v 1.23 2001/01/05 02:02:57 lukem Exp $ */
+/*     $NetBSD: pass1.c,v 1.24 2002/05/06 03:17:43 lukem Exp $ */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)pass1.c    8.6 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: pass1.c,v 1.23 2001/01/05 02:02:57 lukem Exp $");
+__RCSID("$NetBSD: pass1.c,v 1.24 2002/05/06 03:17:43 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -95,6 +95,13 @@
        n_files = n_blks = 0;
        resetinodebuf();
        for (c = 0; c < sblock->fs_ncg; c++) {
+               if (got_siginfo) {
+                       fprintf(stderr,
+                           "%s: phase 1: cyl group %d of %d (%d%%)\n",
+                           cdevname(), c, sblock->fs_ncg,
+                           c * 100 / sblock->fs_ncg);
+                       got_siginfo = 0;
+               }
                for (i = 0; i < sblock->fs_ipg; i++, inumber++) {
                        if (inumber < ROOTINO)
                                continue;
diff -r e105175a0ede -r 39267e2e194d sbin/fsck_ffs/pass1b.c
--- a/sbin/fsck_ffs/pass1b.c    Mon May 06 03:02:59 2002 +0000
+++ b/sbin/fsck_ffs/pass1b.c    Mon May 06 03:17:43 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pass1b.c,v 1.13 1998/03/18 17:01:24 bouyer Exp $       */
+/*     $NetBSD: pass1b.c,v 1.14 2002/05/06 03:17:43 lukem Exp $        */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)pass1b.c   8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: pass1b.c,v 1.13 1998/03/18 17:01:24 bouyer Exp $");
+__RCSID("$NetBSD: pass1b.c,v 1.14 2002/05/06 03:17:43 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -52,6 +52,7 @@
 
 #include "fsck.h"
 #include "extern.h"
+#include "fsutil.h"
 
 static  struct dups *duphead;
 static int pass1bcheck __P((struct inodesc *));
@@ -70,6 +71,13 @@
        duphead = duplist;
        inumber = 0;
        for (c = 0; c < sblock->fs_ncg; c++) {
+               if (got_siginfo) {
+                       fprintf(stderr,
+                           "%s: phase 1b: cyl group %d of %d (%d%%)\n",
+                           cdevname(), c, sblock->fs_ncg,
+                           c * 100 / sblock->fs_ncg);
+                       got_siginfo = 0;
+               }
                for (i = 0; i < sblock->fs_ipg; i++, inumber++) {
                        if (inumber < ROOTINO)
                                continue;
diff -r e105175a0ede -r 39267e2e194d sbin/fsck_ffs/pass2.c
--- a/sbin/fsck_ffs/pass2.c     Mon May 06 03:02:59 2002 +0000
+++ b/sbin/fsck_ffs/pass2.c     Mon May 06 03:17:43 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pass2.c,v 1.29 2001/01/09 05:51:14 mycroft Exp $       */
+/*     $NetBSD: pass2.c,v 1.30 2002/05/06 03:17:43 lukem Exp $ */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)pass2.c    8.9 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: pass2.c,v 1.29 2001/01/09 05:51:14 mycroft Exp $");
+__RCSID("$NetBSD: pass2.c,v 1.30 2002/05/06 03:17:43 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -142,6 +142,13 @@
        curino.id_func = pass2check;
        inpend = &inpsort[inplast];
        for (inpp = inpsort; inpp < inpend; inpp++) {
+               if (got_siginfo) {
+                       fprintf(stderr,
+                           "%s: phase 2: dir %d of %d (%d%%)\n", cdevname(),
+                           inpp - inpsort, (int)inplast, 
+                           (int)((inpp - inpsort) * 100 / inplast));
+                       got_siginfo = 0;
+               }
                inp = *inpp;
                if (inp->i_isize == 0)
                        continue;
diff -r e105175a0ede -r 39267e2e194d sbin/fsck_ffs/pass3.c
--- a/sbin/fsck_ffs/pass3.c     Mon May 06 03:02:59 2002 +0000
+++ b/sbin/fsck_ffs/pass3.c     Mon May 06 03:17:43 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pass3.c,v 1.12 2001/01/10 08:22:20 mycroft Exp $       */
+/*     $NetBSD: pass3.c,v 1.13 2002/05/06 03:17:43 lukem Exp $ */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)pass3.c    8.2 (Berkeley) 4/27/95";
 #else
-__RCSID("$NetBSD: pass3.c,v 1.12 2001/01/10 08:22:20 mycroft Exp $");
+__RCSID("$NetBSD: pass3.c,v 1.13 2002/05/06 03:17:43 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -50,6 +50,7 @@
 
 #include "fsck.h"
 #include "extern.h"
+#include "fsutil.h"
 
 void
 pass3()
@@ -59,6 +60,14 @@
        int loopcnt;
 
        for (inpp = &inpsort[inplast - 1]; inpp >= inpsort; inpp--) {
+               if (got_siginfo) {
+                       int inpindex = inpp - inpsort;
+                       fprintf(stderr,
+                           "%s: phase 3: dir %d of %d (%d%%)\n", cdevname(),
+                           (int)(inplast - inpindex - 1), (int)inplast,
+                           (int)((inplast - inpindex - 1) * 100 / inplast));
+                       got_siginfo = 0;
+               }
                inp = *inpp;
                if (inp->i_number == ROOTINO ||
                    !(inp->i_parent == 0 || statemap[inp->i_number] == DSTATE))
diff -r e105175a0ede -r 39267e2e194d sbin/fsck_ffs/pass4.c
--- a/sbin/fsck_ffs/pass4.c     Mon May 06 03:02:59 2002 +0000
+++ b/sbin/fsck_ffs/pass4.c     Mon May 06 03:17:43 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pass4.c,v 1.14 1997/09/20 06:16:32 lukem Exp $ */
+/*     $NetBSD: pass4.c,v 1.15 2002/05/06 03:17:43 lukem Exp $ */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)pass4.c    8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: pass4.c,v 1.14 1997/09/20 06:16:32 lukem Exp $");
+__RCSID("$NetBSD: pass4.c,v 1.15 2002/05/06 03:17:43 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -69,6 +69,13 @@
        idesc.id_type = ADDR;
        idesc.id_func = pass4check;
        for (inumber = ROOTINO; inumber <= lastino; inumber++) {
+               if (got_siginfo) {
+                       fprintf(stderr,
+                           "%s: phase 4: cyl group %d of %d (%d%%)\n",
+                           cdevname(), inumber, lastino,
+                           inumber * 100 / lastino);
+                       got_siginfo = 0;
+               }
                idesc.id_number = inumber;
                switch (statemap[inumber]) {
 
diff -r e105175a0ede -r 39267e2e194d sbin/fsck_ffs/pass5.c
--- a/sbin/fsck_ffs/pass5.c     Mon May 06 03:02:59 2002 +0000
+++ b/sbin/fsck_ffs/pass5.c     Mon May 06 03:17:43 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pass5.c,v 1.28 2002/04/10 17:29:30 mycroft Exp $       */
+/*     $NetBSD: pass5.c,v 1.29 2002/05/06 03:17:43 lukem Exp $ */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)pass5.c    8.9 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: pass5.c,v 1.28 2002/04/10 17:29:30 mycroft Exp $");
+__RCSID("$NetBSD: pass5.c,v 1.29 2002/05/06 03:17:43 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -185,6 +185,13 @@
        for (i = fs->fs_size; i < j; i++)
                setbmap(i);
        for (c = 0; c < fs->fs_ncg; c++) {
+               if (got_siginfo) {
+                       fprintf(stderr,



Home | Main Index | Thread Index | Old Index