From f48b9e915be5795eba774570d8664d602973a00f Mon Sep 17 00:00:00 2001 From: jxy_git Date: Sun, 25 Jun 2023 14:40:45 +0800 Subject: [PATCH] Implemented tracking of short-lived files --- observation/src/filelife/filelife.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 observation/src/filelife/filelife.c diff --git a/observation/src/filelife/filelife.c b/observation/src/filelife/filelife.c new file mode 100644 index 00000000..5db3060e --- /dev/null +++ b/observation/src/filelife/filelife.c @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) +#include "commons.h" +#include "filelife.h" +#include "filelife.skel.h" +#include "btf_helpers.h" +#include "trace_helpers.h" + +static volatile sig_atomic_t exiting; +static volatile bool verbose = false; +static volatile pid_t pid = 0; + +const char *argp_program_version = "filelife 0.1"; +const char *argp_program_bug_address = "Jackie Liu "; +const char argp_program_doc[] = +"Trace the lifespan of short-lived files.\n" +"\n" +"USAGE: filelife [--help] [-p PID]\n" +"\n" +"EXAMPLES:\n" +" filelife # trace all events\n" +" filelife -p 123 # trace pid 123\n"; + +static const struct argp_option opts[] = { + { "pid", 'p', "PID", 0, "Process PID to trace" }, + { "verbose", 'v', NULL, 0, "Verbose debug output" }, + { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" }, + {} +}; -- Gitee