NODEUPDOWN_UP_COUNT(3)
π 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:
- grab the error code with
nodeupdown_errnum(3)π - grab a little description of that error code with
nodeupdown_strerror(3)π
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β thehandleparameter isNULL. like, it's nothing. it's giving void. the nodeupdown handle must be created withnodeupdown_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βhandlehas an incorrect magic number. which means eitherhandledoes not point to a nodeupdown handle, orhandlehas been destroyed bynodeupdown_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 π
libnodeupdown(3)nodeupdown_handle_create(3)nodeupdown_load_data(3)nodeupdown_errnum(3)nodeupdown_strerror(3)
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
- epel 9: libnodeupdown-devel 1.14-41.el9 Β· GPLv2+
- fedora 43: libnodeupdown-devel 1.14-50.fc43 Β· GPL-2.0-or-later
- fedora 43: libnodeupdown-devel 1.14-50.fc43 Β· GPL-2.0-or-later
- fedora 44: libnodeupdown-devel 1.14-51.fc44 Β· GPL-2.0-or-later
- fedora 44: libnodeupdown-devel 1.14-51.fc44 Β· GPL-2.0-or-later
- Copyright (C) 2007-2011 Lawrence Livermore National Security, LLC
- Copyright (C) 2003-2007 The Regents of the University of California
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms