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