NODEUPDOWN_UP_COUNT(3)

πŸ“¦ version 1.14, in epel 9, fedora 43, fedora 44

πŸ’– NODEUPDOWN_UP_COUNT(3) πŸ’–

okay bestie, welcome to the LIBNODEUPDOWN corner of the manual, section 3, and today's main characters are nodeupdown_up_count and nodeupdown_down_count. yes, both of them, they're a package deal, they come as a set, like matching butterfly clips πŸ¦‹


✨ NAME ✨

nodeupdown_up_count, nodeupdown_down_count β€” they tell you the number of nodes that are up or down. that's it. that's the job. and they do it flawlessly, no cap πŸ’…


🌸 SYNOPSIS 🌸

#include <nodeupdown.h>

int nodeupdown_up_count(nodeupdown_t handle);

int nodeupdown_down_count(nodeupdown_t handle);

look at them. two little ints, one handle each. so simple. so clean. iconic behavior honestly πŸŽ€


🫢 DESCRIPTION 🫢

  • nodeupdown_up_count() β€” returns the number of nodes that are up. literally just counts the up ones for you, no thoughts required ✨
  • nodeupdown_down_count() β€” returns the number of nodes that are down. same energy, opposite direction πŸ’€

⭐ RETURN VALUES ⭐

so here's the vibe check πŸ‘‘

on success, nodeupdown_up_count() and nodeupdown_down_count() will return the number of up or down nodes respectively. like, the actual count. the real number. slay.

on error, both of them return -1, and an error code gets tucked into handle. and then you're like "okay but what error tho" and the answer is:

and the error codes themselves? they live in nodeupdown.h, bestie. that's where they're defined.


😭 ERRORS 😭

these are the three ways things can go sideways. pay attention, i'm not repeating myself 🫢

  • NODEUPDOWN_ERR_NULLHANDLE β€” the handle parameter is NULL. like, it's nothing. it's giving void. the nodeupdown handle must be created with nodeupdown_handle_create(3) first, okay?? you can't just show up with no handle πŸ’€
  • NODEUPDOWN_ERR_NOTLOADED β€” nodeupdown_load_data(3) has not been called and no data has been retrieved. so there's literally nothing to count. you skipped the part where you get the data. the audacity πŸ™ˆ
  • NODEUPDOWN_ERR_MAGIC β€” handle has an incorrect magic number. which means either handle does not point to a nodeupdown handle, or handle has been destroyed by nodeupdown_handle_destroy(3). it's a ghost handle. it's not real anymore. do not interact πŸ‘»

πŸŽ€ FILES πŸŽ€

  • /usr/include/nodeupdown.h β€” the sacred text, the source of all the error codes, the blueprint 🧚

🌈 SEE ALSO 🌈

go read those next, bestie, they're all connected, it's a whole universe ✨


LLNL wrote this and it's dated September 2003, which is genuinely ancient history but the code still ate and left no crumbs πŸ‘‘πŸ’– periodt.

πŸ“¦ where this page comes from