LIBTRACEEVENT(3)

πŸ’– LIBTRACEEVENT πŸ’–

okay bestie, so this is the manual for libtraceevent β€” yes, the same library fam as libtraceevent(3), but this page is about exactly one little function that's lowkey a lifesaver. iykyk. πŸ¦‹


✨ NAME ✨

tep_strerror β€” turns a regular errno or a tep error number into a cute lil' string that actually tells you what went wrong. πŸ’…


🌸 SYNOPSIS 🌸

#include <event-parse.h>

int tep_strerror(struct tep_handle *tep, enum tep_errno errnum, char *buf, size_t buflen);

πŸŽ€ DESCRIPTION πŸŽ€

so tep_strerror() takes a tep error number and converts it into a human readable string, no cap. like it's giving translator energy. 🌈

  • the tep argument is your trace event parser context.
  • the errnum is either a regular errno (the one defined in errno.h) or a tep error number.
  • the string that describes that error number gets copied into the buf argument.
  • the buflen argument is the size of that buf.

it's a thread safe wrapper around strerror_r(), periodt. and listen β€” that library function is messy fr fr, because it has two different behaviors: one POSIX and one GNU specific. but the tep_strerror() API always behaves like the POSIX version, meaning the error string gets copied into the user supplied buffer. every single time. slay. ✨


πŸ‘‘ RETURN VALUE πŸ‘‘

tep_strerror() returns 0 if a valid errnum is passed in and the string gets copied into buf. πŸ’–

if errnum is not a valid error number, it returns -1 and β€” important β€” buf is not modified. so don't go reading stale bytes from it, bestie. 😭


🧚 EXAMPLE 🧚

#include <event-parse.h>
...
struct tep_handle *tep = tep_alloc();
...
char buf[32];
char *pool = calloc(1, 128);
if (tep == NULL) {
    tep_strerror(tep, TEP_ERRNO__MEM_ALLOC_FAILED, buf, 32);
    printf ("The pool is not initialized, %s", buf);
}
...

πŸ“ FILES πŸ“

  • event-parse.h β€” the header file you gotta include to have access to the library APIs. 🫢
  • -ltraceevent β€” the linker switch to add when you're building a program that uses the library. literally just slap it on there. ✨

πŸ’œ SEE ALSO πŸ’œ


⭐ AUTHOR ⭐

  • Steven Rostedt <rostedt@goodmis.org[1]> β€” author of libtraceevent. πŸ‘‘
  • Tzvetomir Stoyanov <tz.stoyanov@gmail.com[2]> β€” author of this man page. πŸŽ€

πŸ’€ REPORTING BUGS πŸ’€

found a bug? not fun but okay β€” report bugs to <linux-trace-devel@vger.kernel.org[3]> and the maintainers will handle it. πŸ™ˆ


🌈 LICENSE 🌈

libtraceevent is Free Software licensed under the GNU LGPL 2.1. 🫢


πŸ¦‹ RESOURCES πŸ¦‹

https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/


🧡 NOTES 🧡

  1. rostedt@goodmis.org mailto:rostedt@goodmis.org
  2. tz.stoyanov@gmail.com mailto:tz.stoyanov@gmail.com
  3. linux-trace-devel@vger.kernel.org mailto:linux-trace-devel@vger.kernel.org

and that's the whole page bestie, go forth and handle your errors gracefully πŸ’…

sign-off: this was libtraceevent 1.9.0, dated 06/15/2026 β€” see you in the next LIBTRACEEVENT(3) bestie, mwah πŸ’–βœ¨

πŸ“¦ where this page comes from