alignment restrictions when writing to raw magtape

Thomas Truscott trt at rti.UUCP
Sat Aug 5 08:36:22 AEST 1989


The following program, run on on OSx4.4 on a Pyramid
(I forget the exact info but it has 2 10MIP cpus,
and a fast tape unit),
shows that if the write buffer does not begin on
a 4-byte boundary, the write syscall fails with EFAULT.

Why is this? Note that one can write
any number of bytes to the drive, thus the buffer can *end*
on an arbitrary boundary.

main()
{
	char b[9000];
	int i, fd;

	if ((fd = open("/dev/rmt0", 2)) < 0)
		perror("open");
	for (i = 0; i < 8; i++)
		if (write(fd, b+i, 43) != 43)
			perror("write");
		else
			printf("%d\n", i);
	exit(0);
}

I would hope that this will be considered a (admittedly minor)
bug and hope that a kernel fix is not too difficult.
It it is not considered a bug, could someone point to
a specific (e.g. "/dev/odk0, optical paper tape on SolOS 3.1")
instance in which a similar limitation exists?
(Am am aware that some disks must be given write lengths
that are multiples of their sector size, that is not at issue here).
	Tom Truscott



More information about the Comp.sys.pyramid mailing list