Remove variable tracing_paths and check in pathtrace_match
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
7239dbcf2d
commit
38cfe7c923
4
defs.h
4
defs.h
@ -523,7 +523,9 @@ extern bool Tflag;
|
||||
extern bool qflag;
|
||||
extern bool not_failing_only;
|
||||
extern bool show_fd_path;
|
||||
extern bool tracing_paths;
|
||||
/* are we filtering traces based on paths? */
|
||||
extern const char **paths_selected;
|
||||
#define tracing_paths (paths_selected != NULL)
|
||||
extern bool need_fork_exec_workarounds;
|
||||
extern unsigned xflag;
|
||||
extern unsigned followfork;
|
||||
|
13
pathtrace.c
13
pathtrace.c
@ -37,7 +37,7 @@
|
||||
|
||||
#include "syscall.h"
|
||||
|
||||
static const char **selected = NULL; /* paths selected for tracing */
|
||||
const char **paths_selected = NULL;
|
||||
static unsigned num_selected = 0;
|
||||
|
||||
/*
|
||||
@ -49,7 +49,7 @@ pathmatch(const char *path)
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < num_selected; ++i) {
|
||||
if (strcmp(path, selected[i]) == 0)
|
||||
if (strcmp(path, paths_selected[i]) == 0)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@ -91,10 +91,10 @@ storepath(const char *path)
|
||||
return; /* already in table */
|
||||
|
||||
i = num_selected++;
|
||||
selected = realloc(selected, num_selected * sizeof(selected[0]));
|
||||
if (!selected)
|
||||
paths_selected = realloc(paths_selected, num_selected * sizeof(paths_selected[0]));
|
||||
if (!paths_selected)
|
||||
die_out_of_memory();
|
||||
selected[i] = path;
|
||||
paths_selected[i] = path;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -154,9 +154,6 @@ pathtrace_match(struct tcb *tcp)
|
||||
{
|
||||
const struct_sysent *s;
|
||||
|
||||
if (!selected)
|
||||
return 1;
|
||||
|
||||
s = tcp->s_ent;
|
||||
|
||||
if (!(s->sys_flags & (TRACE_FILE | TRACE_DESC)))
|
||||
|
4
strace.c
4
strace.c
@ -123,9 +123,6 @@ bool not_failing_only = 0;
|
||||
/* Show path associated with fd arguments */
|
||||
bool show_fd_path = 0;
|
||||
|
||||
/* are we filtering traces based on paths? */
|
||||
bool tracing_paths = 0;
|
||||
|
||||
static bool detach_on_execve = 0;
|
||||
static bool skip_startup_execve = 0;
|
||||
|
||||
@ -1648,7 +1645,6 @@ init(int argc, char *argv[])
|
||||
process_opt_p_list(optarg);
|
||||
break;
|
||||
case 'P':
|
||||
tracing_paths = 1;
|
||||
pathtrace_select(optarg);
|
||||
break;
|
||||
case 's':
|
||||
|
Loading…
Reference in New Issue
Block a user