1.\" $OpenBSD: rmt.8,v 1.10 2003/06/12 12:59:52 jmc Exp $ 2.\" 3.\" Copyright (c) 1983, 1991 The Regents of the University of California. 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" from: @(#)rmt.8 6.5 (Berkeley) 3/16/91 31.\" $Id: rmt.8,v 1.10 2003/06/12 12:59:52 jmc Exp $ 32.\" 33.Dd March 16, 1991 34.Dt RMT 8 35.Os 36.Sh NAME 37.Nm rmt 38.Nd remote magtape protocol module 39.Sh SYNOPSIS 40.Nm rmt 41.Sh DESCRIPTION 42.Nm 43is a program used by the remote dump and restore programs 44in manipulating a magnetic tape drive through an interprocess 45communication connection. 46.Nm 47is normally started up with an 48.Xr rcmd 3 49or 50.Xr rcmdsh 3 51call. 52.Pp 53The 54.Nm 55program accepts requests specific to the manipulation of 56magnetic tapes, performs the commands, then responds with 57a status indication. 58All responses are in 59.Tn ASCII 60and in 61one of two forms. 62Successful commands have responses of: 63.Bd -filled -offset indent 64.Sm off 65.Sy A Ar number No \en 66.Sm on 67.Ed 68.Pp 69.Ar number 70is an 71.Tn ASCII 72representation of a decimal number. 73Unsuccessful commands are responded to with: 74.Bd -filled -offset indent 75.Sm off 76.Xo Sy E Ar error-number 77.No \en Ar error-message 78.No \en 79.Xc 80.Sm on 81.Ed 82.Pp 83.Ar error-number 84is one of the possible error 85numbers described in 86.Xr intro 2 87and 88.Ar error-message 89is the corresponding error string as printed 90from a call to 91.Xr perror 3 . 92The protocol is comprised of the 93following commands, which are sent as indicated - no spaces are supplied 94between the command and its arguments, or between its arguments, and 95.Ql \en 96indicates that a newline should be supplied: 97.Bl -tag -width Ds 98.Sm off 99.It Xo Sy \&O Ar device 100.No \en Ar mode No \en 101.Xc 102Open the specified 103.Ar device 104using the indicated 105.Ar mode . 106.Ar device 107is a full pathname and 108.Ar mode 109is an 110.Tn ASCII 111representation of a decimal 112number suitable for passing to 113.Xr open 2 . 114If a device had already been opened, it is 115closed before a new open is performed. 116.It Xo Sy C Ar device No \en 117.Xc 118Close the currently open device. 119The 120.Ar device 121specified is ignored. 122.It Xo Sy L 123.Ar offset No \en 124.Ar whence 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 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 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. 166If the read was 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 an 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.Fn ioctl 185call. 186The return value is the 187.Ar count 188parameter when the operation is successful. 189.It Sy S 190Return the status of the open device, as 191obtained with a 192.Dv MTIOCGET 193.Xr ioctl 2 194call. 195If the operation was successful, an 196.Dq ack 197is sent with the size of the status buffer, then the status buffer is 198sent (in binary). 199.El 200.Sm on 201.Pp 202Any other command causes 203.Nm 204to exit. 205.Sh DIAGNOSTICS 206All responses are of the form described above. 207.Sh SEE ALSO 208.Xr rcmd 3 , 209.Xr rcmdsh 3 , 210.Xr mtio 4 , 211.Xr rdump 8 , 212.Xr rrestore 8 213.Sh HISTORY 214The 215.Nm 216command appeared in 217.Bx 4.2 . 218.Sh BUGS 219People tempted to use this for a remote file access protocol 220are discouraged. 221