Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: Calyx UK Development <calyxdev@dial.pipex.com>
Subject: Dec Device Interigation Problem
Date: 1997/10/01	[thread overview]
Message-ID: <iz4lYCABeiM0Ewuc@dial.pipex.com> (raw)



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 <stdio.h>
#include <unistd.h>
#include <sys/mtio.h>
#include <sys/ioctl.h>
#include <sys/devio.h>
#include <sys/ioctl_compat.h>
#include <stdlib.h>
#include <string.h>

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



                 reply	other threads:[~1997-10-01  4:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox