Technical data

mtio(7I) Ioctl Requests SunOS 5.5
Fixed-length I/O tape devices write multiple records if the blocking factor is greater than
64,512 bytes (minphys limit). These multiple writes are limited to 64,512 bytes. For
example, if a write request is issued for 65,536 bytes usinga 1/4” cartridge tape, two
writes are issued; the first for 64,512 bytes and the second for 1024 bytes.
Most tape devices which support variable-lengthI/O operations may write a range of 1
to 65,535 bytes. If the record size exceeds 65,535 bytes, the driver writes multiple records
to satisfy the request. These multiple records are limited to 65534 bytes. As an example,
if a write request for 65540 bytes is issued, two records are written; one for 65,534 bytes
followed by another record for 6 byte. Newer variable-length tape drivers may relax the
above limitation and allow applications to write record sizes larger than 65,534. Refer to
the specific tape driver man page for details.
When logicalEOT is encountered, a zero byte count is returned. The next write will com-
plete successfully and the full byte count is returned. Another write will return a zero
byte count. This allows the flushing of buffers. However, it is strongly recommended to
terminate the writing and close the file as soon as possible.
Seeks are ignored in tape I/O.
Close Operation Magnetic tapes are rewound when closed, except when the “no-rewind” devices have
been specified. The names of no-rewind device files use the letter n as the end of the final
component. The no-rewind version of /dev/rmt/0l is /dev/0ln. In case of error for a no-
rewind device, the next open rewinds the device.
If the driver was opened for reading and a no-rewind device has been specified, the close
advances the tape past the next filemark (unless the current file position is at EOM) leav-
ing the tape correctly positioned to read the first record of the next file. However, if the
tape is at the first record of a file it doesn’t advance againto the first record of the next
file. These semantics are different from the older BSD behavior. If BSD behavior is
required where no implicit space operation is executed on close, the non-rewind device
name containing the letter b (for BSD behavior) in the final component should be
specified.
If data was written, a file mark is automatically written by the driver upon close. If the
rewinding device was specified, the tape will be rewound after the file mark is written. If
the user wrote a file mark prior to closing, then no file mark is written upon close. If a file
positioning ioctl, like rewind, is issued after writing, a file mark is written before reposi-
tioning the tape.
All buffers are flushed on closing a tape device. Hence, one should check the value
returned by the close operation.
Note that for 1/2” reel tape devices, two file marks are written to mark the EOM before
rewinding or performing a file positioningioctl. If the user wrote a file mark before clos-
ing a 1/2” reel tape device, the driver will always write a file mark before closing to
insure that the end of recorded media is marked properly. If the non-rewinding device
was specified, two file marks are written and the tape is left positioned between the two
so that the second one is overwritten on a subsequent open(2) and write(2).
7I-218 modified 30 Aug 1995