Hello,

as you probably know I want to expand dump in such
a way it enableds multivolume dumps also when the
output data is written to stdout/a pipe.
Now I ran into a serious problem.
Dump counts the written bytes to remember where
it has to proceede after the volumen change.
Now the SIGPIPE signal does not propagate fast
enought through the system. Thus dump writes
some time after the pipe has got broken data into
the pipe while it doesn't exist anymore. This short
time it does not receive any error about that.
(Until the signal propagates to dump.)
I wrote a small test progam to demonstrate this
effect (and get clear about it by myself). It just
write data to stdout and counts it until the pipe
is broken (and the write call will return -1) This
is the output of a few successively runs:


$ ./a.out |asdf
$ asdf: command not found
cought broken pipe
i: 12 could only wrote -1 bytes. total wrote: 61440

$ ./a.out |asdf
$ asdf: command not found
cought broken pipe
i: 1 could only wrote -1 bytes. total wrote: 5120

$ ./a.out |asdf
$ asdf: command not found
cought broken pipe
i: 12 could only wrote -1 bytes. total wrote: 61440

$ ./a.out |asdf
$ asdf: command not found
cought broken pipe
i: 0 could only wrote -1 bytes. total wrote: 0


Dump encounters the same effect and I don't know how
to handle this problem. Do you have any idea how I
can manage this?

Thank you,
Martin L.

PS: Here's the code of the small test-program:

-----------------:<----------------
#include
#include
#include
#include
#include
#include
#include
#include

#define MUL 5
char buffer [1024 * MUL];

void
sigpipe(int signo __unused)
{
fprintf(stderr, "cought broken pipe\n");
}

main()
{
int i , w;
int wr =3D 0;

signal(SIGPIPE, sigpipe);

for (i =3D 0; i <=3D 100; i++) {
w =3D write(STDOUT_FILENO, buffer, MUL * 1024);
if (w > 0)
wr +=3D w;
if (w !=3D 1024 * MUL) {
fprintf(stderr, "i: %d could only wrote %d byte=
s. =

total
break;
}
}
}
------------------------:<--------------------------------
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/lis...reebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"