On Wed, 14 Aug 2019 11:47:08 +0300 "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@xxxxxxxxx> wrote: > tracecmd_stack_tracer_status() function reads the stack tracer status > from the proc file system. It does not depend on trace-cmd context and > can be used standalone. The function is moved from trace-cmd application > into libtracecmd. > > Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@xxxxxxxxx> > --- > lib/trace-cmd/trace-util.c | 49 +++++++++++++++++++++++++++++++++ > tracecmd/trace-stack.c | 56 ++------------------------------------ > 2 files changed, 51 insertions(+), 54 deletions(-) > > diff --git a/lib/trace-cmd/trace-util.c b/lib/trace-cmd/trace-util.c > index 8c1a0a0..d16a018 100644 > --- a/lib/trace-cmd/trace-util.c > +++ b/lib/trace-cmd/trace-util.c > @@ -25,6 +25,7 @@ > #define LOCAL_PLUGIN_DIR ".trace-cmd/plugins" > #define TRACEFS_PATH "/sys/kernel/tracing" > #define DEBUGFS_PATH "/sys/kernel/debug" > +#define PROC_STACK_FILE "/proc/sys/kernel/stack_tracer_enabled" > > int tracecmd_disable_sys_plugins; > int tracecmd_disable_plugins; > @@ -1787,3 +1788,51 @@ int trace_set_log_file(char *logfile) > return 0; > } > > +/** > + * tracecmd_stack_tracer_status - Check stack trace status > + * @status: Returned stack trace status: > + * 0 - not configured, disabled > + * non 0 - enabled > + * > + * Returns -1 in case of an error, 0 if file does not exist > + * (stack tracer not enabled) or 1 on successful completion. "(stack tracer not configured in kernel)" Saying "enabled" is ambiguous. > + */ > +int tracecmd_stack_tracer_status(int *status) If we are making this a library function, shouldn't it be declared in the trace-cmd.h file? -- Steve