Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Aug 2002 13:33:30 +0100
From:      Ian Dowse <iedowse@maths.tcd.ie>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        Alexander Leidinger <Alexander@Leidinger.net>, bhlewis@wossname.net, freebsd-current@FreeBSD.ORG
Subject:   Re: Is anyone else having trouble with dump(8) on -current? 
Message-ID:   <200208111333.aa34638@salmon.maths.tcd.ie>
In-Reply-To: Your message of "Sun, 11 Aug 2002 02:03:40 %2B1000." <20020811014214.D17412-100000@gamplex.bde.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <20020811014214.D17412-100000@gamplex.bde.org>, Bruce Evans writes:
>
>I don't know how open() of a disk device can be interrupted by a signal
>in practice.  Most disk operations don't check for signals.

Does the PCATCH tsleep in diskopen() that I mentioned seem a likely
candidate? Anyway, below is a simple program that reproduces the
EINTR error fairly reliably for me when run on disk devices.

Ian

#include <sys/types.h>
#include <err.h>
#include <fcntl.h>
#include <signal.h>
#include <unistd.h>

void
handler(int sig) {
}

int
main(int argc, char **argv)
{
	int fd, i;
	if (argc < 2)
		errx(1, "Usage: %s device", argv[0]);
	fork();
	fork();
	fork();
	fork();

	signal(SIGUSR1, handler);
	sleep(1);

	for (i = 0; i < 200; i++) {
		killpg(0, SIGUSR1);
		if ((fd = open(argv[1], O_RDONLY)) < 0)
			err(1, "%s", argv[1]);
		close(fd);
	}
	return 0;
}

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi? <200208111333.aa34638>