write(2) to tape with odd byte count

Doug Gwyn <gwyn> gwyn at brl-tgr.ARPA
Thu Dec 5 17:39:48 AEST 1985


> Is it possible to create a tape with an odd number of bytes
> per record?  When I try such an operation with write(2), I
> get a return code of -1 (Oh, sorry, this is 2.8BSD).  When I
> do an identical write to a disk file, there is no problem.
> Do tape controllers only work in words?

Actually, raw disk I/O is much worse but that's beside the point.

Magtapes can be written with any number of bytes between about
14 and 2K (often up to 64K-1) per record (block).  However, some
brain-damaged operating systems maintain the transfer count
internally as PDP-11 words, instead of bytes.  On such systems,
you can only request an even number of bytes.  I don't know why
you would get an error return instead of having your request
rounded to an even number of bytes.  I am also surprised if 2.8BSD
really still has the old 6th Edition word counts instead of the
7th Edition byte counts.  Look in the sources and see if there
is a b_wcount (or some such name) which would indicate word count
is being used.



More information about the Comp.unix mailing list