Skip to contentSkip to conversation

libtracefs: Implement tracefs_error_last/all()

PATCH New Steven Rostedt 1 participant 1 message Jun 29, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libtracefs: Implement tracefs_error_last/all()

From: "Steven Rostedt (VMware)" <[email protected]>

Add a helper function that will read an instance error_log file, and either return the entire content of the error log (tracefs_error_all()) or just the last error (tracefs_error_last()).

Also add tracefs_error_clear() to clear the error log.

---
 include/tracefs.h   |   4 ++
 src/tracefs-utils.c | 112 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 116 insertions(+)
include/tracefs.h +4 -0
index 447821e..b478684 100644
@@ -58,6 +58,10 @@ int tracefs_trace_off_fd(int fd);
 int tracefs_event_enable(struct tracefs_instance *instance, const char *system, const char *event);
 int tracefs_event_disable(struct tracefs_instance *instance, const char *system, const char *event);
 
+char *tracefs_error_last(struct tracefs_instance *instance);
+char *tracefs_error_all(struct tracefs_instance *instance);
+int tracefs_error_clear(struct tracefs_instance *instance);
+
 /**
  * tracefs_trace_on_get_fd - Get a file descriptor of "tracing_on" in given instance
  * @instance: ftrace instance, can be NULL for the top instance
src/tracefs-utils.c +112 -0

121 lines not on this page · raw message

Signature · 1 line
2.29.2