1*71c04358Shalex.\" $OpenBSD: rmt.8,v 1.13 2015/09/20 10:05:48 halex Exp $ 2cdbdb68aSaaron.\" 3df930be7Sderaadt.\" Copyright (c) 1983, 1991 The Regents of the University of California. 4df930be7Sderaadt.\" All rights reserved. 5df930be7Sderaadt.\" 6df930be7Sderaadt.\" Redistribution and use in source and binary forms, with or without 7df930be7Sderaadt.\" modification, are permitted provided that the following conditions 8df930be7Sderaadt.\" are met: 9df930be7Sderaadt.\" 1. Redistributions of source code must retain the above copyright 10df930be7Sderaadt.\" notice, this list of conditions and the following disclaimer. 11df930be7Sderaadt.\" 2. Redistributions in binary form must reproduce the above copyright 12df930be7Sderaadt.\" notice, this list of conditions and the following disclaimer in the 13df930be7Sderaadt.\" documentation and/or other materials provided with the distribution. 1429295d1cSmillert.\" 3. Neither the name of the University nor the names of its contributors 15df930be7Sderaadt.\" may be used to endorse or promote products derived from this software 16df930be7Sderaadt.\" without specific prior written permission. 17df930be7Sderaadt.\" 18df930be7Sderaadt.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19df930be7Sderaadt.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20df930be7Sderaadt.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21df930be7Sderaadt.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22df930be7Sderaadt.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23df930be7Sderaadt.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24df930be7Sderaadt.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25df930be7Sderaadt.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26df930be7Sderaadt.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27df930be7Sderaadt.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28df930be7Sderaadt.\" SUCH DAMAGE. 29df930be7Sderaadt.\" 30df930be7Sderaadt.\" from: @(#)rmt.8 6.5 (Berkeley) 3/16/91 31df930be7Sderaadt.\" 32*71c04358Shalex.Dd $Mdocdate: September 20 2015 $ 33df930be7Sderaadt.Dt RMT 8 34fc8533a3Saaron.Os 35df930be7Sderaadt.Sh NAME 36df930be7Sderaadt.Nm rmt 37df930be7Sderaadt.Nd remote magtape protocol module 38df930be7Sderaadt.Sh SYNOPSIS 39*71c04358Shalex.Nm 40*71c04358Shalex.Op Fl r | w 41*71c04358Shalex.Op Fl d Ar directory 42df930be7Sderaadt.Sh DESCRIPTION 431c499c0bSaaron.Nm 44df930be7Sderaadtis a program used by the remote dump and restore programs 45*71c04358Shalexthrough an interprocess communication connection. 46*71c04358ShalexTraditionally it is used for manipulating a magnetic tape drive but it may 47*71c04358Shalexbe used for regular file access as well. 481c499c0bSaaron.Nm 49df930be7Sderaadtis normally started up with an 50df930be7Sderaadt.Xr rcmd 3 5106885c07Smillertor 5206885c07Smillert.Xr rcmdsh 3 53df930be7Sderaadtcall. 54df930be7Sderaadt.Pp 55*71c04358ShalexThe options are as follows: 56*71c04358Shalex.Bl -tag -width Ds 57*71c04358Shalex.It Fl d Ar directory 58*71c04358ShalexConfine file access to 59*71c04358Shalex.Ar directory . 60*71c04358ShalexForward slashes in filenames are disallowed and symlinks are not followed. 61*71c04358Shalex.It Fl r 62*71c04358ShalexRead-only mode, suitable for use with 63*71c04358Shalex.Xr rrestore 8 . 64*71c04358Shalex.It Fl w 65*71c04358ShalexFile write mode, suitable for use with 66*71c04358Shalex.Xr rdump 8 67*71c04358Shalexfor dumping to regular files. 68*71c04358ShalexCreates missing files and refuses to open existing ones. 69*71c04358ShalexThe file permission bits are set to readonly. 70*71c04358Shalex.El 71*71c04358Shalex.Pp 72df930be7SderaadtThe 731c499c0bSaaron.Nm 74df930be7Sderaadtprogram accepts requests specific to the manipulation of 75df930be7Sderaadtmagnetic tapes, performs the commands, then responds with 76cdbdb68aSaarona status indication. 7750100c6fSschwarzeAll responses are in ASCII and in one of two forms. 78df930be7SderaadtSuccessful commands have responses of: 7950100c6fSschwarze.Pp 8050100c6fSschwarze.D1 Sy A Ns Ar number Ns \en 81df930be7Sderaadt.Pp 821c499c0bSaaron.Ar number 8350100c6fSschwarzeis an ASCII representation of a decimal number. 84df930be7SderaadtUnsuccessful commands are responded to with: 85df930be7Sderaadt.Bd -filled -offset indent 86df930be7Sderaadt.Sm off 8750100c6fSschwarze.Sy E Ar error-number No \en Ar error-message No \en 88df930be7Sderaadt.Sm on 89df930be7Sderaadt.Ed 90df930be7Sderaadt.Pp 911c499c0bSaaron.Ar error-number 92df930be7Sderaadtis one of the possible error 93df930be7Sderaadtnumbers described in 94df930be7Sderaadt.Xr intro 2 95df930be7Sderaadtand 96df930be7Sderaadt.Ar error-message 97df930be7Sderaadtis the corresponding error string as printed 98df930be7Sderaadtfrom a call to 99df930be7Sderaadt.Xr perror 3 . 100df930be7SderaadtThe protocol is comprised of the 101df930be7Sderaadtfollowing commands, which are sent as indicated - no spaces are supplied 102df930be7Sderaadtbetween the command and its arguments, or between its arguments, and 103df930be7Sderaadt.Ql \en 104df930be7Sderaadtindicates that a newline should be supplied: 105df930be7Sderaadt.Bl -tag -width Ds 106df930be7Sderaadt.Sm off 10750100c6fSschwarze.It Xo Ic \&O Ar device 108df930be7Sderaadt.No \en Ar mode No \en 109df930be7Sderaadt.Xc 11050100c6fSschwarze.Sm on 111df930be7SderaadtOpen the specified 112df930be7Sderaadt.Ar device 113df930be7Sderaadtusing the indicated 114df930be7Sderaadt.Ar mode . 1151c499c0bSaaron.Ar device 116df930be7Sderaadtis a full pathname and 117df930be7Sderaadt.Ar mode 11850100c6fSschwarzeis an ASCII representation of a decimal 119df930be7Sderaadtnumber suitable for passing to 120df930be7Sderaadt.Xr open 2 . 121df930be7SderaadtIf a device had already been opened, it is 122df930be7Sderaadtclosed before a new open is performed. 12350100c6fSschwarze.It Ic C Ns Ar device Ns \en 124cdbdb68aSaaronClose the currently open device. 125cdbdb68aSaaronThe 126df930be7Sderaadt.Ar device 127df930be7Sderaadtspecified is ignored. 12850100c6fSschwarze.Sm off 12950100c6fSschwarze.It Xo Ic L 130df930be7Sderaadt.Ar offset No \en 131499bee7dSderaadt.Ar whence No \en 132df930be7Sderaadt.Xc 133df930be7Sderaadt.Sm on 134df930be7SderaadtPerform an 135df930be7Sderaadt.Xr lseek 2 136df930be7Sderaadtoperation using the specified parameters. 137df930be7SderaadtThe response value is that returned from the 13850100c6fSschwarze.Xr lseek 2 139df930be7Sderaadtcall. 14050100c6fSschwarze.It Ic W Ns Ar count Ns \en 141df930be7SderaadtWrite data onto the open device. 1421c499c0bSaaron.Nm 143df930be7Sderaadtreads 144df930be7Sderaadt.Ar count 145df930be7Sderaadtbytes from the connection, aborting if 146df930be7Sderaadta premature end-of-file is encountered. 147df930be7SderaadtThe response value is that returned from 148df930be7Sderaadtthe 149df930be7Sderaadt.Xr write 2 150df930be7Sderaadtcall. 15150100c6fSschwarze.It Ic R Ns Ar count Ns \en 152df930be7SderaadtRead 153df930be7Sderaadt.Ar count 154df930be7Sderaadtbytes of data from the open device. 155df930be7SderaadtIf 156df930be7Sderaadt.Ar count 157df930be7Sderaadtexceeds the size of the data buffer (10 kilobytes), it is 158df930be7Sderaadttruncated to the data buffer size. 1591c499c0bSaaron.Nm 160df930be7Sderaadtthen performs the requested 161df930be7Sderaadt.Xr read 2 162df930be7Sderaadtand responds with 16350100c6fSschwarze.Sy A Ns Ar count-read Ns \en 164df930be7Sderaadtif the read was 165df930be7Sderaadtsuccessful; otherwise an error in the 166cdbdb68aSaaronstandard format is returned. 167cdbdb68aSaaronIf the read was successful, the data read is then sent. 168df930be7Sderaadt.Sm off 16950100c6fSschwarze.It Xo Ic I Ar operation 170df930be7Sderaadt.No \en Ar count No \en 171df930be7Sderaadt.Xc 172df930be7Sderaadt.Sm on 1731c499c0bSaaronPerform an 174df930be7Sderaadt.Dv MTIOCOP 175df930be7Sderaadt.Xr ioctl 2 176df930be7Sderaadtcommand using the specified parameters. 177df930be7SderaadtThe parameters are interpreted as the 17850100c6fSschwarzeASCII representations of the decimal values 179df930be7Sderaadtto place in the 180df930be7Sderaadt.Ar mt_op 181df930be7Sderaadtand 182df930be7Sderaadt.Ar mt_count 183df930be7Sderaadtfields of the structure used in the 18450100c6fSschwarze.Xr ioctl 2 185cdbdb68aSaaroncall. 186cdbdb68aSaaronThe return value is the 187df930be7Sderaadt.Ar count 188df930be7Sderaadtparameter when the operation is successful. 18950100c6fSschwarze.It Ic S 190df930be7SderaadtReturn the status of the open device, as 191df930be7Sderaadtobtained with a 192df930be7Sderaadt.Dv MTIOCGET 1939d0b46bcSjmc.Xr ioctl 2 194cdbdb68aSaaroncall. 195cdbdb68aSaaronIf the operation was successful, an 196cdbdb68aSaaron.Dq ack 197cdbdb68aSaaronis sent with the size of the status buffer, then the status buffer is 198df930be7Sderaadtsent (in binary). 199df930be7Sderaadt.El 200df930be7Sderaadt.Pp 201df930be7SderaadtAny other command causes 2021c499c0bSaaron.Nm 203df930be7Sderaadtto exit. 204df930be7Sderaadt.Sh DIAGNOSTICS 205df930be7SderaadtAll responses are of the form described above. 206df930be7Sderaadt.Sh SEE ALSO 207df930be7Sderaadt.Xr rcmd 3 , 20806885c07Smillert.Xr rcmdsh 3 , 209df930be7Sderaadt.Xr mtio 4 , 210df930be7Sderaadt.Xr rdump 8 , 211df930be7Sderaadt.Xr rrestore 8 212df930be7Sderaadt.Sh HISTORY 213df930be7SderaadtThe 214df930be7Sderaadt.Nm 215df930be7Sderaadtcommand appeared in 216df930be7Sderaadt.Bx 4.2 . 2179d0b46bcSjmc.Sh BUGS 2189d0b46bcSjmcPeople tempted to use this for a remote file access protocol 2199d0b46bcSjmcare discouraged. 220