xref: /original-bsd/usr.sbin/rmt/rmt.8 (revision 27393bdf)
1.\" Copyright (c) 1983, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)rmt.8	8.3 (Berkeley) 06/01/94
7.\"
8.Dd
9.Dt RMT 8
10.Os BSD 4.2
11.Sh NAME
12.Nm rmt
13.Nd remote magtape protocol module
14.Sh SYNOPSIS
15.Nm rmt
16.Sh DESCRIPTION
17.Nm Rmt
18is a program used by the remote dump and restore programs
19in manipulating a magnetic tape drive through an interprocess
20communication connection.
21.Nm Rmt
22is normally started up with an
23.Xr rexec 3
24or
25.Xr rcmd 3
26call.
27.Pp
28The
29.Nm rmt
30program accepts requests specific to the manipulation of
31magnetic tapes, performs the commands, then responds with
32a status indication.  All responses are in
33.Tn ASCII
34and in
35one of two forms.
36Successful commands have responses of:
37.Bd -filled -offset indent
38.Sm off
39.Sy A Ar number No \en
40.Sm on
41.Ed
42.Pp
43.Ar Number
44is an
45.Tn ASCII
46representation of a decimal number.
47Unsuccessful commands are responded to with:
48.Bd -filled -offset indent
49.Sm off
50.Xo Sy E Ar error-number
51.No \en Ar error-message
52.No \en
53.Xc
54.Sm on
55.Ed
56.Pp
57.Ar Error-number
58is one of the possible error
59numbers described in
60.Xr intro 2
61and
62.Ar error-message
63is the corresponding error string as printed
64from a call to
65.Xr perror 3 .
66The protocol is comprised of the
67following commands, which are sent as indicated - no spaces are supplied
68between the command and its arguments, or between its arguments, and
69.Ql \en
70indicates that a newline should be supplied:
71.Bl -tag -width Ds
72.Sm off
73.It Xo Sy \&O Ar device
74.No \en Ar mode No \en
75.Xc
76Open the specified
77.Ar device
78using the indicated
79.Ar mode .
80.Ar Device
81is a full pathname and
82.Ar mode
83is an
84.Tn ASCII
85representation of a decimal
86number suitable for passing to
87.Xr open 2 .
88If a device had already been opened, it is
89closed before a new open is performed.
90.It Xo Sy C Ar device No \en
91.Xc
92Close the currently open device.  The
93.Ar device
94specified is ignored.
95.It Xo Sy L
96.Ar whence No \en
97.Ar offset No \en
98.Xc
99.Sm on
100Perform an
101.Xr lseek 2
102operation using the specified parameters.
103The response value is that returned from the
104.Xr lseek
105call.
106.Sm off
107.It Sy W Ar count No \en
108.Sm on
109Write data onto the open device.
110.Nm Rmt
111reads
112.Ar count
113bytes from the connection, aborting if
114a premature end-of-file is encountered.
115The response value is that returned from
116the
117.Xr write 2
118call.
119.Sm off
120.It Sy R Ar count No \en
121.Sm on
122Read
123.Ar count
124bytes of data from the open device.
125If
126.Ar count
127exceeds the size of the data buffer (10 kilobytes), it is
128truncated to the data buffer size.
129.Nm rmt
130then performs the requested
131.Xr read 2
132and responds with
133.Sm off
134.Sy A Ar count-read No \en
135.Sm on
136if the read was
137successful; otherwise an error in the
138standard format is returned.  If the read
139was successful, the data read is then sent.
140.Sm off
141.It Xo Sy I Ar operation
142.No \en Ar count No \en
143.Xc
144.Sm on
145Perform a
146.Dv MTIOCOP
147.Xr ioctl 2
148command using the specified parameters.
149The parameters are interpreted as the
150.Tn ASCII
151representations of the decimal values
152to place in the
153.Ar mt_op
154and
155.Ar mt_count
156fields of the structure used in the
157.Xr ioctl
158call.  The return value is the
159.Ar count
160parameter when the operation is successful.
161.ne 1i
162.It Sy S
163Return the status of the open device, as
164obtained with a
165.Dv MTIOCGET
166.Xr ioctl
167call.  If the operation was successful,
168an ``ack'' is sent with the size of the
169status buffer, then the status buffer is
170sent (in binary).
171.El
172.Sm on
173.Pp
174Any other command causes
175.Nm rmt
176to exit.
177.Sh DIAGNOSTICS
178All responses are of the form described above.
179.Sh SEE ALSO
180.Xr rcmd 3 ,
181.Xr rexec 3 ,
182.Xr mtio 4 ,
183.Xr rdump 8 ,
184.Xr rrestore 8
185.Sh BUGS
186People should be discouraged from using this for a remote
187file access protocol.
188.Sh HISTORY
189The
190.Nm
191command appeared in
192.Bx 4.2 .
193