summaryrefslogtreecommitdiffstats
path: root/sbin/dump
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2002-02-16 21:05:16 +0000
committeriedowse <iedowse@FreeBSD.org>2002-02-16 21:05:16 +0000
commitfebe7b98f86edabef1c4ff4db94ffe7ce4fef9fc (patch)
tree0952f18a123759d5d1883d2adade1938f7269c0e /sbin/dump
parentcafeeb5d7be874d586a3728bd7361f5a495421af (diff)
downloadFreeBSD-src-febe7b98f86edabef1c4ff4db94ffe7ce4fef9fc.zip
FreeBSD-src-febe7b98f86edabef1c4ff4db94ffe7ce4fef9fc.tar.gz
Supply progress information in dump's process title, which is useful
for monitoring automated backups. This is based on a patch by Mikhail Teterin, with some changes to make its operation clearer and to update the proctitle more frequently. PR: bin/32138
Diffstat (limited to 'sbin/dump')
-rw-r--r--sbin/dump/dump.h1
-rw-r--r--sbin/dump/main.c8
-rw-r--r--sbin/dump/optr.c19
-rw-r--r--sbin/dump/tape.c1
4 files changed, 22 insertions, 7 deletions
diff --git a/sbin/dump/dump.h b/sbin/dump/dump.h
index d9bff13..e3cc7c2 100644
--- a/sbin/dump/dump.h
+++ b/sbin/dump/dump.h
@@ -83,6 +83,7 @@ int blockswritten; /* number of blocks written on current tape */
int tapeno; /* current tape number */
time_t tstart_writing; /* when started writing the first tape block */
time_t tend_writing; /* after writing the last tape block */
+int passno; /* current dump pass number */
struct fs *sblock; /* the file system super block */
char sblock_buf[MAXBSIZE];
long dev_bsize; /* block size of underlying disk device */
diff --git a/sbin/dump/main.c b/sbin/dump/main.c
index 392fa70..666b65f 100644
--- a/sbin/dump/main.c
+++ b/sbin/dump/main.c
@@ -362,9 +362,13 @@ main(argc, argv)
nonodump = spcl.c_level < honorlevel;
+ passno = 1;
+ setproctitle("%s: pass 1: regular files", disk);
msg("mapping (Pass I) [regular files]\n");
anydirskipped = mapfiles(maxino, &tapesize);
+ passno = 2;
+ setproctitle("%s: pass 2: directories", disk);
msg("mapping (Pass II) [directories]\n");
while (anydirskipped) {
anydirskipped = mapdirs(maxino, &tapesize);
@@ -427,6 +431,8 @@ main(argc, argv)
(void)time((time_t *)&(tstart_writing));
dumpmap(usedinomap, TS_CLRI, maxino - 1);
+ passno = 3;
+ setproctitle("%s: pass 3: directories", disk);
msg("dumping (Pass III) [directories]\n");
dirty = 0; /* XXX just to get gcc to shut up */
for (map = dumpdirmap, ino = 1; ino < maxino; ino++) {
@@ -445,6 +451,8 @@ main(argc, argv)
(void)dumpino(dp, ino);
}
+ passno = 4;
+ setproctitle("%s: pass 4: regular files", disk);
msg("dumping (Pass IV) [regular files]\n");
for (map = dumpinomap, ino = 1; ino < maxino; ino++) {
int mode;
diff --git a/sbin/dump/optr.c b/sbin/dump/optr.c
index a35b550..f13e7d6 100644
--- a/sbin/dump/optr.c
+++ b/sbin/dump/optr.c
@@ -193,20 +193,25 @@ time_t tschedule = 0;
void
timeest()
{
+ double percent;
time_t tnow;
- int deltat;
+ int deltat, hours, mins;
(void) time(&tnow);
+ deltat = (blockswritten == 0) ? 0 : tstart_writing - tnow +
+ (double)(tnow - tstart_writing) / blockswritten * tapesize;
+ percent = (blockswritten * 100.0) / tapesize;
+ hours = deltat / 3600;
+ mins = (deltat % 3600) / 60;
+
+ setproctitle("%s: pass %d: %3.2f%% done, finished in %d:%02d",
+ disk, passno, percent, hours, mins);
if (tnow >= tschedule) {
tschedule = tnow + 300;
if (blockswritten < 500)
return;
- deltat = tstart_writing - tnow +
- (1.0 * (tnow - tstart_writing))
- / blockswritten * tapesize;
- msg("%3.2f%% done, finished in %d:%02d\n",
- (blockswritten * 100.0) / tapesize,
- deltat / 3600, (deltat % 3600) / 60);
+ msg("%3.2f%% done, finished in %d:%02d\n", percent, hours,
+ mins);
}
}
diff --git a/sbin/dump/tape.c b/sbin/dump/tape.c
index 25c9763..8097565 100644
--- a/sbin/dump/tape.c
+++ b/sbin/dump/tape.c
@@ -527,6 +527,7 @@ restore_check_point:
/*
* All signals are inherited...
*/
+ setproctitle(NULL); /* Restore the proctitle. */
childpid = fork();
if (childpid < 0) {
msg("Context save fork fails in parent %d\n", parentpid);
OpenPOWER on IntegriCloud