Deleted Added
sdiff udiff text old ( 128073 ) new ( 128175 )
full compact
1/*-
2 * Copyright (c) 1980, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 18 unchanged lines hidden (view full) ---

27 * SUCH DAMAGE.
28 */
29
30#ifndef lint
31#if 0
32static char sccsid[] = "@(#)tape.c 8.4 (Berkeley) 5/1/95";
33#endif
34static const char rcsid[] =
35 "$FreeBSD: head/sbin/dump/tape.c 128073 2004-04-09 19:58:40Z markm $";
36#endif /* not lint */
37
38#include <sys/param.h>
39#include <sys/socket.h>
40#include <sys/time.h>
41#include <sys/wait.h>
42#include <sys/stat.h>
43

--- 18 unchanged lines hidden (view full) ---

62int64_t lastspclrec = -1; /* tape block number of last written header */
63int trecno = 0; /* next record to write in current block */
64extern long blocksperfile; /* number of blocks per output file */
65long blocksthisvol; /* number of blocks on current output file */
66extern int ntrec; /* blocking factor on tape */
67extern int cartridge;
68extern char *host;
69char *nexttape;
70
71static int atomic(ssize_t (*)(), int, char *, int);
72static void doslave(int, int);
73static void enslave(void);
74static void flushtape(void);
75static void killall(void);
76static void rollforward(void);
77

--- 253 unchanged lines hidden (view full) ---

331 while (wait((int *)NULL) >= 0) /* wait for any signals from slaves */
332 /* void */;
333
334 if (pipeout)
335 return;
336
337 msg("Closing %s\n", tape);
338
339#ifdef RDUMP
340 if (host) {
341 rmtclose();
342 while (rmtopen(tape, 0) < 0)
343 sleep(10);
344 rmtclose();
345 return;
346 }

--- 148 unchanged lines hidden (view full) ---

495 * everything continues as if nothing had happened.
496 */
497void
498startnewtape(int top)
499{
500 int parentpid;
501 int childpid;
502 int status;
503 int waitpid;
504 char *p;
505 sig_t interrupt_save;
506
507 interrupt_save = signal(SIGINT, SIG_IGN);
508 parentpid = getpid();
509
510restore_check_point:
511 (void)signal(SIGINT, interrupt_save);

--- 13 unchanged lines hidden (view full) ---

525 * until the child doing all of the work returns.
526 * don't catch the interrupt
527 */
528 signal(SIGINT, SIG_IGN);
529#ifdef TDEBUG
530 msg("Tape: %d; parent process: %d child process %d\n",
531 tapeno+1, parentpid, childpid);
532#endif /* TDEBUG */
533 while ((waitpid = wait(&status)) != childpid)
534 msg("Parent %d waiting for child %d has another child %d return\n",
535 parentpid, childpid, waitpid);
536 if (status & 0xFF) {
537 msg("Child %d returns LOB status %o\n",
538 childpid, status&0xFF);
539 }
540 status = (status >> 8) & 0xFF;
541#ifdef TDEBUG
542 switch(status) {
543 case X_FINOK:

--- 40 unchanged lines hidden (view full) ---

584 tape = nexttape;
585 if ((p = strchr(tape, ',')) != NULL) {
586 *p = '\0';
587 nexttape = p + 1;
588 } else
589 nexttape = NULL;
590 msg("Dumping volume %d on %s\n", tapeno, tape);
591 }
592#ifdef RDUMP
593 while ((tapefd = (host ? rmtopen(tape, 2) :
594 pipeout ? 1 : open(tape, O_WRONLY|O_CREAT, 0666))) < 0)
595#else
596 while ((tapefd = (pipeout ? 1 :
597 open(tape, O_WRONLY|O_CREAT, 0666))) < 0)
598#endif
599 {
600 msg("Cannot open output \"%s\".\n", tape);
601 if (!query("Do you want to retry the open?"))
602 dumpabort(0);
603 }
604
605 enslave(); /* Share open tape file descriptor with slaves */
606 signal(SIGINFO, infosch);
607
608 asize = 0;
609 blocksthisvol = 0;
610 if (top)
611 newtape++; /* new tape signal */
612 spcl.c_count = slp->count;
613 /*

--- 240 unchanged lines hidden ---