xref: /freebsd/usr.sbin/rmt/rmt.8 (revision c37420b0d5b3b6ef875fbf0b84a13f6f09be56d6)
1.\" Copyright (c) 1983, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 4. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\"     @(#)rmt.8	8.3 (Berkeley) 6/1/94
29.\" $FreeBSD$
30.\"
31.Dd June 1, 1994
32.Dt RMT 8
33.Os
34.Sh NAME
35.Nm rmt
36.Nd remote magtape protocol module
37.Sh SYNOPSIS
38.Nm
39.Sh DESCRIPTION
40The
41.Nm
42utility is used by the remote dump and restore programs
43in manipulating a magnetic tape drive through an interprocess
44communication connection.
45It is normally started up with an
46.Xr rexec 3
47or
48.Xr rcmd 3
49call.
50.Pp
51The
52.Nm
53utility accepts requests specific to the manipulation of
54magnetic tapes, performs the commands, then responds with
55a status indication.
56All responses are in
57.Tn ASCII
58and in
59one of two forms.
60Successful commands have responses of:
61.Bd -ragged -offset indent
62.Sm off
63.Sy A Ar number No \en
64.Sm on
65.Ed
66.Pp
67.Ar Number
68is an
69.Tn ASCII
70representation of a decimal number.
71Unsuccessful commands are responded to with:
72.Bd -ragged -offset indent
73.Sm off
74.Xo Sy E Ar error-number
75.No \en Ar error-message
76.No \en
77.Xc
78.Sm on
79.Ed
80.Pp
81.Ar Error-number
82is one of the possible error
83numbers described in
84.Xr intro 2
85and
86.Ar error-message
87is the corresponding error string as printed
88from a call to
89.Xr perror 3 .
90The protocol is comprised of the
91following commands, which are sent as indicated - no spaces are supplied
92between the command and its arguments, or between its arguments, and
93.Ql \en
94indicates that a newline should be supplied:
95.Bl -tag -width Ds
96.Sm off
97.It Xo Sy \&O Ar device
98.No \en Ar mode No \en
99.Xc
100.Sm on
101Open the specified
102.Ar device
103using the indicated
104.Ar mode .
105.Ar Device
106is a full pathname and
107.Ar mode
108is an
109.Tn ASCII
110representation of a decimal
111number suitable for passing to
112.Xr open 2 .
113If a device had already been opened, it is
114closed before a new open is performed.
115.Sm off
116.It Xo Sy C Ar device No \en
117.Xc
118.Sm on
119Close the currently open device.
120The
121.Ar device
122specified is ignored.
123.Sm off
124.It Xo Sy L
125.Ar whence No \en
126.Ar offset No \en
127.Xc
128.Sm on
129Perform an
130.Xr lseek 2
131operation using the specified parameters.
132The response value is that returned from the
133.Xr lseek 2
134call.
135.Sm off
136.It Sy W Ar count No \en
137.Sm on
138Write data onto the open device.
139The
140.Nm
141utility reads
142.Ar count
143bytes from the connection, aborting if
144a premature end-of-file is encountered.
145The response value is that returned from
146the
147.Xr write 2
148call.
149.Sm off
150.It Sy R Ar count No \en
151.Sm on
152Read
153.Ar count
154bytes of data from the open device.
155If
156.Ar count
157exceeds the size of the data buffer (10 kilobytes), it is
158truncated to the data buffer size.
159The
160.Nm
161utility then performs the requested
162.Xr read 2
163and responds with
164.Sm off
165.Sy A Ar count-read No \en
166.Sm on
167if the read was
168successful; otherwise an error in the
169standard format is returned.
170If the read
171was successful, the data read is then sent.
172.Sm off
173.It Xo Sy I Ar operation
174.No \en Ar count No \en
175.Xc
176.Sm on
177Perform a
178.Dv MTIOCOP
179.Xr ioctl 2
180command using the specified parameters.
181The parameters are interpreted as the
182.Tn ASCII
183representations of the decimal values
184to place in the
185.Ar mt_op
186and
187.Ar mt_count
188fields of the structure used in the
189.Xr ioctl 2
190call.
191The return value is the
192.Ar count
193parameter when the operation is successful.
194.It Sy S
195Return the status of the open device, as
196obtained with a
197.Dv MTIOCGET
198.Xr ioctl 2
199call.
200If the operation was successful,
201an ``ack'' is sent with the size of the
202status buffer, then the status buffer is
203sent (in binary).
204.El
205.Pp
206Any other command causes
207.Nm
208to exit.
209.Sh DIAGNOSTICS
210All responses are of the form described above.
211.Sh SEE ALSO
212.Xr rcmd 3 ,
213.Xr rexec 3 ,
214.Xr mtio 4 ,
215.Xr rdump 8 ,
216.Xr rrestore 8
217.Sh BUGS
218People should be discouraged from using this for a remote
219file access protocol.
220.Sh HISTORY
221The
222.Nm
223utility appeared in
224.Bx 4.2 .
225