FreeBSD Bugzilla – Attachment 17752 Details for
Bug 32138
better progress reporting for dump(8)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 3.92 KB, created by
Mikhail T.
on 2001-11-20 17:00:00 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Mikhail T.
Created:
2001-11-20 17:00:00 UTC
Size:
3.92 KB
patch
obsolete
>Index: dump.8 >=================================================================== >RCS file: /home/ncvs/src/sbin/dump/dump.8,v >retrieving revision 1.39 >diff -U2 -r1.39 dump.8 >--- dump.8 15 Jul 2001 14:00:19 -0000 1.39 >+++ dump.8 20 Nov 2001 16:49:14 -0000 >@@ -320,5 +320,6 @@ > .Pp > .Nm Dump >-tells the operator what is going on at periodic intervals, >+tells the operator what is going on at periodic intervals -- >+every 5 minutes, or promptly after receiving SIGINFO -- > including usually low estimates of the number of blocks to write, > the number of tapes it will take, the time to completion, and >Index: dump.h >=================================================================== >RCS file: /home/ncvs/src/sbin/dump/dump.h,v >retrieving revision 1.11 >diff -U2 -r1.11 dump.h >--- dump.h 17 Nov 2001 00:06:55 -0000 1.11 >+++ dump.h 20 Nov 2001 16:49:14 -0000 >@@ -101,6 +101,7 @@ > int query __P((char *question)); > void quit __P((const char *fmt, ...)) __printflike(1, 2); >-void timeest __P((void)); >+void timeest __P((int)); /* accepts the signal number */ > time_t unctime __P((char *str)); >+void title __P((void)); > > /* mapping rouintes */ >Index: optr.c >=================================================================== >RCS file: /home/ncvs/src/sbin/dump/optr.c,v >retrieving revision 1.16 >diff -U2 -r1.16 optr.c >--- optr.c 17 Nov 2001 00:06:55 -0000 1.16 >+++ optr.c 20 Nov 2001 16:49:14 -0000 >@@ -52,4 +52,5 @@ > #include <string.h> > #include <stdarg.h> >+#include <signal.h> > #include <unistd.h> > #include <utmp.h> >@@ -191,14 +192,26 @@ > > void >-timeest() >+timeest(signal) > { > time_t tnow; > int deltat; > >- (void) time((time_t *) &tnow); >+ if (signal != 0) { >+ /* >+ * We might be called to handle SIGINFO. Re-schedule >+ * the reporting to occur the next time we are called >+ * regularly and bail out -- don't do reporting as a >+ * signal handler -- it involves malloc-ing and other >+ * things signal handler are not supposed to do. >+ */ >+ /* >+ * 300 seconds is a constant only used in this function >+ */ >+ tschedule -= 300; >+ return; >+ } >+ (void) time(&tnow); > if (tnow >= tschedule) { > tschedule = tnow + 300; >- if (blockswritten < 500) >- return; > deltat = tstart_writing - tnow + > (1.0 * (tnow - tstart_writing)) >@@ -207,4 +220,5 @@ > (blockswritten * 100.0) / tapesize, > deltat / 3600, (deltat % 3600) / 60); >+ title(); > } > } >@@ -235,4 +249,31 @@ > (void) vsnprintf(lastmsg, sizeof(lastmsg), fmt, ap); > va_end(ap); >+} >+ >+/* >+ * This function can be called to place, what msg() above pushed to >+ * stderr, into the process title, viewable with the ps-command. >+ * A side effect of this function, is it replaces the final '\n' (if any) >+ * with the '\0' in the global variable lastmsg -- to avoid the literal >+ * "\n" being put into the proctitle. >+ * So, if the lastmsg needs to be output elsewhere, that should happen >+ * before calling title(). >+ */ >+void title() >+{ >+ int lastlen; >+ >+ lastlen = strlen(lastmsg); >+ if (lastmsg[lastlen-1] == '\n') >+ lastmsg[lastlen-1] = '\0'; >+ >+ /* >+ * It would be unwise to run multiple dumps of same disk >+ * at the same time. So ``disk'' is sufficient for >+ * identifying, to which family of dump processes this >+ * one belongs -- the other processes continue to have >+ * the original titles. >+ */ >+ setproctitle("%s: %s", disk, lastmsg); > } > >Index: tape.c >=================================================================== >RCS file: /home/ncvs/src/sbin/dump/tape.c,v >retrieving revision 1.14 >diff -U2 -r1.14 tape.c >--- tape.c 17 Nov 2001 00:06:55 -0000 1.14 >+++ tape.c 20 Nov 2001 16:49:15 -0000 >@@ -309,5 +309,5 @@ > startnewtape(0); > } >- timeest(); >+ timeest(0); > } > >@@ -522,4 +522,5 @@ > * All signals are inherited... > */ >+ setproctitle(NULL); /* restore the proctitle modified by title() */ > childpid = fork(); > if (childpid < 0) { >@@ -612,4 +613,5 @@ > > enslave(); /* Share open tape file descriptor with slaves */ >+ signal(SIGINFO, timeest); /* report progress on SIGINFO */ > > asize = 0;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 32138
: 17752