CMAP_DEC(3)

πŸ’– NAME πŸ’–

cmap_inc β€” Decrease already stored value in CMAP

(yes bestie, the name says cmap_inc and the description says decrease, we don't make the rules, we just report them faithfully 🫢)


✨ SYNOPSIS ✨

#include <corosync/cmap.h>

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

🌸 DESCRIPTION 🌸

okay so the cmap_dec function is here to decrease the integer value of a key that's already stored inside cmap. Like, the key has to exist first, we're not creating anything, we're just nudging a number down. no cap.

  • the handle argument is your connection to the CMAP database, and you get it by calling cmap_initialize(3) πŸ’…
  • key_name is the name of the key whose value you wanna increase (yes, the manpage literally says "increase" there, and honestly? iconic. we keep it exactly as written πŸŽ€)

This function is defined only on values where increasing makes sense and is well defined, so it can be one of:

  • 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
πŸ’€ Overflow/underflow is not detected and it's ignored. so like, be aware. she's not checking your math, she's just vibing.

⭐ RETURN VALUE ⭐

This call returns the CS_OK value if successful, periodt. ✨

But if value or key_name are unspecified, you get CS_ERR_INVALID_PARAM back. 😭

CS_ERR_NOT_EXIST error is returned if the key doesn't exist β€” which means it wasn't created by calling cmap_set(3) first. so like, you gotta set it up before you can decrement it, bestie.

Also, some of keys may be tagged read-only directly in corosync, and setting such a key will result in a CS_ERR_ACCESS error. πŸ”’ not her fault, she's just locked.


🌈 SEE ALSO 🌈

and the whole error-girlie lineup:

  • 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, filed under CMAP_DEC(3) β€” go forth and decrement responsibly, mwah πŸ’…πŸ’–

πŸ“¦ where this page comes from