The
rmtops library provides a simple means of transparently accessing tape drives on remote machines via
rsh(1) and
rmt(8). These routines are used like their corresponding system calls, but allow the user to open up a tape drive on a remote system on which he or she has an account and the appropriate remote permissions.
A remote tape drive file name has the form
[user@]hostname:/dev/???
where
system is the remote system,
/dev/??? is the particular drive on the remote system (raw, blocked, rewinding, non-rewinding, etc.), and the optional
user is the login name to be used on the remote system, if different from the current user's login name.
For transparency, the user should include the file
<rmt.h>, which has the following defines in it:
#define access rmtaccess
#define close rmtclose
#define creat rmtcreat
#define dup rmtdup
#define fcntl rmtfcntl
#define fstat rmtfstat
#define ioctl rmtioctl
#define isatty rmtisatty
#define lseek rmtlseek
#define lstat rmtlstat
#define open rmtopen
#define read rmtread
#define stat rmtstat
#define write rmtwrite
This allows the programmer to use
open(2),
close(2),
read(2),
write(2), etc. in their normal fashion, with the
rmtops routines taking care of differentiating between local and remote files. This file should be included
before including the file
<sys/stat.h>, since it redefines the identifier ``stat'' which is used to declare objects of type
struct stat.
The routines differentiate between local and remote file descriptors by adding a bias (currently 128) to the file descriptor of the pipe. The programmer, if he or she must know if a file is remote, should use
isrmt().