View | Details | Raw Unified | Return to bug 32138
Collapse All | Expand All

(-)dump.8 (-1 / +2 lines)
Lines 320-324 Link Here
320
.Pp
320
.Pp
321
.Nm Dump
321
.Nm Dump
322
tells the operator what is going on at periodic intervals,
322
tells the operator what is going on at periodic intervals --
323
every 5 minutes, or promptly after receiving SIGINFO --
323
including usually low estimates of the number of blocks to write,
324
including usually low estimates of the number of blocks to write,
324
the number of tapes it will take, the time to completion, and
325
the number of tapes it will take, the time to completion, and
(-)dump.h (-1 / +2 lines)
Lines 101-106 Link Here
101
int	query __P((char *question));
101
int	query __P((char *question));
102
void	quit __P((const char *fmt, ...)) __printflike(1, 2);
102
void	quit __P((const char *fmt, ...)) __printflike(1, 2);
103
void	timeest __P((void));
103
void	timeest __P((int)); /* accepts the signal number */
104
time_t	unctime __P((char *str));
104
time_t	unctime __P((char *str));
105
void	title __P((void));
105
106
106
/* mapping rouintes */
107
/* mapping rouintes */
(-)optr.c (-4 / +45 lines)
Lines 52-55 Link Here
52
#include <string.h>
52
#include <string.h>
53
#include <stdarg.h>
53
#include <stdarg.h>
54
#include <signal.h>
54
#include <unistd.h>
55
#include <unistd.h>
55
#include <utmp.h>
56
#include <utmp.h>
Lines 191-204 Link Here
191
192
192
void
193
void
193
timeest()
194
timeest(signal)
194
{
195
{
195
	time_t	tnow;
196
	time_t	tnow;
196
	int deltat;
197
	int deltat;
197
198
198
	(void) time((time_t *) &tnow);
199
	if (signal != 0) {
200
		/*
201
		 * We might be called to handle SIGINFO. Re-schedule
202
		 * the reporting to occur the next time we are called
203
		 * regularly and bail out -- don't do reporting as a
204
		 * signal handler -- it involves malloc-ing and other
205
		 * things signal handler are not supposed to do.
206
		 */
207
		/*
208
		 * 300 seconds is a constant only used in this function
209
		 */
210
		tschedule -= 300;
211
		return;
212
	}
213
	(void) time(&tnow);
199
	if (tnow >= tschedule) {
214
	if (tnow >= tschedule) {
200
		tschedule = tnow + 300;
215
		tschedule = tnow + 300;
201
		if (blockswritten < 500)
202
			return;
203
		deltat = tstart_writing - tnow +
216
		deltat = tstart_writing - tnow +
204
			(1.0 * (tnow - tstart_writing))
217
			(1.0 * (tnow - tstart_writing))
Lines 207-210 Link Here
207
			(blockswritten * 100.0) / tapesize,
220
			(blockswritten * 100.0) / tapesize,
208
			deltat / 3600, (deltat % 3600) / 60);
221
			deltat / 3600, (deltat % 3600) / 60);
222
		title();
209
	}
223
	}
210
}
224
}
Lines 235-238 Link Here
235
	(void) vsnprintf(lastmsg, sizeof(lastmsg), fmt, ap);
249
	(void) vsnprintf(lastmsg, sizeof(lastmsg), fmt, ap);
236
	va_end(ap);
250
	va_end(ap);
251
}
252
253
/*
254
 * This function can be called to place, what msg() above pushed to
255
 * stderr, into the process title, viewable with the ps-command.
256
 * A side effect of this function, is it replaces the final '\n' (if any)
257
 * with the '\0' in the global variable lastmsg -- to avoid the literal
258
 * "\n" being put into the proctitle.
259
 * So, if the lastmsg needs to be output elsewhere, that should happen
260
 * before calling title().
261
 */
262
void title()
263
{
264
	int lastlen;
265
266
	lastlen = strlen(lastmsg);
267
	if (lastmsg[lastlen-1] == '\n')
268
		lastmsg[lastlen-1] = '\0';
269
270
	/*
271
	 * It would be unwise to run multiple dumps of same disk
272
	 * at  the  same time.  So  ``disk''  is sufficient  for
273
	 * identifying, to  which family of dump  processes this
274
	 * one belongs  -- the other processes  continue to have
275
	 * the original titles.
276
	 */
277
	setproctitle("%s: %s", disk, lastmsg);
237
}
278
}
238
279
(-)tape.c (-1 / +3 lines)
Lines 309-313 Link Here
309
		startnewtape(0);
309
		startnewtape(0);
310
	}
310
	}
311
	timeest();
311
	timeest(0);
312
}
312
}
313
313
Lines 522-525 Link Here
522
	 *	All signals are inherited...
522
	 *	All signals are inherited...
523
	 */
523
	 */
524
	setproctitle(NULL); /* restore the proctitle modified by title() */
524
	childpid = fork();
525
	childpid = fork();
525
	if (childpid < 0) {
526
	if (childpid < 0) {
Lines 612-615 Link Here
612
613
613
		enslave();  /* Share open tape file descriptor with slaves */
614
		enslave();  /* Share open tape file descriptor with slaves */
615
		signal(SIGINFO, timeest); /* report progress on SIGINFO */
614
616
615
		asize = 0;
617
		asize = 0;

Return to bug 32138