NODEUPDOWN_NODELIST_CREATE(3)
π NODEUPDOWN_NODELIST_CREATE π
okay bestie, so this is the libnodeupdown girlies' guide to lists β like, actual C lists, arrays of strings, the whole thing. Three functions, one vibe: nodeupdown_nodelist_create, nodeupdown_nodelist_clear, and nodeupdown_nodelist_destroy. They make lists, they wipe lists, they yeet lists. Slay. β¨
π¦ SYNOPSIS π¦
#include <nodeupdown.h>
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 πΈ
so like, these three are your little list-management besties π
β they create, clear, and destroy lists (which are arrays of strings, btw) so you can use them with nodeupdown_get_up_nodes_list(3) and nodeupdown_get_down_nodes_list(3). that's the whole point of them, no cap.
nodeupdown_nodelist_create() makes a list with the minimum size needed to store nodes. list gets set to point at the list that just got created. and here's the pinky promise: the list it creates is guaranteed to store all the nodes that come back from nodeupdown_get_up_nodes_list(3) and nodeupdown_get_down_nodes_list(3). no overflow jumpscares, we love that for you. π«Ά
nodeupdown_nodelist_clear() clears out whatever info is chilling in the list that list points to. important note bestie: you do not have to call this after nodeupdown_nodelist_create(). nope! it only has to be called after you've used the list with nodeupdown_get_up_nodes_list(3) or nodeupdown_get_down_nodes_list(3) and you wanna re-use that list. it's giving recycling era β»οΈ.
nodeupdown_nodelist_destroy() destroys the list that list points to and frees all the memory associated with it. it's the final boss of cleanup, the closure era, the "we're done here" text. π
π RETURN VALUES π
okay so on success:
nodeupdown_nodelist_create()returns the number of elements the created list can store. like, the capacity, the whole flex. π₯nodeupdown_nodelist_clear()andnodeupdown_nodelist_destroy()both return0. iconic, consistent, we stan.
on error, -1 is returned, and an error code gets returned in handle. you can grab that error code via nodeupdown_errnum(3), and a lil description of it via nodeupdown_strerror(3). the error codes themselves live in nodeupdown.h, iykyk.
π ERRORS π
vibe check on what could go wrong:
NODEUPDOWN_ERR_NULLHANDLEβ thehandleparameter isNULL. bestie you gotta create the nodeupdown handle withnodeupdown_handle_create(3)first, fr fr.NODEUPDOWN_ERR_NOTLOADEDβnodeupdown_load_data(3)has not been called and no data has been retrieved. nothing loaded, nothing to work with π.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. found a strayNULLin there, not cute.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, they've left the chat.NODEUPDOWN_ERR_MAGICβhandlehas an incorrect magic number. eitherhandledoesn't point to a nodeupdown handle at all, or it got destroyed bynodeupdown_handle_destroy(3). the magic is not magic-ing. β¨π«
π 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 lil manual came from LLNL, dated August 2003 β yes she's an elder but she's still serving, and she's part of LIBNODEUPDOWN. go forth and manage your lists responsibly. 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