getrpcport(3)

✨ getrpcport(3) β€” Library Functions Manual ✨

okay bestie, so this is a page from the Library Functions Manual, and it's all about the function getrpcport() β€” the queen of "hey, which port is that RPC program on?" πŸ’…


πŸŽ€ NAME πŸŽ€

getrpcport β€” get RPC port number

πŸ“š LIBRARY πŸ“š

Standard C library (libc, -lc) 🫢

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <rpc/rpc.h>

int getrpcport(const char *host, unsigned long prognum,
               unsigned long versnum, unsigned int proto);

πŸ’– DESCRIPTION πŸ’–

So here's the tea, bestie β˜•: getrpcport() hands you back the port number for version versnum of the RPC program prognum that's running on host and speaking protocol proto. It's giving "tell me where to knock" energy πŸšͺ✨

Now for the plot twists, because there are several:

  • If it can't contact the portmapper, it returns 0. 😭
  • If prognum isn't registered at all, it also returns 0. πŸ’€
  • BUT β€” and this is the sneaky part β€” if prognum is registered but not with version versnum, it will still return a port number (for some version of the program), which is basically the function's way of saying "yes, this program is registered, I promise, I just can't give you the exact version you asked for" πŸ‘€πŸ—£οΈ

And here's the caveat that matters: that version mismatch won't get caught by this function at all. It will be detected upon the first call to the service. So like, don't come for getrpcport() when the mismatch shows up later β€” it was literally never its job. πŸ™ˆ

🌸 ATTRIBUTES 🌸

For an explanation of the terms used in this section, see attributes(7). iykyk πŸ“–

  • Interface β€” getrpcport()
  • Attribute β€” Thread safety
  • Value β€” MT-Safe env locale πŸ”₯

πŸ‘‘ STANDARDS πŸ‘‘

BSD.

🌈 HISTORY 🌈

BSD, Solaris.


and that's the whole vibe, bestie πŸ’œ this page came from Linux man-pages 6.20, dated 2025-05-17 β€” go forth and call your RPC ports responsibly 🧚✨

πŸ“¦ where this page comes from
  • arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms