RMTGETCONN(3L)
π RMTGETCONN(3L) π
Okay bestie, welcome to RMTGETCONN(3L) from Schilyβs LIBRARY FUNCTIONS β this is the page about rmtinit, rmtdebug, rmthostname, rmtfilename, and rmtgetconn, and the whole vibe is initiating a connection to a remote tape server (-lrmt). Also hanging out on this page: rmtrmt and rmtrsh. Slay. π
β¨ NAME β¨
Meet the crew: rmtinit, rmtdebug, rmthostname, rmtfilename, rmtgetconn β initiate a connection to a remote tape server (-lrmt). No cap, thatβs the whole name-section moment. π
π¦ SYNOPSIS π¦
#include <schily/librmt.h>
void rmtinit(errmsgn, eexit)
int (*errmsgn) (int, const char *, ...);
void (*eexit) (int);
int rmtdebug(dlevel)
int dlevel;
const char *rmtrmt(rmtname)
const char *rmtname;
const char *rmtrsh(rshname)
const char *rshname;
char *rmtfilename(name)
char *name;
char *rmthostname(hostname, hnsize, rmtspec)
char *hostname;
int hnsize;
char *rmtspec;
int rmtgetconn(host, trsize, excode)
char *host;
int trsize;
int excode;
πΈ DESCRIPTION πΈ
rmtinit()β this is an optional function that lets you set up a function for error printing and a function to be called to exit the program. Ifrmtinit(3)is not called, or any of the function pointers isNULL, the appropriate default function is used instead. The supplied error printing function needs to implement the same interface aserrmsgno(3), and the supplied exit function needs to implement the same interface asexit(3). π«Άrmtdebug()β lets you set the debug level for the library code. The default debug level is0, and it does not print debug messages. Quiet queen behavior. π€«rmtrmt()β lets you set up a different default path to the remote rmt server program. The default is otherwise/etc/rmt. TheRMTenvironment still overwrites the default set up byrmtrmt(3). πrmtrsh()β lets you set up a different remote login program to the remote rmt server program. The default is otherwise to usercmd(3). TheRSHenvironment still overwrites the default set up byrmtrsh(3). π¦rmtfilename()β is given a filename that may be either in remote file syntax (hostname:filenameoruser@hostname:filename) or specified as a hierarchical file path. If the argument turns out to be in remote file syntax, a pointer to the filename part is returned. πrmthostname()β this function copies the user/host part ofrmtspec, which should be in remote file syntax. The first argument is a character array that should be large enough to hold the user/host part ofrmtspec. The second argument is the size of the character array. The third argument is a string in remote file syntax. πrmtgetconn()β this function establishes a connection to the remote tape server process. The first parameter is the usr/host part of a string in remote file syntax and should be created viarmthostname(3). The second parameter is the expected maximum transfer size. It is used to set up kernel buffering viasetsockopt(3)to increase performance. The third parameter is an alternate exit code to be used instead of the library default ifrmtgetconn(3)decides to callexit(3). This allows commands likeufsdumpto use the documented exit codes for startup errors. π₯
π RETURNS π
rmtdebug()β returns the old debug level. βrmtrmt()β returns the old default remote rmt server program path orNULLin case that the default was not overwritten. π«rmtrsh()β returns the old default rmt remote login program orNULLin case that the default was not overwritten. πrmtfilename()β returns the filename part of the argument string orNULLin case the argument turns out to be not in remote file syntax. π¦rmthostname()β returns a pointer to the first argument orNULLin case thermtspecargument turns out to be not in remote file syntax. πΈrmtgetconn()β returns a file descriptor which is suitable to be used as first argument for functions likermtopen(3)orrmtwrite(3). Ifrmtgetconn(3)fails to set up a connection,-1is returned. Ifrmtgetconn(3)is unable to find the port number forshell/tcp, the current uid has no entry in the passwd file, or the user name includes illegal characters,exit()is called. If you do not likermtgetconn(3)to exit in this case, callrmtinit(3)before and install a non exiting function asexit(3)handler;rmtgetconn(3)then will return-2after this function did return. ππ
π§ EXAMPLES π§
Bestie, hereβs the example exactly as the page says. Do not come for the formatting; it is what it is. π
int remfd;
char *remfn;
char host[256];
int iosize = 10240; /* socket send/receive size to set up */
if ((remfn = rmtfilename(filename)) != NULL) {
rmthostname(host, sizeof (host), filename);
if ((remfd = rmtgetconn(host, iosize, 0)) < 0)
comerrno(EX_BAD, "Cannot get connection to '%s'.\n",
/* errno not valid !! */ host);
}
if (rmtopen(remfd, remfn, mode) < 0)
comerr("Cannot open '%s'.\n", remfn);
if (rmtread(remfd, buf, sizeof(buf) < 0)
comerr("Read error on '%s'.\n", remfn);
rmtclose(remfd);
π ENVIRONMENT π
RSHβ if theRSHenvironment is present, the remote connection will not be created viarcmd(3)but by calling the program pointed to byRSH. Use e.g.RSH=/usr/bin/sshto create a secure shell connection. π
If the environment RSH is empty, then the default rcmd(3) is used even in case rmtrsh(3) has been called. π«Ά
RMTβ if theRMTenvironment is present, the remote tape server will not be the program/etc/rmtbut the program pointed to byRMT. π
If the environment RMT is empty, then the default /etc/rmt is used even in case rmtrmt(3) has been called. β¨
Note that the remote tape server program name will be ignored if you log in using an account that has been created with a remote tape server program as login shell. π
π SEE ALSO π
rmt(1), rsh(1), ssh(1), rcmd(3), rmtinit(3), rmtdebug(3), rmtrmt(3), rmtrsh(3), rmthostname(3), rmtfilename(3), rmtgetconn(3), rmtopen(3), rmtioctl(3), rmtclose(3), rmtread(3), rmtwrite(3), rmtseek(3), rmtxstatus(3), rmtstatus(3), _mtg2rmtg(3), _rmtg2mtg(3), errmsgno(3). π
π BUGS π
For now (late 2002), we know that the following programs are broken and do not implement signal handling correctly:
rshon SunOS-5.0...SunOS-5.9sshfrom ssh.comsshfrom openssh.org
Sun already did accept a bug report for rsh(1). Openssh.org accepted a bug for their implementation of ssh(1). π¬
If you usermtgetconn(3)to create a remote connection via an unfixedrsh(1)orssh(1), be prepared that terminal generated signals may interrupt the remote connection. β οΈ
Mail other bugs and suggestions to schilytools@mlists.in-berlin.de or open a ticket at https://codeberg.org/schilytools/schilytools/issues.
The mailing list archive may be found at:
https://mlists.in-berlin.de/mailman/listinfo/schilytools-mlists.in-berlin.de.
π AUTHORS π
librmt has been written in 1990 by Joerg Schilling. In 1995, support for RMT VERSION 1 has been added. librmt is now maintained by the schilytools project authors. π
π SOURCE DOWNLOAD π
The source code for librmt is included in the schilytools project and may be retrieved from the schilytools project at Codeberg at
https://codeberg.org/schilytools/schilytools.
The download directory is
https://codeberg.org/schilytools/schilytools/releases.
And thatβs the page, bestie. Footer energy, periodt: Joerg Schilling β 2022/08/21 β RMTGETCONN(3L), from Schilyβs LIBRARY FUNCTIONS. π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: librmt-devel-doc 2022.10.16-160000.2.2 Β· CDDL-1.0
- Copyright 2018 J. Schilling
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms