CMAP_INC(3)

πŸ’– CMAP_INC(3) πŸ’–

okay bestie, welcome to the cmap_inc page from the Corosync Cluster Engine Programmer's Manual ✨ this is the one where you take a number that's already sitting in CMAP and you make it Bigger. iconic behaviour honestly.


🌸 NAME 🌸

cmap_inc β€” Increase already stored value in CMAP πŸ†™


✨ SYNOPSIS ✨

#include <corosync/cmap.h>

cs_error_t cmap_inc (cmap_handle_t handle, const char *key_name);

πŸŽ€ DESCRIPTION πŸŽ€

so, the cmap_inc function is literally here to increase the integer value of a key that's already stored inside cmap. no creating from scratch, babe, it's already gotta be there. πŸ’…

the handle argument is your connection to the CMAP database, and you get that by calling cmap_initialize(3). and key_name is the name of the key whose value you wanna bump up. simple as that. πŸ¦‹

now here's the thing β€” this function is only defined on values where increasing actually makes sense and is well defined. so it's giving very specific type energy, and it can be one of these:

  • CMAP_VALUETYPE_INT8 β€” 8-bit signed integer
  • CMAP_VALUETYPE_UINT8 β€” 8-bit unsigned integer
  • CMAP_VALUETYPE_INT16 β€” 16-bit signed integer
  • CMAP_VALUETYPE_UINT16 β€” 16-bit unsigned integer
  • CMAP_VALUETYPE_INT32 β€” 32-bit signed integer
  • CMAP_VALUETYPE_UINT32 β€” 32-bit unsigned integer
  • CMAP_VALUETYPE_INT64 β€” 64-bit signed integer
  • CMAP_VALUETYPE_UINT64 β€” 64-bit unsigned integer
⚠️ bestie listen β€” overflow/underflow is not detected and it's ignored. it just happens. no warning, no drama, no nothing. you've been warned. 😭

πŸ‘‘ RETURN VALUE πŸ‘‘

this call returns the CS_OK value if it's successful. slay. πŸ’–

if value or key_name are unspecified, you get CS_ERR_INVALID_PARAM back. and CS_ERR_NOT_EXIST shows up if the key doesn't exist β€” meaning it wasn't created by calling cmap_set(3) first. 🫢

also, heads up: some of the keys may be tagged read-only directly in corosync, and trying to set one of those will land you a CS_ERR_ACCESS error. not your fault, it's just built different. πŸ™ˆ


🌈 SEE ALSO 🌈

and here's the whole error-code crew, fr fr:

  • 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

and that's the whole page, bestie 🧚 this was the corosync Man Page, dated 03/02/2012, and you just finished CMAP_INC(3). go increment something responsibly πŸ’œβœ¨

πŸ“¦ where this page comes from