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