CPG_I..._NEXT(3)
π CPG_I..._NEXT(3) π
okay bestie, so this is a page from the Corosync Cluster Engine Programmer's Manual and honestly? it's giving "tiny function, big personality." let's get into it π¦
β¨ NAME β¨
cpg_iteration_next β return next item in iteration of CPG π
πΈ SYNOPSIS πΈ
#include <corosync/cpg.h>
cs_error_t cpg_iteration_next (cpg_iteration_handle_t handle, struct
cpg_iteration_description_t *description);
like, two args, one struct, no cap π
π DESCRIPTION π
so the cpg_iter_next function is literally there to grab the next value in the iteration. it's the "and then??" of the whole operation.
the handle argument is the iterator handle you got from the cpg_iteration_initalize(3) function β yes that's the actual spelling, we don't fix it, we respect it π«Ά
and description is a pointer to a structure with this exact definition:
struct cpg_iteration_description_t {
struct cpg_name group;
uint32_t nodeid;
uint32_t pid;
};
where:
groupis the name of the group πnodeidis the ID of the connected nodepidis the pid of the connected process
and listen β if the iteration was initialized with theCPG_ITERATION_NAME_ONLYiteration type, then bothnodeidandpidare0. that's just how it is, no drama π
β RETURN VALUE β
this call returns the CS_OK value if it's successful β slay β¨
but if there are no more items to iterate, the CS_NO_SECTION error code comes back. so like, that's the "we're done here, nothing left to see" signal π
π SEE ALSO π
and here's the little error-code roster that comes along with all of this, so you know exactly what vibe each failure is giving:
CS_ERR_TRY_AGAINβ Resource temporarily unavailableCS_ERR_INVALID_PARAMβ Invalid argumentCS_ERR_ACCESSβ Permission deniedCS_ERR_LIBRARYβ The connection failedCS_ERR_INTERRUPTβ System call interrupted by a signalCS_ERR_NOT_SUPPORTEDβ The requested protocol/functionality not supportedCS_ERR_MESSAGE_ERRORβ Incorrect auth message receivedCS_ERR_NO_MEMORYβ Not enough memory to complete the requested task
and that's the whole page, bestie β go iterate something iconic π§π
this little love letter to iterators came out of the corosync Man Page, dated 05/03/2012, and it lives under CPG_I..._NEXT(3). bye bye, drink water π
π¦ where this page comes from
- debian bookworm: libcpg-dev 3.1.7-1+deb12u2 Β· BSD-3-Clause
- debian trixie: libcpg-dev 3.1.9-2+deb13u1 Β· BSD-3-Clause
- epel 9: corosynclib-devel 3.1.10-0.2.el9.1 Β· BSD-3-Clause
- fedora 43: corosynclib-devel 3.1.10-3.fc43 Β· BSD-3-Clause
- fedora 43: corosynclib-devel 3.1.10-3.fc43 Β· BSD-3-Clause
- fedora 43: corosynclib-devel 3.1.9-5.fc43 Β· BSD-3-Clause
- fedora 43: corosynclib-devel 3.1.9-5.fc43 Β· BSD-3-Clause
- fedora 44: corosynclib-devel 3.1.10-4.fc44 Β· BSD-3-Clause
- fedora 44: corosynclib-devel 3.1.10-4.fc44 Β· BSD-3-Clause
- fedora 44: corosynclib-devel 3.1.10-6.fc44 Β· BSD-3-Clause
- fedora 44: corosynclib-devel 3.1.10-6.fc44 Β· BSD-3-Clause
- nixos 26.05: corosync 3.1.9
- nixpkgs unstable: corosync 3.1.9
- opensuse-leap 16.0: corosync-devel 3.1.9-160000.4.1 Β· BSD-3-Clause
- opensuse-leap 16.0: corosync-devel 3.1.9-160000.4.1 Β· BSD-3-Clause
- opensuse-leap 16.0: corosync-devel 3.1.9-160000.4.1 Β· BSD-3-Clause
- opensuse-leap 16.0: corosync-devel 3.1.9-160000.4.1 Β· BSD-3-Clause
- ubuntu jammy: libcpg-dev 3.1.6-1ubuntu1 Β· BSD-3-Clause
- ubuntu jammy: libcpg-dev 3.1.6-1ubuntu1.2 Β· BSD-3-Clause
- ubuntu noble: libcpg-dev 3.1.7-1ubuntu3 Β· BSD-3-Clause
- ubuntu noble: libcpg-dev 3.1.7-1ubuntu3.2 Β· BSD-3-Clause
- ubuntu questing: libcpg-dev 3.1.9-2ubuntu1
- ubuntu questing: libcpg-dev 3.1.9-2ubuntu1.1
- ubuntu resolute: libcpg-dev 3.1.9-2ubuntu3 Β· BSD-3-Clause
- ubuntu stonking: libcpg-dev 3.1.10-3ubuntu1 Β· BSD-3-Clause
- Copyright (c) 2012 Red Hat, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms