paxutils-forum
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mt.c question.


From: Coelho, Joao
Subject: Mt.c question.
Date: Fri, 7 Nov 2003 14:49:37 -0800

Hello
First, let me say I hope I am sending this request to the right place.  Secondly, if not I apologize. 
I have been working on writing a small program to test the tape drive.  I would like to see if the tape is online offline or busy.  The main program I am modifying came from unixware environment and all it did was to use the open function.  This appears not to be enough under solaris since it will always return a good value for open("/dev/rmt/0",….) unless there is no 0 in the /dev/rmt/ directory.  So I thought of using "mt status" in a popen call - I do this because sometimes we need to check the tape drive on another machine in our small network - then I parse the return strings and actually I just do a line count; if there is only one line returned I noticed that either the tape is busy or there is no tape in the pc.

But I am not too crazy about this and would like to mimick the mt status call.  My first attempt was to use ioctl with MTIOCGET flag and the struct mtget. But this call always returns a value of 0 for the mtget.mt_dsreg member - it does not matter if I have a tape or not tape in the drive; so I thought I must have been doing something wrong. I have searched yahoo, the solarisonintel group, google and hp.  Finally someone at hp forums suggested I use  the gnu mt.c program and showed me the print_status function. It turns out that that function is what I am already using and not working ???.  But I am not sure it is not working or simply that I am using the wrong function because when I look at the mt.c file the print_status function uses the mt_dsreg but that's a digit and I mt status returns strings.  So I am not sure I am in the right place - the mt.c program - for my purpose.  And maybe I am using the incorrect structure. Since you seem the person supporting the paxutils at gnu I thought of asking you about this.

Does the mt status command use the mt.c program to get the status of the tape ?
If not what function in C does one use to get the same result as the mt status command ?
If it does then why is my call to ioctl always returning a 0 to the mtget.mt_dsreg member ?

In mtio.h I saw a struct mt_tape_info and I am wondering if that's how mt.c gets the name of the tape when I do a mt status.  But how does one use this structure and get information into it ? 

I apologize for hunting you down like this and bother you with this problem, but it's now bugging me and so far - for almost a week - nobody has responded to my question.  So I figured you might have if not the answer at least some clues.  Many thanks.


Joao Coelho
Work (916) 324-3371
Cell (916) 708-0777
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]