rmtops.3 revision 1.1 1 ...
2 ... $Header: /tank/opengrok/rsync2/NetBSD/src/lib/librmt/rmtops.3,v 1.1 1996/08/09 03:35:20 jtc Exp $
3 ...
4 ... $Log: rmtops.3,v $
5 ... Revision 1.1 1996/08/09 03:35:20 jtc
6 ... Remote mag tape library from volume 18 of comp.sources.unix.
7 ...
8 ... Revision 1.4 88/10/25 17:05:05 root
9 ... Documented configuration options and added Dan Kegel to AUTHORS. ADR.
10 ...
11 ... Revision 1.3 87/10/30 10:36:38 root
12 ... Some cleanup. 4.3 syntax is default, 4.2 is a compile time option.
13 ...
14 ... Revision 1.2 86/10/09 16:38:02 root
15 ... Changed to reflect 4.3BSD rcp syntax and better rmt(8) capabilities. ADR.
16 ...
17 ... Revision 1.1 86/10/09 16:18:47 root
18 ... Initial revision
19 ...
20 ...
21 .TH RMTOPS 3 local
22 .SH NAME
23 rmtops \- access tape drives on remote machines
24 .SH SYNOPSIS
25 .nf
26 .ft B
27 #include <rmt.h>
28 #include <sys/stat.h> /* MUST come after <rmt.h> */
29
30 int isrmt (fd)
31 int fd;
32
33 int rmtaccess (file, mode)
34 char *file;
35 int mode;
36
37 int rmtclose (fd)
38 int fd;
39
40 int rmtcreat (file, mode)
41 char *file;
42 int mode;
43
44 int rmtdup (fd)
45 int fd;
46
47 int rmtfcntl (fd, cmd, arg)
48 int fd, cmd, arg;
49
50 int rmtfstat (fd, buf)
51 int fd;
52 struct stat *buf;
53
54 int rmtioctl (fd, request, argp)
55 int fd, request;
56 char *argp;
57
58 int rmtisatty (fd)
59 int fd;
60
61 long rmtlseek (fd, offset, whence)
62 int fd, whence;
63 long offset;
64
65 int rmtlstat (file, buf)
66 char *file;
67 struct stat *buf;
68
69 int rmtopen (file, flags [, mode])
70 char *file;
71 int flags, mode;
72
73 int rmtread (fd, buf, nbytes)
74 int fd, nbytes;
75 char *buf;
76
77 int rmtstat (file, buf)
78 char *file;
79 struct stat *buf;
80
81 int rmtwrite (fd, buf, nbytes)
82 int fd, nbytes;
83 char *buf;
84 .fi
85 .ft R
86 .SH DESCRIPTION
87 .I Rmtops
88 provides a simple means of transparently accessing tape drives
89 on remote machines over the ethernet, via
90 .IR rsh (1)
91 and
92 .IR rmt (8).
93 These routines are used like their corresponding
94 system calls, but allow the user to open up a tape drive on a remote
95 system on which he or she has an account and the appropriate remote
96 permissions.
97 .PP
98 A remote tape drive file name has the form
99 .sp
100 .RS
101 .RI [ user @] system :/dev/???
102 .RE
103 .sp
104 where
105 .I system
106 is the remote system,
107 .I /dev/???
108 is the particular drive on the remote system (raw, blocked, rewinding,
109 non-rewinding, etc.), and the optional
110 .I user
111 is the login name to be used on the remote system, if different from
112 the current user's login name.
113 .PP
114 The library source code may be optionally compiled to recognize the
115 old, 4.2 BSD, remote syntax
116 .sp
117 .RS
118 .IR system [. user ]:/dev/???
119 .RE
120 .sp
121 By default, only the first form (introduced in 4.3 BSD) is recognized.
122 .PP
123 For transparency, the user should include the file
124 .IR <rmt.h> ,
125 which has the following defines in it:
126 .PP
127 .nf
128 #define access rmtaccess
129 #define close rmtclose
130 #define creat rmtcreat
131 #define dup rmtdup
132 #define fcntl rmtfcntl
133 #define fstat rmtfstat
134 #define ioctl rmtioctl
135 #define isatty rmtisatty
136 #define lseek rmtlseek
137 #define lstat rmtlstat
138 #define open rmtopen
139 #define read rmtread
140 #define stat rmtstat
141 #define write rmtwrite
142 .fi
143 .PP
144 This allows the programmer to use
145 .IR open ,
146 .IR close ,
147 .IR read ,
148 .IR write ,
149 etc. in their normal fashion, with the
150 .I rmtops
151 routines taking care of differentiating between local and remote files.
152 This file should be included
153 .I before
154 including the file
155 .IR <sys/stat.h> ,
156 since it redefines the identifier ``stat,'' which is used to declare
157 objects of type
158 .BR "struct stat" .
159 .PP
160 The routines differentiate between local and remote file descriptors by
161 adding a bias (currently 128) to the file descriptor of the pipe.
162 The programmer, if he or she must know if a file is remote, should use the
163 .I isrmt
164 function.
165 .SH FILES
166 .TP
167 .B /usr/lib/librmt.a
168 Contains the remote tape library. To include the library with a program,
169 add the flag
170 .B \-lrmt
171 to the
172 .IR cc (1)
173 command line.
174 .SH SEE ALSO
175 .IR rcp (1),
176 .IR rsh (1),
177 .IR rmt (8),
178 and the appropriate system calls in section 2.
179 .SH DIAGNOSTICS
180 Several of these routines will return \-1 and set
181 .I errno
182 to EOPNOTSUPP, if they are given a remote file name or a file descriptor
183 on an open remote file (e.g.,
184 .IR rmtdup ).
185 .SH BUGS
186 See \s-1DIAGNOSTICS\s+1 above. It is to be hoped that true remote file systems
187 will eventually appear, and eliminate the need for these routines.
188 .PP
189 There is no way to use remote tape drives with the
190 .IR stdio (3)
191 package, short of recompiling it entirely to use these routines.
192 .PP
193 The
194 .IR rmt (8)
195 protocol is not very capable. In particular, it relies on
196 TCP/IP sockets for error free transmission, and does no data validation
197 of its own.
198 .SH CONFIGURATION OPTIONS
199 The library may be compiled to allow the use of 4.2 BSD style remote
200 file names. This is not recommended.
201 .PP
202 By default, the library opens two pipes to
203 .IR rsh (1).
204 It may optionally be compiled to use
205 .IR rexec (3),
206 instead. Doing so requires the use of a
207 .I .netrc
208 file in the user's home directory, or that the application designer
209 be willing to have
210 .I rexec
211 prompt the user for a login name and password on the remote host.
212 .SH AUTHORS
213 Jeff Lee (gatech!jeff) wrote the original routines for accessing
214 tape drives via
215 .IR rmt (8).
216 .PP
217 Fred Fish (unisoft!fnf) redid them into a general purpose library.
218 .PP
219 Arnold Robbins
220 (formerly gatech!arnold, now emory!arnold)
221 added the ability to specify a user
222 name on the remote system, the
223 .B <rmt.h>
224 include file, this man page,
225 cleaned up the library a little,
226 and made the appropriate changes for 4.3 BSD.
227 .PP
228 Dan Kegel (srs!dan) contributed the code to use
229 .IR rexec (3)
230 library routine.
231