CPG_C...XT_SET(3)

πŸ’– CPG_CONTEXT_SET πŸ’–

ok so bestie, we're in the Corosync Cluster Engine Programmer's Manual and today's main character is cpg_context_set from section 3 of the manual. yes it's a tiny little function. yes it still deserves a whole glow-up. let's go πŸŽ€


✨ NAME ✨

cpg_context_set β€” sets the context variable for a CPG instance πŸ¦‹


🌸 SYNOPSIS 🌸

#include <corosync/cpg.h>

int cpg_context_set(cpg_handle_t handle, void *context);

like. that's it. that's the whole thing. iconic behavior honestly πŸ‘‘


πŸ’… DESCRIPTION πŸ’…

so the cpg_context_set function is literally just here to set the context variable for a cpg instance. that's the assignment. that's the mission. slay.

and here's the tea: inside libcpg itself, this thing has no meaning whatsoever. the library will not touch it. it's your little pocket of vibes, completely untouched, living rent-free in the handle. if you wanna get it back later, that's a whole other function β€” use cpg_context_get(3) 🫢


πŸ“ RETURN VALUE πŸ“

if everything goes right, this call hands you back the CS_OK value. and if it doesn't? bestie, an error comes back instead. no in-between, no grey area, periodt πŸ’€


πŸ™ˆ ERRORS πŸ™ˆ

ngl the errors are undocumented. that's it. that's the whole section. we don't know and neither does the manpage 😭


πŸ’œ SEE ALSO πŸ’œ

go read these too, they're all in the same friend group:

and the error code squad, for when things go sideways:

  • CS_ERR_TRY_AGAIN β€” resource temporarily unavailable, she's busy, try again later πŸ•
  • CS_ERR_INVALID_PARAM β€” invalid argument, bestie that input was NOT it 🚫
  • CS_ERR_ACCESS β€” permission denied, no entry for you πŸ’…
  • CS_ERR_LIBRARY β€” the connection failed, we lost her πŸ“΅
  • CS_ERR_INTERRUPT β€” system call interrupted by a signal, rude honestly ⚑
  • CS_ERR_NOT_SUPPORTED β€” the requested protocol/functionality not supported, we simply don't do that here πŸ™…
  • CS_ERR_MESSAGE_ERROR β€” incorrect auth message received, sus πŸ‘€
  • CS_ERR_NO_MEMORY β€” not enough memory to complete the requested task, brain empty, no thoughts πŸ§ πŸ’€

lowkey reminder bestie: this page is the corosync Man Page, dated 2004-08-31, and it lives under the name CPG_C...XT_SET(3). that's the source, the version, and the date, all wrapped up with a bow πŸŽ€βœ¨

go forth and set your context, queen πŸ‘‘πŸ’–

πŸ“¦ where this page comes from