1.\" $NetBSD: rmt.8,v 1.14 2009/03/11 18:23:38 joerg 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. 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.\" @(#)rmt.8 8.3 (Berkeley) 6/1/94 31.\" 32.Dd June 1, 1994 33.Dt RMT 8 34.Os 35.Sh NAME 36.Nm rmt 37.Nd remote magtape protocol module 38.Sh SYNOPSIS 39.Nm 40.Sh DESCRIPTION 41.Nm 42is a program used by the remote dump and restore programs 43in manipulating a magnetic tape drive through an interprocess 44communication connection. 45.Nm 46is normally started up with an 47.Xr rexec 3 48or 49.Xr rcmd 3 50call. 51.Pp 52The 53.Nm 54program accepts requests specific to the manipulation of 55magnetic tapes, performs the commands, then responds with 56a status indication. All responses are in 57.Tn ASCII 58and in 59one of two forms. 60Successful commands have responses of: 61.Bd -filled -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 -filled -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 comprises 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.It Sy \&O Ns Ar device Ns \en Ns Ar mode Ns \en 97Open the specified 98.Ar device 99using the indicated 100.Ar mode . 101.Ar Device 102is a full pathname and 103.Ar mode 104is an 105.Tn ASCII 106representation of a decimal 107number suitable for passing to 108.Xr open 2 . 109If a device had already been opened, it is 110closed before a new open is performed. 111.It Sy C Ns Ar device Ns \en 112Close the currently open device. The 113.Ar device 114specified is ignored. 115.It Sy L Ns Ar offset Ns \en Ns Ar whence Ns \en 116Perform an 117.Xr lseek 2 118operation using the specified parameters. 119The response value is that returned from the 120.Xr lseek 2 121call. 122.Sm off 123.It Sy W Ar count No \en 124.Sm on 125Write data onto the open device. 126.Nm 127reads 128.Ar count 129bytes from the connection, aborting if 130a premature end-of-file is encountered. 131The response value is that returned from 132the 133.Xr write 2 134call. 135.Sm off 136.It Sy R Ar count No \en 137.Sm on 138Read 139.Ar count 140bytes of data from the open device. 141If 142.Ar count 143exceeds the size of the data buffer (10 kilobytes), it is 144truncated to the data buffer size. 145.Nm 146then performs the requested 147.Xr read 2 148and responds with 149.Sm off 150.Sy A Ar count-read No \en 151.Sm on 152if the read was 153successful; otherwise an error in the 154standard format is returned. If the read 155was successful, the data read is then sent. 156.It Sy I Ns Ar operation Ns \en Ns Ar count Ns \en 157.Sm on 158Perform a 159.Dv MTIOCOP 160.Xr ioctl 2 161command using the specified parameters. 162The parameters are interpreted as the 163.Tn ASCII 164representations of the decimal values 165to place in the 166.Ar mt_op 167and 168.Ar mt_count 169fields of the structure used in the 170.Xr ioctl 2 171call. The return value is the 172.Ar count 173parameter when the operation is successful. 174.It Sy S 175Return the status of the open device, as 176obtained with a 177.Dv MTIOCGET 178.Xr ioctl 2 179call. If the operation was successful, 180an ``ack'' is sent with the size of the 181status buffer, then the status buffer is 182sent (in binary). 183.El 184.Pp 185Any other command causes 186.Nm 187to exit. 188.Sh DIAGNOSTICS 189All responses are of the form described above. 190.Sh SEE ALSO 191.Xr rcmd 3 , 192.Xr rexec 3 , 193.Xr mtio 4 , 194.Xr rdump 8 , 195.Xr rrestore 8 196.Sh HISTORY 197The 198.Nm 199command appeared in 200.Bx 4.2 . 201.Sh BUGS 202People should be discouraged from using this for a remote 203file access protocol. 204