🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sun
Article #8232

using ioctl in C to call tape drive

#8232
From: Joao Lin Yun
Date: Tue, 04 Jun 1991 18:40
38 lines
1940 bytes
We have been having troubles getting this posted.  If it gets through,
please reply via e-mail to Joao (yun@bu-ast.bu.edu) as he is not a regular
news reader.  Thanks.  David.
-----

I've been trying to talk to a Xylogics tape drive through a C program including
the command "ioctl". For a reason unknown to me this does not work. I keep
getting the error message: "Inappropriate ioctl for device"
Here is the relevant piece of code that I'm using:

   struct mtop op;

         *fd = open("/dev/nrmt0", O_RDWR);

      op.mt_op = MTREW;
      *status = ioctl(*fd, MTIOCTOP, &op);
      if (*status < 0) {
         perror("mtio:");
         return;

The "open" command is successful (it returns a value of fd=8) but after that
any magtape opeartion that I try to do using "ioctl" gives an error:

	"mtio: Inappropriate ioctl for device"


The poeople from whom I got the code guarantee me that the code is working fine
with their SCSI tape drive (with /dev/nrst8 instead of /dev/nrmt0). After 
trying everything that seemed likely to be the problem, I have no idea of why 
it doesn't work. Can someone help finding the problem and a its solution?
Thanks!


--
David Bradford                          Internet: bradford@bu-ast.bu.edu
Systems Manager                         BITnet:   bradford@buasta
Astronomy Department                    SPAN:     buasta::bradford
Boston University                       Phone:    (617)353-4884
Technical Details
Message-ID: <3373@brchh104.bnr.ca>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request
From: yun@bu-ast.bu.edu (Joao Lin Yun)
Newsgroups: comp.sys.sun
Subject: using ioctl in C to call tape drive
Keywords: No Digest Subjects in Unmoderated Mode
Message-ID: <3373@brchh104.bnr.ca>
Date: 4 Jun 91 18:40:00 GMT
Sender: news@brchh104.bnr.ca
Organization: Sunspots, Psuedo-Unmoderated
Lines: 39
Approved: sun-spots@rice.edu
X-Original-Date:    17 May 91 13:55:49 GMT