CPG_FD_GET(3)
π CPG_FD_GET(3) π
okay bestie, sit down, hydrate, and let me tell you about cpg_fd_get β it's a lil function from the Corosync Cluster Engine Programmer's Manual and it's honestly kind of a big deal for anyone doing CPG stuff. π¦
β¨ NAME β¨
cpg_fd_get β Dispatches callbacks from the CPG service
no fr, that's the whole name line, we're not editing the sacred texts π
πΈ SYNOPSIS πΈ
#include <corosync/cpg.h>
int cpg_fd_get(cpg_handle_t handle, int *fd);
like, that's it. two args. she's low maintenance π
π DESCRIPTION π
So the way this works, bestie: cpg_fd_get is the function you call to retrieve the file descriptor that you can hand off to the poll system call. Why tho? Because you wanna know exactly when cpg_dispatch(3) won't block. That's the whole point. No more guessing, no more vibes-based polling. πβ¨
and here's the part people get wrong every single time, so listen up:
thehandleargument may not be used directly withpollπ ββοΈ
why not?? because it's literally not the file descriptor. it's an internal identifier that the CPG library uses for itself. it's giving "cute nickname that only the library understands," not "real OS-level fd." so if you pass handle straight into poll, that's not it, bestie. get the fd first. periodt. π
β RETURN VALUE β
this call returns the CS_OK value if successful π«Ά otherwise, an error is returned. that's the deal.
π ERRORS π
the errors are undocumented. yeah. that's it. that's the whole section. we don't know. nobody wrote it down. iconic behaviour honestly π
π SEE ALSO π
go read these too, they're all in the same friend group:
cpg_overview(3)cpg_initialize(3)cpg_finalize(3)cpg_fd_get(3)cpg_dispatch(3)cpg_join(3)cpg_leave(3)cpg_mcast_joined(3)cpg_membership_get(3)cpg_zcb_alloc(3)cpg_zcb_free(3)cpg_zcb_mcast_joined(3)cpg_context_get(3)cpg_context_set(3)cpg_local_get(3)
and the error code squad, all listed here verbatim so you know exactly what you're catching:
CS_ERR_TRY_AGAINResource temporarily unavailableCS_ERR_INVALID_PARAMInvalid argumentCS_ERR_ACCESSPermission deniedCS_ERR_LIBRARYThe connection failedCS_ERR_INTERRUPTSystem call interrupted by a signalCS_ERR_NOT_SUPPORTEDThe requested protocol/functionality not supportedCS_ERR_MESSAGE_ERRORIncorrect auth message receivedCS_ERR_NO_MEMORYNot enough memory to complete the requested task
π§ a lil sign-off π§
this page came from the corosync Man Page, dated 2004-08-31 β yes she's vintage, yes she still slays, we stan an elder π
now go poll that fd properly. main character energy only. byeee πβ¨π
π¦ 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) 2006 Red Hat, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms