Fixes from FreeBSD:
- Fix error if first tape was write protected. Fix NetBSD PRs 4754 and 6098. - Make dump exit codes confirm to manual page. - Use \a instead of \7 to make noise. - Fix estimated number of tapes for huge dumps to cartridges. - Use <sys/queue.h> SLIST_* instead of home-rolled lists. - Do not exit if unable to read or create /etc/dumpdates. - Support output (tape) device returning ENOSPC for end-of-media on a write. Fixes by me: - Remove unused ddates_in. - Don't dump core if SIGINFO is received before 1 second has elapsed. - Only process SIGINFO in current "active" child. - Don't dump core in -w if dumpdates wasn't readable and ddatev == NULL - Minor KNF; wrap some lines
This commit is contained in:
parent
1f19340e88
commit
8975510a51
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dump.h,v 1.31 2001/12/22 08:05:24 lukem Exp $ */
|
||||
/* $NetBSD: dump.h,v 1.32 2001/12/25 12:06:26 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -223,6 +223,7 @@ void interrupt(int); /* in case operator bangs on console */
|
||||
* Exit status codes
|
||||
*/
|
||||
#define X_FINOK 0 /* normal exit */
|
||||
#define X_STARTUP 1 /* startup error */
|
||||
#define X_REWRITE 2 /* restart writing from the check point */
|
||||
#define X_ABORT 3 /* abort dump; don't attempt checkpointing */
|
||||
|
||||
@ -245,21 +246,16 @@ struct dumpdates {
|
||||
char dd_level;
|
||||
time_t dd_ddate;
|
||||
};
|
||||
struct dumptime {
|
||||
struct dumpdates dt_value;
|
||||
struct dumptime *dt_next;
|
||||
};
|
||||
|
||||
extern struct dumptime *dthead; /* head of the list version */
|
||||
extern int nddates; /* number of records (might be zero) */
|
||||
extern int ddates_in; /* we have read the increment file */
|
||||
extern struct dumpdates **ddatev; /* the arrayfied version */
|
||||
|
||||
void initdumptimes(void);
|
||||
void getdumptime(void);
|
||||
void putdumptime(void);
|
||||
#define ITITERATE(i, ddp) \
|
||||
for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i])
|
||||
if (ddatev != NULL) \
|
||||
for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i])
|
||||
|
||||
void sig(int signo);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dumprmt.c,v 1.28 2001/12/23 12:54:53 lukem Exp $ */
|
||||
/* $NetBSD: dumprmt.c,v 1.29 2001/12/25 12:06:26 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dumprmt.c 8.3 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: dumprmt.c,v 1.28 2001/12/23 12:54:53 lukem Exp $");
|
||||
__RCSID("$NetBSD: dumprmt.c,v 1.29 2001/12/25 12:06:26 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -94,7 +94,7 @@ rmthost(char *host)
|
||||
{
|
||||
|
||||
if ((rmtpeer = strdup(host)) == NULL)
|
||||
err(1, "strdup");
|
||||
err(X_STARTUP, "strdup");
|
||||
signal(SIGPIPE, rmtconnaborted);
|
||||
rmtgetconn();
|
||||
if (rmtape < 0)
|
||||
@ -106,7 +106,7 @@ static void
|
||||
rmtconnaborted(int dummy)
|
||||
{
|
||||
|
||||
errx(1, "Lost connection to remote host.");
|
||||
errx(X_ABORT, "Lost connection to remote host.");
|
||||
}
|
||||
|
||||
void
|
||||
@ -121,18 +121,18 @@ rmtgetconn(void)
|
||||
if (sp == NULL) {
|
||||
sp = getservbyname("shell", "tcp");
|
||||
if (sp == NULL)
|
||||
errx(1, "shell/tcp: unknown service");
|
||||
errx(X_STARTUP, "shell/tcp: unknown service");
|
||||
pwd = getpwuid(getuid());
|
||||
if (pwd == NULL)
|
||||
errx(1, "who are you?");
|
||||
errx(X_STARTUP, "who are you?");
|
||||
}
|
||||
if ((name = strdup(pwd->pw_name)) == NULL)
|
||||
err(1, "strdup");
|
||||
err(X_STARTUP, "strdup");
|
||||
if ((cp = strchr(rmtpeer, '@')) != NULL) {
|
||||
tuser = rmtpeer;
|
||||
*cp = '\0';
|
||||
if (!okname(tuser))
|
||||
exit(1);
|
||||
exit(X_STARTUP);
|
||||
rmtpeer = ++cp;
|
||||
} else
|
||||
tuser = name;
|
||||
@ -205,8 +205,8 @@ rmtread(char *buf, int count)
|
||||
(void)snprintf(line, sizeof line, "R%d\n", count);
|
||||
n = rmtcall("read", line, 1);
|
||||
if (n < 0) {
|
||||
errno = n;
|
||||
return (-1);
|
||||
/* rmtcall() properly sets errno for us on errors. */
|
||||
return (n);
|
||||
}
|
||||
for (i = 0; i < n; i += cc) {
|
||||
cc = read(rmtape, buf+i, n - i);
|
||||
@ -311,10 +311,9 @@ rmtreply(char *cmd, int verbose)
|
||||
rmtgets(emsg, sizeof (emsg));
|
||||
if (verbose)
|
||||
msg("%s: %s", cmd, emsg);
|
||||
if (*code == 'F') {
|
||||
errno = atoi(code + 1);
|
||||
if (*code == 'F')
|
||||
rmtstate = TS_CLOSED;
|
||||
return (-1);
|
||||
}
|
||||
return (-1);
|
||||
}
|
||||
if (*code != 'A') {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: itime.c,v 1.12 2001/12/23 12:54:53 lukem Exp $ */
|
||||
/* $NetBSD: itime.c,v 1.13 2001/12/25 12:06:26 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -38,11 +38,12 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)itime.c 8.1 (Berkeley) 6/5/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: itime.c,v 1.12 2001/12/23 12:54:53 lukem Exp $");
|
||||
__RCSID("$NetBSD: itime.c,v 1.13 2001/12/25 12:06:26 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/time.h>
|
||||
#include <ufs/ufs/dinode.h>
|
||||
|
||||
@ -58,10 +59,13 @@ __RCSID("$NetBSD: itime.c,v 1.12 2001/12/23 12:54:53 lukem Exp $");
|
||||
|
||||
#include "dump.h"
|
||||
|
||||
struct dumptime {
|
||||
struct dumpdates dt_value;
|
||||
SLIST_ENTRY(dumptime) dt_list;
|
||||
};
|
||||
SLIST_HEAD(dthead, dumptime) dthead = SLIST_HEAD_INITIALIZER(dthead);
|
||||
struct dumpdates **ddatev = 0;
|
||||
int nddates = 0;
|
||||
int ddates_in = 0;
|
||||
struct dumptime *dthead = 0;
|
||||
|
||||
static void dumprecout(FILE *, struct dumpdates *);
|
||||
static int getrecord(FILE *, struct dumpdates *);
|
||||
@ -75,18 +79,18 @@ initdumptimes(void)
|
||||
|
||||
if ((df = fopen(dumpdates, "r")) == NULL) {
|
||||
if (errno != ENOENT) {
|
||||
quit("cannot read %s: %s\n", dumpdates,
|
||||
msg("WARNING: cannot read %s: %s\n", dumpdates,
|
||||
strerror(errno));
|
||||
/* NOTREACHED */
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* Dumpdates does not exist, make an empty one.
|
||||
*/
|
||||
msg("WARNING: no file `%s', making an empty one\n", dumpdates);
|
||||
if ((df = fopen(dumpdates, "w")) == NULL) {
|
||||
quit("cannot create %s: %s\n", dumpdates,
|
||||
msg("WARNING: cannot create %s: %s\n", dumpdates,
|
||||
strerror(errno));
|
||||
/* NOTREACHED */
|
||||
return;
|
||||
}
|
||||
(void) fclose(df);
|
||||
if ((df = fopen(dumpdates, "r")) == NULL) {
|
||||
@ -111,19 +115,17 @@ readdumptimes(FILE *df)
|
||||
if (getrecord(df, &(dtwalk->dt_value)) < 0)
|
||||
break;
|
||||
nddates++;
|
||||
dtwalk->dt_next = dthead;
|
||||
dthead = dtwalk;
|
||||
SLIST_INSERT_HEAD(&dthead, dtwalk, dt_list);
|
||||
}
|
||||
|
||||
ddates_in = 1;
|
||||
/*
|
||||
* arrayify the list, leaving enough room for the additional
|
||||
* record that we may have to add to the ddate structure
|
||||
*/
|
||||
ddatev = (struct dumpdates **)
|
||||
xcalloc((unsigned) (nddates + 1), sizeof(struct dumpdates *));
|
||||
dtwalk = dthead;
|
||||
for (i = nddates - 1; i >= 0; i--, dtwalk = dtwalk->dt_next)
|
||||
dtwalk = SLIST_FIRST(&dthead);
|
||||
for (i = nddates - 1; i >= 0; i--, dtwalk = SLIST_NEXT(dtwalk, dt_list))
|
||||
ddatev[i] = &dtwalk->dt_value;
|
||||
}
|
||||
|
||||
@ -178,8 +180,6 @@ putdumptime(void)
|
||||
free((char *)ddatev);
|
||||
ddatev = 0;
|
||||
nddates = 0;
|
||||
dthead = 0;
|
||||
ddates_in = 0;
|
||||
readdumptimes(df);
|
||||
if (fseek(df, 0L, 0) < 0)
|
||||
quit("fseek: %s\n", strerror(errno));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.47 2001/12/23 14:42:22 lukem Exp $ */
|
||||
/* $NetBSD: main.c,v 1.48 2001/12/25 12:06:26 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1991, 1993, 1994
|
||||
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993, 1994\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/1/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: main.c,v 1.47 2001/12/23 14:42:22 lukem Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.48 2001/12/25 12:06:26 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -233,7 +233,7 @@ main(int argc, char *argv[])
|
||||
if (spcl.c_ddate < 0) {
|
||||
(void)fprintf(stderr, "bad time \"%s\"\n",
|
||||
optarg);
|
||||
exit(X_ABORT);
|
||||
exit(X_STARTUP);
|
||||
}
|
||||
Tflag = 1;
|
||||
lastlevel = '?';
|
||||
@ -246,7 +246,7 @@ main(int argc, char *argv[])
|
||||
case 'W': /* what to do */
|
||||
case 'w':
|
||||
lastdump(ch);
|
||||
exit(0); /* do nothing else */
|
||||
exit(X_FINOK); /* do nothing else */
|
||||
|
||||
default:
|
||||
usage();
|
||||
@ -257,7 +257,7 @@ main(int argc, char *argv[])
|
||||
if (argc < 1) {
|
||||
(void)fprintf(stderr,
|
||||
"Must specify disk or image, or file list\n");
|
||||
exit(X_ABORT);
|
||||
exit(X_STARTUP);
|
||||
}
|
||||
|
||||
|
||||
@ -321,13 +321,13 @@ main(int argc, char *argv[])
|
||||
while (--argc)
|
||||
(void)fprintf(stderr, " %s", *argv++);
|
||||
(void)fprintf(stderr, "\n");
|
||||
exit(X_ABORT);
|
||||
exit(X_STARTUP);
|
||||
}
|
||||
}
|
||||
if (Tflag && uflag) {
|
||||
(void)fprintf(stderr,
|
||||
"You cannot use the T and u flags together.\n");
|
||||
exit(X_ABORT);
|
||||
exit(X_STARTUP);
|
||||
}
|
||||
if (strcmp(tape, "-") == 0) {
|
||||
pipeout++;
|
||||
@ -358,10 +358,10 @@ main(int argc, char *argv[])
|
||||
*tape++ = '\0';
|
||||
#ifdef RDUMP
|
||||
if (rmthost(host) == 0)
|
||||
exit(X_ABORT);
|
||||
exit(X_STARTUP);
|
||||
#else
|
||||
(void)fprintf(stderr, "remote dump not enabled\n");
|
||||
exit(X_ABORT);
|
||||
exit(X_STARTUP);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -415,7 +415,7 @@ main(int argc, char *argv[])
|
||||
|
||||
if ((diskfd = open(disk, O_RDONLY)) < 0) {
|
||||
msg("Cannot open %s\n", disk);
|
||||
exit(X_ABORT);
|
||||
exit(X_STARTUP);
|
||||
}
|
||||
sync();
|
||||
|
||||
@ -488,11 +488,11 @@ main(int argc, char *argv[])
|
||||
Assume no erroneous blocks; this can be compensated
|
||||
for with an artificially low tape size. */
|
||||
fetapes =
|
||||
( tapesize /* blocks */
|
||||
( (double) tapesize /* blocks */
|
||||
* TP_BSIZE /* bytes/block */
|
||||
* (1.0/density) /* 0.1" / byte */
|
||||
+
|
||||
tapesize /* blocks */
|
||||
(double) tapesize /* blocks */
|
||||
* (1.0/ntrec) /* streaming-stops per block */
|
||||
* 15.48 /* 0.1" / streaming-stop */
|
||||
) * (1.0 / tsize ); /* tape / 0.1" */
|
||||
@ -524,7 +524,7 @@ main(int argc, char *argv[])
|
||||
* tapes, exit now.
|
||||
*/
|
||||
if (just_estimate)
|
||||
exit(0);
|
||||
exit(X_FINOK);
|
||||
|
||||
/*
|
||||
* Allocate tape buffer.
|
||||
@ -592,7 +592,7 @@ main(int argc, char *argv[])
|
||||
msg("Average transfer rate: %d KB/s\n", xferrate / tapeno);
|
||||
putdumptime();
|
||||
trewind(0);
|
||||
broadcast("DUMP IS DONE!\7\7\n");
|
||||
broadcast("DUMP IS DONE!\a\a\n");
|
||||
msg("DUMP IS DONE\n");
|
||||
Exit(X_FINOK);
|
||||
/* NOTREACHED */
|
||||
@ -608,7 +608,7 @@ usage(void)
|
||||
" [-f file] [-h level] [-k read block size] [-L label]",
|
||||
" [-r read cache size] [-s feet] [-T date] file system",
|
||||
" dump [-W | -w]");
|
||||
exit(1);
|
||||
exit(X_STARTUP);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -623,9 +623,10 @@ numarg(char *meaning, long vmin, long vmax)
|
||||
|
||||
val = strtol(optarg, &p, 10);
|
||||
if (*p)
|
||||
errx(1, "illegal %s -- %s", meaning, optarg);
|
||||
errx(X_STARTUP, "illegal %s -- %s", meaning, optarg);
|
||||
if (val < vmin || (vmax && val > vmax))
|
||||
errx(1, "%s must be between %ld and %ld", meaning, vmin, vmax);
|
||||
errx(X_STARTUP, "%s must be between %ld and %ld",
|
||||
meaning, vmin, vmax);
|
||||
return (val);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: optr.c,v 1.24 2001/12/24 03:02:34 lukem Exp $ */
|
||||
/* $NetBSD: optr.c,v 1.25 2001/12/25 12:06:26 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1988, 1993
|
||||
@ -38,11 +38,12 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)optr.c 8.2 (Berkeley) 1/6/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: optr.c,v 1.24 2001/12/24 03:02:34 lukem Exp $");
|
||||
__RCSID("$NetBSD: optr.c,v 1.25 2001/12/25 12:06:26 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/ucred.h>
|
||||
@ -155,7 +156,7 @@ alarmcatch(int dummy)
|
||||
" DUMP: %s: (\"yes\" or \"no\") ",
|
||||
attnmessage);
|
||||
else
|
||||
msgtail("\7\7");
|
||||
msgtail("\a\a");
|
||||
} else {
|
||||
if (timeout) {
|
||||
msgtail("\n");
|
||||
@ -287,7 +288,7 @@ sendmes(char *tty, char *message)
|
||||
setbuf(f_tty, buf);
|
||||
(void) fprintf(f_tty,
|
||||
"\n\
|
||||
\7\7\7Message from the dump program to all operators at %d:%02d ...\r\n\n\
|
||||
\a\a\aMessage from the dump program to all operators at %d:%02d ...\r\n\n\
|
||||
DUMP: NEEDS ATTENTION: ",
|
||||
localclock->tm_hour, localclock->tm_min);
|
||||
for (cp = lastmsg; ; cp++) {
|
||||
@ -433,11 +434,11 @@ allocfsent(struct fstab *fs)
|
||||
}
|
||||
|
||||
struct pfstab {
|
||||
struct pfstab *pf_next;
|
||||
SLIST_ENTRY(pfstab) pf_list;
|
||||
struct fstab *pf_fstab;
|
||||
};
|
||||
|
||||
static struct pfstab *table;
|
||||
static SLIST_HEAD(, pfstab) table;
|
||||
|
||||
void
|
||||
getfstab(void)
|
||||
@ -466,8 +467,7 @@ getfstab(void)
|
||||
fs = allocfsent(fs);
|
||||
pf = (struct pfstab *)xmalloc(sizeof (*pf));
|
||||
pf->pf_fstab = fs;
|
||||
pf->pf_next = table;
|
||||
table = pf;
|
||||
SLIST_INSERT_HEAD(&table, pf, pf_list);
|
||||
}
|
||||
(void) endfsent();
|
||||
}
|
||||
@ -490,7 +490,7 @@ fstabsearch(const char *key)
|
||||
struct fstab *fs;
|
||||
char *rn;
|
||||
|
||||
for (pf = table; pf != NULL; pf = pf->pf_next) {
|
||||
SLIST_FOREACH(pf, &table, pf_list) {
|
||||
fs = pf->pf_fstab;
|
||||
if (strcmp(fs->fs_file, key) == 0 ||
|
||||
strcmp(fs->fs_spec, key) == 0)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tape.c,v 1.34 2001/12/23 12:54:54 lukem Exp $ */
|
||||
/* $NetBSD: tape.c,v 1.35 2001/12/25 12:06:26 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1991, 1993
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)tape.c 8.4 (Berkeley) 5/1/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: tape.c,v 1.34 2001/12/23 12:54:54 lukem Exp $");
|
||||
__RCSID("$NetBSD: tape.c,v 1.35 2001/12/25 12:06:26 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -269,12 +269,15 @@ statussig(int notused)
|
||||
if (blockswritten < 500)
|
||||
return;
|
||||
(void) time((time_t *) &tnow);
|
||||
deltat = tstart_writing - tnow + (1.0 * (tnow - tstart_writing))
|
||||
/ blockswritten * tapesize;
|
||||
if (tnow <= tstart_volume)
|
||||
return;
|
||||
deltat = tstart_writing - tnow +
|
||||
(1.0 * (tnow - tstart_writing)) / blockswritten * tapesize;
|
||||
(void)snprintf(msgbuf, sizeof(msgbuf),
|
||||
"%3.2f%% done at %ld KB/s, finished in %d:%02d\n",
|
||||
(blockswritten * 100.0) / tapesize,
|
||||
(long)((iswap32(spcl.c_tapea) - tapea_volume) / (tnow - tstart_volume)),
|
||||
(long)((iswap32(spcl.c_tapea) - tapea_volume) /
|
||||
(tnow - tstart_volume)),
|
||||
(int)(deltat / 3600), (int)((deltat % 3600) / 60));
|
||||
write(STDERR_FILENO, msgbuf, strlen(msgbuf));
|
||||
}
|
||||
@ -432,7 +435,7 @@ close_rewind(void)
|
||||
return;
|
||||
if (!nogripe) {
|
||||
msg("Change Volumes: Mount volume #%d\n", tapeno+1);
|
||||
broadcast("CHANGE DUMP VOLUMES!\7\7\n");
|
||||
broadcast("CHANGE DUMP VOLUMES!\a\a\n");
|
||||
}
|
||||
if (lflag) {
|
||||
for (i = 0; i < 12; i++) { /* wait 2 mn */
|
||||
@ -606,6 +609,7 @@ restore_check_point:
|
||||
* don't catch the interrupt
|
||||
*/
|
||||
signal(SIGINT, SIG_IGN);
|
||||
signal(SIGINFO, SIG_IGN); /* only want child's stats */
|
||||
#ifdef TDEBUG
|
||||
msg("Tape: %d; parent process: %d child process %d\n",
|
||||
tapeno+1, parentpid, childpid);
|
||||
@ -648,6 +652,7 @@ restore_check_point:
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
} else { /* we are the child; just continue */
|
||||
signal(SIGINFO, statussig); /* now want child's stats */
|
||||
#ifdef TDEBUG
|
||||
sleep(4); /* allow time for parent's message to get out */
|
||||
msg("Child on Tape %d has parent %d, my pid = %d\n",
|
||||
@ -796,8 +801,10 @@ killall(void)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < SLAVES; i++)
|
||||
if (slaves[i].pid > 0)
|
||||
if (slaves[i].pid > 0) {
|
||||
(void) kill(slaves[i].pid, SIGKILL);
|
||||
slaves[i].sent = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -810,8 +817,7 @@ killall(void)
|
||||
static void
|
||||
doslave(int cmd, int slave_number)
|
||||
{
|
||||
int nread;
|
||||
int nextslave, size, wrote, eot_count;
|
||||
int nread, nextslave, size, wrote, eot_count, werror;
|
||||
sigset_t sigset;
|
||||
|
||||
/*
|
||||
@ -858,6 +864,7 @@ doslave(int cmd, int slave_number)
|
||||
/* Try to write the data... */
|
||||
eot_count = 0;
|
||||
size = 0;
|
||||
werror = 0;
|
||||
|
||||
while (eot_count < 10 && size < writesize) {
|
||||
#ifdef RDUMP
|
||||
@ -868,8 +875,10 @@ doslave(int cmd, int slave_number)
|
||||
#endif
|
||||
wrote = write(tapefd, slp->tblock[0]+size,
|
||||
writesize-size);
|
||||
werror = errno;
|
||||
#ifdef WRITEDEBUG
|
||||
fprintf(stderr, "slave %d wrote %d\n", slave_number, wrote);
|
||||
fprintf(stderr, "slave %d wrote %d werror %d\n",
|
||||
slave_number, wrote, werror);
|
||||
#endif
|
||||
if (wrote < 0)
|
||||
break;
|
||||
@ -885,14 +894,18 @@ doslave(int cmd, int slave_number)
|
||||
slave_number, size, writesize);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Handle ENOSPC as an EOT condition.
|
||||
*/
|
||||
if (wrote < 0 && werror == ENOSPC) {
|
||||
wrote = 0;
|
||||
eot_count++;
|
||||
}
|
||||
|
||||
if (eot_count > 0)
|
||||
size = 0;
|
||||
|
||||
/*
|
||||
* fixme: Pyramids running OSx return ENOSPC
|
||||
* at EOT on 1/2 inch drives.
|
||||
*/
|
||||
if (size < 0) {
|
||||
if (wrote < 0) {
|
||||
(void) kill(master, SIGUSR1);
|
||||
sigemptyset(&sigset);
|
||||
for (;;)
|
||||
|
Loading…
Reference in New Issue
Block a user