xref: /minix3/lib/librmt/rmtops.3 (revision 85fee539f46ba8fb5b2f4cc95f1771ea1c379f15)
1*85fee539SLionel Sambuc.\"	$NetBSD: rmtops.3,v 1.14 2010/03/22 22:00:37 joerg Exp $
2*85fee539SLionel Sambuc.\"
3*85fee539SLionel Sambuc.Dd October 16, 2001
4*85fee539SLionel Sambuc.Dt RMTOPS 3
5*85fee539SLionel Sambuc.Os
6*85fee539SLionel Sambuc.Sh NAME
7*85fee539SLionel Sambuc.Nm rmtops
8*85fee539SLionel Sambuc.Nd access tape drives on remote machines
9*85fee539SLionel Sambuc.Sh LIBRARY
10*85fee539SLionel SambucRemote Magnetic Tape Library (librmt, -lrmt)
11*85fee539SLionel Sambuc.Sh SYNOPSIS
12*85fee539SLionel Sambuc.In rmt.h
13*85fee539SLionel Sambuc.In sys/stat.h
14*85fee539SLionel Sambuc.Ft int
15*85fee539SLionel Sambuc.Fn isrmt "int fd"
16*85fee539SLionel Sambuc.Ft int
17*85fee539SLionel Sambuc.Fn rmtaccess "char *file" "int mode"
18*85fee539SLionel Sambuc.Ft int
19*85fee539SLionel Sambuc.Fn rmtclose "int fd"
20*85fee539SLionel Sambuc.Ft int
21*85fee539SLionel Sambuc.Fn rmtcreat "char *file" "int mode"
22*85fee539SLionel Sambuc.Ft int
23*85fee539SLionel Sambuc.Fn rmtdup "int fd"
24*85fee539SLionel Sambuc.Ft int
25*85fee539SLionel Sambuc.Fn rmtfcntl "int fd" "int cmd" "int arg"
26*85fee539SLionel Sambuc.Ft int
27*85fee539SLionel Sambuc.Fn rmtfstat "int fd" "struct stat *buf"
28*85fee539SLionel Sambuc.Ft int
29*85fee539SLionel Sambuc.Fn rmtioctl "int fd" "int request" "char *argp"
30*85fee539SLionel Sambuc.Ft int
31*85fee539SLionel Sambuc.Fn rmtisatty "int fd"
32*85fee539SLionel Sambuc.Ft long
33*85fee539SLionel Sambuc.Fn rmtlseek "int fd" "long offset" "int whence"
34*85fee539SLionel Sambuc.Ft int
35*85fee539SLionel Sambuc.Fn rmtlstat "char *file" "struct stat *buf"
36*85fee539SLionel Sambuc.Ft int
37*85fee539SLionel Sambuc.Fn rmtopen "char *file" "int flags" "int mode"
38*85fee539SLionel Sambuc.Ft int
39*85fee539SLionel Sambuc.Fn rmtread "int fd" "char *buf" "int nbytes"
40*85fee539SLionel Sambuc.Ft int
41*85fee539SLionel Sambuc.Fn rmtstat "char *file" "struct stat *buf"
42*85fee539SLionel Sambuc.Ft int
43*85fee539SLionel Sambuc.Fn rmtwrite "int fd" "char *buf" "int nbytes"
44*85fee539SLionel Sambuc.Sh DESCRIPTION
45*85fee539SLionel SambucThe
46*85fee539SLionel Sambuc.Nm
47*85fee539SLionel Sambuclibrary provides a simple means of transparently accessing tape drives
48*85fee539SLionel Sambucon remote machines via
49*85fee539SLionel Sambuc.Xr rsh 1
50*85fee539SLionel Sambucand
51*85fee539SLionel Sambuc.Xr rmt 8 .
52*85fee539SLionel SambucThese routines are used like their corresponding system calls, but
53*85fee539SLionel Sambucallow the user to open up a tape drive on a remote system on which he
54*85fee539SLionel Sambucor she has an account and the appropriate remote permissions.
55*85fee539SLionel Sambuc.Pp
56*85fee539SLionel SambucA remote tape drive file name has the form
57*85fee539SLionel Sambuc.Dl [user@]hostname:/dev/???
58*85fee539SLionel Sambucwhere
59*85fee539SLionel Sambuc.Em system
60*85fee539SLionel Sambucis the remote system,
61*85fee539SLionel Sambuc.Em /dev/???
62*85fee539SLionel Sambucis the particular drive on the remote system (raw, blocked, rewinding,
63*85fee539SLionel Sambucnon-rewinding, etc.), and the optional
64*85fee539SLionel Sambuc.Em user
65*85fee539SLionel Sambucis the login name to be used on the remote system, if different from
66*85fee539SLionel Sambucthe current user's login name.
67*85fee539SLionel Sambuc.\" .Pp
68*85fee539SLionel Sambuc.\" The library source code may be optionally compiled to recognize the
69*85fee539SLionel Sambuc.\" old
70*85fee539SLionel Sambuc.\" .Bx 4.2 ,
71*85fee539SLionel Sambuc.\" remote syntax
72*85fee539SLionel Sambuc.\" .sp
73*85fee539SLionel Sambuc.\" 	hostname[.user]:/dev/???
74*85fee539SLionel Sambuc.\" .sp
75*85fee539SLionel Sambuc.\" By default, only the first form (introduced in
76*85fee539SLionel Sambuc.\" .Bx 4.3 )
77*85fee539SLionel Sambuc.\" is recognized.
78*85fee539SLionel Sambuc.Pp
79*85fee539SLionel SambucFor transparency, the user should include the file
80*85fee539SLionel Sambuc.In rmt.h ,
81*85fee539SLionel Sambucwhich has the following defines in it:
82*85fee539SLionel Sambuc.Bd -literal
83*85fee539SLionel Sambuc#define access	rmtaccess
84*85fee539SLionel Sambuc#define close	rmtclose
85*85fee539SLionel Sambuc#define creat	rmtcreat
86*85fee539SLionel Sambuc#define dup	rmtdup
87*85fee539SLionel Sambuc#define fcntl	rmtfcntl
88*85fee539SLionel Sambuc#define fstat	rmtfstat
89*85fee539SLionel Sambuc#define ioctl	rmtioctl
90*85fee539SLionel Sambuc#define isatty	rmtisatty
91*85fee539SLionel Sambuc#define lseek	rmtlseek
92*85fee539SLionel Sambuc#define lstat	rmtlstat
93*85fee539SLionel Sambuc#define open	rmtopen
94*85fee539SLionel Sambuc#define read	rmtread
95*85fee539SLionel Sambuc#define stat	rmtstat
96*85fee539SLionel Sambuc#define write	rmtwrite
97*85fee539SLionel Sambuc.Ed
98*85fee539SLionel Sambuc.Pp
99*85fee539SLionel SambucThis allows the programmer to use
100*85fee539SLionel Sambuc.Xr open 2 ,
101*85fee539SLionel Sambuc.Xr close 2 ,
102*85fee539SLionel Sambuc.Xr read 2 ,
103*85fee539SLionel Sambuc.Xr write 2 ,
104*85fee539SLionel Sambucetc. in their normal fashion, with the
105*85fee539SLionel Sambuc.Nm
106*85fee539SLionel Sambucroutines taking care of differentiating between local and remote files.
107*85fee539SLionel SambucThis file should be included
108*85fee539SLionel Sambuc.Em before
109*85fee539SLionel Sambucincluding the file
110*85fee539SLionel Sambuc.Pa \*[Lt]sys/stat.h\*[Gt] ,
111*85fee539SLionel Sambucsince it redefines the identifier ``stat'' which is used to declare
112*85fee539SLionel Sambucobjects of type
113*85fee539SLionel Sambuc.Em "struct stat" .
114*85fee539SLionel Sambuc.Pp
115*85fee539SLionel SambucThe routines differentiate between local and remote file descriptors
116*85fee539SLionel Sambucby adding a bias (currently 128) to the file descriptor of the pipe.
117*85fee539SLionel SambucThe programmer, if he or she must know if a file is remote, should use
118*85fee539SLionel Sambuc.Fn isrmt .
119*85fee539SLionel Sambuc.Sh ENVIRONMENT
120*85fee539SLionel SambucThe RCMD_CMD environment variable can be set to the name or pathname
121*85fee539SLionel Sambucof a program to use, instead of
122*85fee539SLionel Sambuc.Pa /usr/bin/rsh ,
123*85fee539SLionel Sambucand must have the same calling conventions as
124*85fee539SLionel Sambuc.Xr rsh 1 .
125*85fee539SLionel Sambuc.Sh FILES
126*85fee539SLionel Sambuc.Bl -tag -width /usr/lib/librmt.a -compact
127*85fee539SLionel Sambuc.It Pa /usr/lib/librmt.a
128*85fee539SLionel Sambucremote tape library
129*85fee539SLionel Sambuc.El
130*85fee539SLionel Sambuc.Sh DIAGNOSTICS
131*85fee539SLionel SambucSeveral of these routines will return \-1 and set
132*85fee539SLionel Sambuc.Va errno
133*85fee539SLionel Sambucto EOPNOTSUPP, if they are given a remote file name or a file descriptor
134*85fee539SLionel Sambucon an open remote file (e.g.,
135*85fee539SLionel Sambuc.Fn rmtdup ) .
136*85fee539SLionel Sambuc.Sh SEE ALSO
137*85fee539SLionel Sambuc.Xr rcp 1 ,
138*85fee539SLionel Sambuc.Xr rsh 1 ,
139*85fee539SLionel Sambuc.Xr rmt 8
140*85fee539SLionel Sambuc.Pp
141*85fee539SLionel SambucAnd the appropriate system calls in section 2.
142*85fee539SLionel Sambuc.\" .Sh CONFIGURATION OPTIONS
143*85fee539SLionel Sambuc.\" The library may be compiled to allow the use of
144*85fee539SLionel Sambuc.\" .Bx 4.2 -style
145*85fee539SLionel Sambuc.\" remote file names.  This is not recommended.
146*85fee539SLionel Sambuc.\" .Pp
147*85fee539SLionel Sambuc.\" By default, the library opens two pipes to
148*85fee539SLionel Sambuc.\" .Xr rsh 1 .
149*85fee539SLionel Sambuc.\" It may optionally be compiled to use
150*85fee539SLionel Sambuc.\" .Xr rexec 3 ,
151*85fee539SLionel Sambuc.\" instead.  Doing so requires the use of a
152*85fee539SLionel Sambuc.\" .Em .netrc
153*85fee539SLionel Sambuc.\" file in the user's home directory, or that the application designer be
154*85fee539SLionel Sambuc.\" willing to have
155*85fee539SLionel Sambuc.\" .Xr rexec 3
156*85fee539SLionel Sambuc.\" prompt the user for a login name and password on the remote host.
157*85fee539SLionel Sambuc.Sh AUTHORS
158*85fee539SLionel SambucJeff Lee wrote the original routines for accessing tape drives via
159*85fee539SLionel Sambuc.Xr rmt 8 .
160*85fee539SLionel Sambuc.Pp
161*85fee539SLionel SambucFred Fish redid them into a general purpose library.
162*85fee539SLionel Sambuc.Pp
163*85fee539SLionel SambucArnold Robbins added the ability to specify a user name on the remote
164*85fee539SLionel Sambucsystem, the
165*85fee539SLionel Sambuc.Pa \*[Lt]rmt.h\*[Gt]
166*85fee539SLionel Sambucinclude file, this man page, cleaned up the library a little, and made
167*85fee539SLionel Sambucthe appropriate changes for
168*85fee539SLionel Sambuc.Bx 4.3 .
169*85fee539SLionel Sambuc.Pp
170*85fee539SLionel SambucDan Kegel contributed the code to use the
171*85fee539SLionel Sambuc.Xr rexec 3
172*85fee539SLionel Sambuclibrary routine.
173*85fee539SLionel Sambuc.Sh BUGS
174*85fee539SLionel SambucThere is no way to use remote tape drives with
175*85fee539SLionel Sambuc.Xr stdio 3 ,
176*85fee539SLionel Sambucshort of recompiling it entirely to use these routines.
177*85fee539SLionel Sambuc.Pp
178*85fee539SLionel SambucThe
179*85fee539SLionel Sambuc.Xr rmt 8
180*85fee539SLionel Sambucprotocol is not very capable.
181*85fee539SLionel SambucIn particular, it relies on TCP/IP sockets for error
182*85fee539SLionel Sambucfree transmission, and does no data validation of its own.
183