RMTSTATUS(3L)
π RMTSTATUS β SchilyΒ΄s LIBRARY FUNCTIONS (3L)
okay so bestie, this is the librmt page about asking a remote tape server for its status. yes, over the network. yes, it's giving main character energy. π
β¨ NAME β¨
rmtstatus, rmtxstatus, _mtg2rmtg, _rmtg2mtg β request MTIOCGET on a connection to a remote tape server (-lrmt)
πΈ SYNOPSIS πΈ
#include <schily/librmt.h>
#include <schily/rmtio.h>
int rmtstatus(int remfd, struct mtget *mtp);
int rmtxstatus(int remfd, struct rmtget *mtp);
void _rmtg2mtg(struct mtget *mtp, struct rmtget *rmtp);
int _mtg2rmtg(struct rmtget *rmtp, struct mtget *mtp);
π DESCRIPTION π
π¦ rmtstatus() and rmtxstatus()
so these two literally perform an MTIOCGET request to the remote server. remfd is a file descriptor you got earlier from a call to rmtgetconn(3) β like, don't just make one up, go get a real one π
struct mtget= the local magnetic tape status structurestruct rmtget= the enhanced magnetic tape status structure fromlibrmt
ngl, rmtstatus(3) and rmtxstatus(3) will fail if there was no previous successful rmtopen(3) before. no open, no status, periodt.
they also take care of using RMT protocol VERSION 1 if the remote side implements support for protocol version 1 β queen behavior, honestly π
β οΈ heads up bestie:rmtstatus(3)is outdated and should be avoided, because the results instruct mtgetwill be the least common denominator of the local and remote variants of the structure. like it's fine but it's not fine. usermtxstatus(3)instead. π«Ά
the member mt_xflags in struct rmtget contains a bitmap that indicates which members of the structure contain valid values. see mtio(4) for more info, iykyk π
π§ _rmtg2mtg()
converts a struct rmtget into a struct mtget. that's it, that's the whole vibe β¨
π _mtg2rmtg()
converts a struct mtget into a struct rmtget and sets the member mt_xflags in struct rmtget to contain a bitmap that indicates which members of struct mtget are present in the local implementation. so organized of it π
β RETURN VALUES β
π₯ rmtstatus() and rmtxstatus()
return a value >= 0 if the remote ioctl(f, MTIOCGET, struct mtget *) succeeds. slay.
π ERRORS π
rmtstatus() and rmtxstatus() return -1 on error and set errno to the errno value retrieved from the remote server. rude but okay π
π _mtg2rmtg()
returns -1 if no value from the local struct mtget could be converted to the abstract struct rmtget. literally nothing made it through π
π EXAMPLES π
int remfd;
char *remfn;
char host[256];
int iosize = 10240; /* socket send/receive size to set up */
struct rmtget rmtg;
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 (rmtxstatus(remfd, &rmtg) < 0)
comerr("Cannot retrieve magnetic tape status from '%s'.\n", remfn);
rmtclose(remfd);
π 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), mtio(4)
π BUGS π
if local and remote errno values do not match, programs may get confused. same, honestly π
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. iconic lineage tbh π«Ά
β 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
π ok that's the whole page bestie β go callrmtxstatus()and notrmtstatus(), love that for you. this one's dated 2022/10/06 and it's signed by Joerg Schilling πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: librmt-devel-doc 2022.10.16-160000.2.2 Β· CDDL-1.0
- Copyright 2002 J. Schilling
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms