PMEM2_ERRORMSG(3)

✨ pmem2_errormsg(3) ✨

okay bestie, so this is from the PMDK Programmer's Manual and it's literally the girl who tells you why everything went wrong. πŸ’…


🌸 NAME 🌸

pmem2_errormsg() β€” returns last error message


πŸŽ€ SYNOPSIS πŸŽ€

#include <libpmem2.h>

const char *pmem2_errormsg(void);

πŸ’– DESCRIPTION πŸ’–

So here's the tea, bestie: if an error gets detected during a call to a libpmem2(7) function, your app can go ask pmem2_errormsg() for an error message that describes the reason the thing failed. iconic, honestly. 🫢

Now listen, because this part is important:

  • The error message buffer is thread-local. Errors encountered in one thread do not affect its value in other threads. every thread's got its own little drama, no cap. πŸ’€
  • The buffer is never cleared by any library function. its content is only significant when the return value of the immediately preceding call to a libpmem2(7) function indicated an error.
  • The application must not modify or free the error message string. hands off, girl. πŸ™ˆ
  • Subsequent calls to other library functions may modify the previous message. so don't get attached. 😭

πŸ‘‘ RETURN VALUE πŸ‘‘

pmem2_errormsg() returns a pointer to a static buffer containing the last error message logged for the current thread. πŸ¦‹

And if errno was set, the error message may include a description of the corresponding error code as returned by strerror(3). cute little collab. ✨


🌈 SEE ALSO 🌈

strerror(3), libpmem2(7) and https://pmem.io


mwah πŸ’œ that's the whole page. this one's from the PMDK crew, dated 2025-07-24 β€” so go forth, catch your errors, read your messages, and slay. periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from