CMAP_FD_GET(3)

πŸ’– CMAP_FD_GET πŸ’–

okay bestie, welcome to the Corosync Cluster Engine Programmer's Manual, section 3, page CMAP_FD_GET. yes it's giving "slightly intimidating C library docs" but honestly? it's a whole vibe once you get it, i promise. sit down, hydrate, let's go 🫢


✨ NAME ✨

cmap_fd_get β€” Dispatches callbacks from the CMAP service


🌸 SYNOPSIS 🌸

#include <corosync/cmap.h>

cs_error_t cmap_fd_get (cmap_handle_t handle, int *fd);

πŸ¦‹ DESCRIPTION πŸ¦‹

so like. the cmap_fd_get function is used to retrieve the file descriptor that may be used with the poll system call, so you can figure out when cmap_dispatch(3) won't block. iconic behaviour honestly, it's giving "i just want to know when it's my turn" πŸ’…

but here's the thing, and this is the part people mess up: the handle argument may not be used directly with poll because it is not the file descriptor. it's an internal identifier used by the CMAP library. so no, you can't just yeet your handle into poll and hope for the best β€” that's not it, bestie. get the real fd with this function first. no cap. πŸŽ€


⭐ RETURN VALUE ⭐

this call returns the CS_OK value if successful. otherwise, an error is returned. simple as that, periodt. ✨


πŸ‘‘ SEE ALSO πŸ‘‘

and now for the error code lineup, because she contains multitudes:

  • CS_ERR_TRY_AGAIN β€” Resource temporarily unavailable
  • CS_ERR_INVALID_PARAM β€” Invalid argument
  • CS_ERR_ACCESS β€” Permission denied
  • CS_ERR_LIBRARY β€” The connection failed
  • CS_ERR_INTERRUPT β€” System call interrupted by a signal
  • CS_ERR_NOT_SUPPORTED β€” The requested protocol/functionality not supported
  • CS_ERR_MESSAGE_ERROR β€” Incorrect auth message received
  • CS_ERR_NO_MEMORY β€” Not enough memory to complete the requested task
not me listing every single error like a girlboss 😭 but fr fr, know your error codes, future you will thank present you.

okay that's the whole page, you ate it, you understood it, main character energy confirmed πŸŒˆπŸ’œ

this was brought to you by the corosync Man Page, dated 23/01/2012 β€” yes, she's vintage, she's a classic, and she still slays. bye bestie, go poll responsibly πŸ“πŸ§š

πŸ“¦ where this page comes from