Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!ames!pasteur!ucbvax!HUMU.NOSC.MIL!kent From: kent@HUMU.NOSC.MIL (Kent K. Kuriyama) Newsgroups: comp.sys.apollo Subject: Using IOCTL to control mag tape Message-ID: <8901302320.AA10432@humu.nosc.mil> Date: 30 Jan 89 23:20:50 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 57 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 #include #include #include #include #include #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.mil