RM(3)

πŸ“¦ version 23.06.06-unstable-2026-04, in nixos 26.05, nixpkgs unstable

πŸ’… RM(3) β€” the resource monitor API, explained by your fave Unix bestie

okay so bestie, this is RM(3) from PBS Professional, and it's genuinely one of those pages that looks scary until someone (me, hi 🫢) walks you through it. it's the library that lets your code talk to the PBS Professional resource monitor, and it's built so you can juggle several resource monitors at once without the network stuff making you cry. let's get into it ✨


✨ NAME ✨

openrm, closerm, downrm, configrm, addreq, allreq, getreq, flushreq, activereq, fullresp β€” that's the whole resource monitor API squad, all ten of them, no cap πŸ‘‘


🌸 SYNOPSIS 🌸

here's the lineup, literally copy these exactly:

#include <sys/types.h>
#include <netinet/in.h>
#include <rm.h>

int openrm (host, port)
      char *host;
      unsigned int port;

int closerm (stream)
      int stream;

int downrm (stream)
      int stream;

int configrm (stream, file)
      int stream;
      char *file;

int addreq (stream, line)
      int stream;
      char *line;

int allreq (line)
      char *line;

char *getreq(stream)
      int stream;

int flushreq()

int activereq()

void fullresp(flag)
      int flag;

πŸ¦‹ DESCRIPTION πŸ¦‹

so. the resource monitor library has functions that make talking to the PBS Professional resource monitor actually pleasant πŸ’–. the whole point is that it's set up so connecting to several resource monitors is easy and the network communication is handled efficiently β€” main character energy, honestly.

in all of these routines, the variable pbs_errno gets set whenever an error is indicated. remember that, it's your bestie when things go sideways πŸ™ˆ. the lower levels of the network protocol are handled by the "Data Is Strings" DIS library and the "Reliable Packet Protocol" RPP library.

  • configrm() β€” causes the resource monitor to read the file named. it's Deprecated, so like… don't build your whole personality around it, okay? πŸ’€
  • addreq() β€” begins a new message to the resource monitor if necessary. then it adds a line to the body of an outstanding command to the resource monitor.
  • allreq() β€” begins, for each stream, a new message to the resource monitor if necessary. then adds a line to the body of an outstanding command to the resource monitor.
  • getreq() β€” finishes and sends any outstanding message to the resource monitor πŸ”₯. here's the important bit: if fullresp() has been called to turn off "full response" mode, this routine searches down the line to find the equal sign just before the response value. the returned string (if it is not NULL) has been allocated by malloc, so free must be called when it's no longer needed β€” otherwise, memory leaks, and we do not stan memory leaks 😭
  • flushreq() β€” finishes and sends any outstanding messages to all resource monitors. for each active resource monitor structure, it checks if any outstanding data is waiting to be sent. if there is, it gets sent and the internal structure is marked to show "waiting for response".
  • fullresp() β€” turns on, if flag is true, "full response" mode, where getreq() returns a pointer to the beginning of a line of response. this is the default, bestie 🌟. if flag is false, the line returned by getreq() is just the answer following the equal sign.
  • activereq() β€” returns the stream number of the next stream with something to read, or a negative number (the return from rpp_poll) if there is no stream to read.
πŸͺŸ windows girlies listen up: in order to use any of the above with Windows, you gotta initialize the network library and link with winsock2. to do this, call winsock_init() before calling the function, and link against the ws2_32.lib library. do it in that order, fr fr πŸŽ€

🌈 SEE ALSO 🌈

  • tcp(4P)
  • udp(4P)

that's the whole page, you ate that πŸ’…. this lil gem is from the Local source, version dated 6 March 2019, and yes, it's still filed under RM(3) β€” go forth and monitor those resources, icon πŸ§šπŸ’œ

πŸ“¦ where this page comes from