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