NODEUPDOWN_NODELIST_CREATE(3)
π nodeupdown_nodelist_create β bestie edition π
okay so this is a page from the LIBNODEUPDOWN manual, section 3 (that's the library-functions section, iykyk), and we're talking about three lil functions that are basically the friend group of list management: nodeupdown_nodelist_create, nodeupdown_nodelist_clear, and nodeupdown_nodelist_destroy. no cap, they're here to make, wipe, and yeet lists. let's get into it π¦
β¨ NAME β¨
nodeupdown_nodelist_create, nodeupdown_nodelist_clear, nodeupdown_nodelist_destroy β create, clear, and destroy lists π
β¨ SYNOPSIS β¨
so first you gotta pull in the header, obviously:
#include <nodeupdown.h>
and here's the three besties themselves:
int nodeupdown_nodelist_create(nodeupdown_t handle, char ***list);
int nodeupdown_nodelist_clear(nodeupdown_t handle, char **list);
int nodeupdown_nodelist_destroy(nodeupdown_t handle, char **list);
πΈ DESCRIPTION πΈ
okay so nodeupdown_nodelist_create(), nodeupdown_nodelist_clear(), and nodeupdown_nodelist_destroy() are the trio you call to create, clear, and destroy lists β and by "lists" we mean arrays of strings, bestie, not a Notes-app grocery list. these are the lists you're gonna use with nodeupdown_get_up_nodes_list(3) and nodeupdown_get_down_nodes_list(3). π
nodeupdown_nodelist_create() β this one makes a list with the minimum size needed to store nodes. list gets set to point at the list it just created. and here's the slay part: the created list is guaranteed to store all the nodes that come back from nodeupdown_get_up_nodes_list(3) and nodeupdown_get_down_nodes_list(3). so like, no vibe check needed, it just fits. β¨
nodeupdown_nodelist_clear() β this one wipes any info stored in the list that list points to. and ngl, you do NOT have to call this right after nodeupdown_nodelist_create(). like, it's not a mandatory step, bestie. you only have to call it after the list has been used with nodeupdown_get_up_nodes_list(3) or nodeupdown_get_down_nodes_list(3) and the programmer wants to re-use that list. that's the only time. periodt. π
nodeupdown_nodelist_destroy() β this one destroys the list that list points to and frees all the memory associated with it. it's giving closure. it's giving clean exit. π
π RETURN VALUES π
on success, nodeupdown_nodelist_create() returns the number of elements the created list can store. iconic, honestly.
on success, nodeupdown_nodelist_clear() and nodeupdown_nodelist_destroy() return 0. π
on error, -1 is returned, and an error code is returned in handle. you can grab that error code with nodeupdown_errnum(3), and you can get a description of the error code with nodeupdown_strerror(3). the error codes themselves live in nodeupdown.h. iykyk. π«Ά
π ERRORS π
okay bestie, here's the whole roster of ways this can go wrong. read them, love them, respect them.
NODEUPDOWN_ERR_NULLHANDLEβ thehandleparameter isNULL. reminder that the nodeupdown handle must be created withnodeupdown_handle_create(3). no handle, no service. πNODEUPDOWN_ERR_NOTLOADEDβnodeupdown_load_data(3)has not been called and no data has been retrieved. like, you showed up to the function with nothing loaded. awkward. πNODEUPDOWN_ERR_PARAMETERSβ an incorrect parameter has been passed in. wrong vibe, wrong arg.NODEUPDOWN_ERR_NULLPTRβ a null pointer has been found in the list passed in. πNODEUPDOWN_ERR_OUTMEMβmalloc(3)has failed internally. the memory said no. πNODEUPDOWN_ERR_ISFREEβ all lists associated withhandlehave already been freed. they're gone, bestie, stop calling. πNODEUPDOWN_ERR_MAGICβhandlehas an incorrect magic number. that meanshandledoes not point to a nodeupdown handle, orhandlehas been destroyed bynodeupdown_handle_destroy(3). the magic is not magicking. β¨
π FILES π
/usr/include/nodeupdown.h
π¦ SEE ALSO π¦
libnodeupdown(3), nodeupdown_handle_create(3), nodeupdown_load_data(3), nodeupdown_get_up_nodes_list (3), nodeupdown_get_down_nodes_list (3), nodeupdown_errnum(3), nodeupdown_strerror(3)
and that's the whole page, bestie!! π«Ά this one came out of LLNL, way back in August 2003 β yeah, this page is old enough to have its own nostalgia playlist, and it still ate. go forth and manage your node lists responsibly. mwah π π
π¦ 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