LIBPFM(3)

πŸ’– LIBPFM(3) β€” the Linux Programmer's Manual, but make it make sense πŸ’–

okay bestie, so this is a page from the Linux Programmer's Manual, and it's about one lil function that literally just tells you what went wrong. no cap.


✨ NAME ✨

pfm_strerror β€” returns a constant string describing an error code 🫢


🌸 SYNOPSIS 🌸

#include <perfmon/pfmlib.h>

const char *pfm_strerror(int code);

πŸ¦‹ DESCRIPTION πŸ¦‹

so like. this function hands you back a string that describes the libpfm error value sitting in code. that's it, that's the whole job. the string it returns is read-only β€” do NOT go editing it, it's not yours, leave it alone πŸ’…

⚠️ and here's the tea: you can only use this function with libpfm calls that are documented to return specific error codes. that's the vibe check.

the value -1 is not considered a specific error code. and no, you can't use strings or pfm_pmu_t return values with this function either, sorry bestie. typically NULL gets returned when there's an error for string values, and PFM_PMU_NONE gets returned for pfm_pmu_t values. that's just how it is.

also β€” and this is important β€” this function is not designed to handle OS system call errors, aka errno values. so don't come at it with those, it will not know what to do with them 😭


⭐ RETURN ⭐

it returns a pointer to the constant string that describes the error code πŸ’– the string is in English, bestie. and if code is invalid? it just gives you a default error message. iconic behaviour honestly.


🌈 ERRORS 🌈

if the error code is invalid, the function returns a pointer to a string that literally says "unknown error code". she said "idk her" πŸ’€


πŸ‘‘ AUTHOR πŸ‘‘

Stephane Eranian <eranian@gmail.com> β€” thank you for your service 🫑


aaaand that's the whole page fr fr ✨ this was LIBPFM(3) from the Linux Programmer's Manual, dated September, 2009. mwah, take care of her πŸ’…πŸŽ€

πŸ“¦ where this page comes from