From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,ce97279d754b4b,start X-Google-Attributes: gid1164f8,public From: Calyx UK Development Subject: Dec Device Interigation Problem Date: 1997/10/01 Message-ID: #1/1 X-Deja-AN: 277023934 Distribution: world X-Complaints-To: news@plug.news.pipex.net X-Trace: plug.news.pipex.net 875710757 14803 (None) 193.130.253.248 Organization: Calyx UK Newsgroups: comp.sys.dec I am having a few problems accessing a Digital TSZ07 tape drive connected to an AlphaServer 1000 running DEC UNIX 4.0. It is being accessed using low UNIX system calls i.e. open, close and ioctl. A simple example would be :- #include #include #include #include #include #include #include #include int main ( int argc , char **argv ) { char deviceId[256] , errStr[256]; int deviceFd; int result , error; struct mtop tapeCmd; strcpy( deviceId , "/dev/rmt1h" ); deviceFd = open( deviceId , O_RDWR | O_SYNC , 0666 ); if ( deviceFd < 0 ) { printf( "Failed to open tape device : %s\n", deviceId ); error = errno; printf( "TapeIo Error - errno : %d : %s\n", error, strerror(error)); return (-1); } printf( "Getting Tape drive status :-\n\n"); result = ioctl (deviceId , DEVIOCGET , &tapeStatus); if ( result == -1 ) { error = errno; printf ("TapeIo Error - errno : %d : %s\n", error, strerror(error)); } else { printf( "Status is %ld \n" , tapeStatus.stat ); } close ( deviceFd ); return (1); } This program works fine provided that the tape drive is online, but if the tape drive is offline the program fails on the open statement, which is not much use if you wish to obtain the current status of the tape drive from within a program. If an 'mt' command is issued e.g. mt -f /dev/rmt1h status this will actually return with information telling you that the tape drive is offline. Can anyone explain what is happening here. MTIA Tim -- Calyx UK Development