Currently the trace fds are not closed. Add a function for it. Signed-off-by: Kurt Kanzenbach <kurt@xxxxxxxxxxxxx> --- src/include/rt-utils.h | 1 + src/lib/rt-utils.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/include/rt-utils.h b/src/include/rt-utils.h index 4ed1cbc53ece..c6fb220cdb0a 100644 --- a/src/include/rt-utils.h +++ b/src/include/rt-utils.h @@ -31,6 +31,7 @@ int parse_time_string(char *val); void enable_trace_mark(void); void tracemark(char *fmt, ...) __attribute__((format(printf, 1, 2))); +void disable_trace_mark(void); #define MSEC_PER_SEC 1000 #define USEC_PER_SEC 1000000 diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c index 85d41b9542a2..a30e1e4ce436 100644 --- a/src/lib/rt-utils.c +++ b/src/lib/rt-utils.c @@ -390,6 +390,15 @@ static void open_tracemark_fd(void) } } +static void close_tracemark_fd(void) +{ + if (tracemark_fd > 0) + close(tracemark_fd); + + if (trace_fd > 0) + close(trace_fd); +} + static int trace_file_exists(char *name) { struct stat sbuf; @@ -437,3 +446,8 @@ void enable_trace_mark(void) debugfs_prepare(); open_tracemark_fd(); } + +void disable_trace_mark(void) +{ + close_tracemark_fd(); +} -- 2.26.2