kent@HUMU.NOSC.MIL (Kent K. Kuriyama) (01/31/89)
I am porting a program that manipulates (e.g. rewinds) the mag
tape unit. It issues an IOCTL call to do this.
------------
/* File: test.c */
#include <stdio.h>
#include <ctype.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/mtio.h>
#include <sys/file.h>
#define tapefile "/dev/rmt12"
main(argc, argv)
int argc;
char *argv[];
{
int fd, i;
struct mtop op;
/* open the tape file, this seems to work */
fd = open(tapefile, O_RDONLY);
if (fd < 0) {
perror(tapefile);
exit(1);
}
/* rewind the tape, call to IOCTL fails */
op.mt_op = MTREW;
op.mt_count = 1;
i = ioctl(fd, MTIOCTOP, &op);
if (i < 0) {
perror(tapefile);
exit(1);
}
exit(0);
}
------------
% cc test.c
% a.out
/dev/rmt12: Not a typewriter
At run time the IOCTL call fails and I get the above message. I
am running Domain IX under SR9.7.1. Could someone tell me what I
am doing wrong?
Thanks.
Kent Kuriyama
Naval Ocean Systems Center
Hawaii Laboratory
kent@nosc.milkrowitz@RICHTER.MIT.EDU (David Krowitz) (01/31/89)
You are not doing anything wrong. SR9.7.x does not fully support the IOCTL call for magtapes. I've sent in an APR on this a while back. Can anyone who has SR10.0 or SR10.1 up and running check if IOCTL is now fully implemented? -- David Krowitz krowitz@richter.mit.edu (18.83.0.109) krowitz%richter@eddie.mit.edu krowitz%richter@athena.mit.edu krowitz%richter.mit.edu@mitvma.bitnet (in order of decreasing preference)