read() from a tape

stevens at hsi.UUCP stevens at hsi.UUCP
Tue Nov 8 23:23:48 AEST 1983


On a VAX running 4.1bsd I found some code in a tape reading program
that went

	int length;

	length = read(tapefd, buf, 62000);
	if (length < 0)
		/* error */ ...
	if (length != -1)
		length &= 0xffff;

I removed the mask and sure enough, a read of a 3120 byte tape record
returned a length of 65536+3120, hence the mask was required.
I reduced the buffer size and the length to read to 30,000 bytes and
the returned value became 3120, so the mask was not needed.

Anyone know whats going on ?  (The tape driver is tm.c.)

	Richard Stevens
	Health Systems International, New Haven, CT
	{ decvax | hao | seismo | sdcsvax } ! kpno ! hsi ! stevens
                                             ihnp4 ! hsi ! stevens



More information about the Comp.unix.wizards mailing list