| 1 | .\" Copyright (c) 1983, 1991 The Regents of the University of California. |
| 2 | .\" All rights reserved. |
| 3 | .\" |
| 4 | .\" %sccs.include.redist.man% |
| 5 | .\" |
| 6 | .\" @(#)rmt.8 6.5 (Berkeley) %G% |
| 7 | .\" |
| 8 | .Dd |
| 9 | .Dt RMT 8 |
| 10 | .Os BSD 4.2 |
| 11 | .Sh NAME |
| 12 | .Nm rmt |
| 13 | .Nd remote magtape protocol module |
| 14 | .Sh SYNOPSIS |
| 15 | .Nm rmt |
| 16 | .Sh DESCRIPTION |
| 17 | .Nm Rmt |
| 18 | is a program used by the remote dump and restore programs |
| 19 | in manipulating a magnetic tape drive through an interprocess |
| 20 | communication connection. |
| 21 | .Nm Rmt |
| 22 | is normally started up with an |
| 23 | .Xr rexec 3 |
| 24 | or |
| 25 | .Xr rcmd 3 |
| 26 | call. |
| 27 | .Pp |
| 28 | The |
| 29 | .Nm rmt |
| 30 | program accepts requests specific to the manipulation of |
| 31 | magnetic tapes, performs the commands, then responds with |
| 32 | a status indication. All responses are in |
| 33 | .Tn ASCII |
| 34 | and in |
| 35 | one of two forms. |
| 36 | Successful commands have responses of: |
| 37 | .Bd -filled -offset indent |
| 38 | .Sm off |
| 39 | .Sy A Ar number No \en |
| 40 | .Sm on |
| 41 | .Ed |
| 42 | .Pp |
| 43 | .Ar Number |
| 44 | is an |
| 45 | .Tn ASCII |
| 46 | representation of a decimal number. |
| 47 | Unsuccessful commands are responded to with: |
| 48 | .Bd -filled -offset indent |
| 49 | .Sm off |
| 50 | .Xo Sy E Ar error-number |
| 51 | .No \en Ar error-message |
| 52 | .No \en |
| 53 | .Xc |
| 54 | .Sm on |
| 55 | .Ed |
| 56 | .Pp |
| 57 | .Ar Error-number |
| 58 | is one of the possible error |
| 59 | numbers described in |
| 60 | .Xr intro 2 |
| 61 | and |
| 62 | .Ar error-message |
| 63 | is the corresponding error string as printed |
| 64 | from a call to |
| 65 | .Xr perror 3 . |
| 66 | The protocol is comprised of the |
| 67 | following commands, which are sent as indicated - no spaces are supplied |
| 68 | between the command and its arguments, or between its arguments, and |
| 69 | .Ql \en |
| 70 | indicates that a newline should be supplied: |
| 71 | .Bl -tag -width Ds |
| 72 | .Sm off |
| 73 | .It Xo Sy \&O Ar device |
| 74 | .No \en Ar mode No \en |
| 75 | .Xc |
| 76 | Open the specified |
| 77 | .Ar device |
| 78 | using the indicated |
| 79 | .Ar mode . |
| 80 | .Ar Device |
| 81 | is a full pathname and |
| 82 | .Ar mode |
| 83 | is an |
| 84 | .Tn ASCII |
| 85 | representation of a decimal |
| 86 | number suitable for passing to |
| 87 | .Xr open 2 . |
| 88 | If a device had already been opened, it is |
| 89 | closed before a new open is performed. |
| 90 | .It Xo Sy C Ar device No \en |
| 91 | .Xc |
| 92 | Close the currently open device. The |
| 93 | .Ar device |
| 94 | specified is ignored. |
| 95 | .It Xo Sy L |
| 96 | .Ar whence No \en |
| 97 | .Ar offset No \en |
| 98 | .Xc |
| 99 | .Sm on |
| 100 | Perform an |
| 101 | .Xr lseek 2 |
| 102 | operation using the specified parameters. |
| 103 | The response value is that returned from the |
| 104 | .Xr lseek |
| 105 | call. |
| 106 | .Sm off |
| 107 | .It Sy W Ar count No \en |
| 108 | .Sm on |
| 109 | Write data onto the open device. |
| 110 | .Nm Rmt |
| 111 | reads |
| 112 | .Ar count |
| 113 | bytes from the connection, aborting if |
| 114 | a premature end-of-file is encountered. |
| 115 | The response value is that returned from |
| 116 | the |
| 117 | .Xr write 2 |
| 118 | call. |
| 119 | .Sm off |
| 120 | .It Sy R Ar count No \en |
| 121 | .Sm on |
| 122 | Read |
| 123 | .Ar count |
| 124 | bytes of data from the open device. |
| 125 | If |
| 126 | .Ar count |
| 127 | exceeds the size of the data buffer (10 kilobytes), it is |
| 128 | truncated to the data buffer size. |
| 129 | .Nm rmt |
| 130 | then performs the requested |
| 131 | .Xr read 2 |
| 132 | and responds with |
| 133 | .Sm off |
| 134 | .Sy A Ar count-read No \en |
| 135 | .Sm on |
| 136 | if the read was |
| 137 | successful; otherwise an error in the |
| 138 | standard format is returned. If the read |
| 139 | was successful, the data read is then sent. |
| 140 | .Sm off |
| 141 | .It Xo Sy I Ar operation |
| 142 | .No \en Ar count No \en |
| 143 | .Xc |
| 144 | .Sm on |
| 145 | Perform a |
| 146 | .Dv MTIOCOP |
| 147 | .Xr ioctl 2 |
| 148 | command using the specified parameters. |
| 149 | The parameters are interpreted as the |
| 150 | .Tn ASCII |
| 151 | representations of the decimal values |
| 152 | to place in the |
| 153 | .Ar mt_op |
| 154 | and |
| 155 | .Ar mt_count |
| 156 | fields of the structure used in the |
| 157 | .Xr ioctl |
| 158 | call. The return value is the |
| 159 | .Ar count |
| 160 | parameter when the operation is successful. |
| 161 | .It Sy S |
| 162 | Return the status of the open device, as |
| 163 | obtained with a |
| 164 | .Dv MTIOCGET |
| 165 | .Xr ioctl |
| 166 | call. If the operation was successful, |
| 167 | an ``ack'' is sent with the size of the |
| 168 | status buffer, then the status buffer is |
| 169 | sent (in binary). |
| 170 | .El |
| 171 | .Sm on |
| 172 | .Pp |
| 173 | Any other command causes |
| 174 | .Nm rmt |
| 175 | to exit. |
| 176 | .Sh DIAGNOSTICS |
| 177 | All responses are of the form described above. |
| 178 | .Sh SEE ALSO |
| 179 | .Xr rcmd 3 , |
| 180 | .Xr rexec 3 , |
| 181 | .Xr mtio 4 , |
| 182 | .Xr rdump 8 , |
| 183 | .Xr rrestore 8 |
| 184 | .Sh BUGS |
| 185 | People tempted to use this for a remote file access protocol |
| 186 | are discouraged. |
| 187 | .Sh HISTORY |
| 188 | The |
| 189 | .Nm |
| 190 | command appeared in |
| 191 | .Bx 4.2 . |