Optimize default filtering
* filter_action.c (default_flags): Add default flags variable. (add_action): Update default flags. (filter_syscall): Add default_flags to qual_flg. (filtering_parse_finish): Init trace action for pathtracing. * strace.c (init): Remove default filters.
This commit is contained in:
parent
70a8481f6d
commit
7d93fbe00e
@ -62,6 +62,7 @@ struct filter_action {
|
|||||||
void *priv_data;
|
void *priv_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static unsigned int default_flags = DEFAULT_QUAL_FLAGS;
|
||||||
static struct filter_action *filter_actions;
|
static struct filter_action *filter_actions;
|
||||||
static unsigned int nfilter_actions;
|
static unsigned int nfilter_actions;
|
||||||
|
|
||||||
@ -141,6 +142,10 @@ add_action(const struct filter_action_type *type)
|
|||||||
{
|
{
|
||||||
struct filter_action *action;
|
struct filter_action *action;
|
||||||
|
|
||||||
|
/* Update default_flags */
|
||||||
|
if (default_flags & type->qual_flg)
|
||||||
|
default_flags &= ~type->qual_flg;
|
||||||
|
|
||||||
filter_actions = xreallocarray(filter_actions, ++nfilter_actions,
|
filter_actions = xreallocarray(filter_actions, ++nfilter_actions,
|
||||||
sizeof(struct filter_action));
|
sizeof(struct filter_action));
|
||||||
action = &filter_actions[nfilter_actions - 1];
|
action = &filter_actions[nfilter_actions - 1];
|
||||||
@ -200,6 +205,7 @@ filter_syscall(struct tcb *tcp)
|
|||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
tcp->qual_flg |= default_flags;
|
||||||
for (i = 0; i < nfilter_actions; ++i)
|
for (i = 0; i < nfilter_actions; ++i)
|
||||||
run_filter_action(tcp, &filter_actions[i]);
|
run_filter_action(tcp, &filter_actions[i]);
|
||||||
}
|
}
|
||||||
|
3
strace.c
3
strace.c
@ -1570,9 +1570,6 @@ init(int argc, char *argv[])
|
|||||||
shared_log = stderr;
|
shared_log = stderr;
|
||||||
set_sortby(DEFAULT_SORTBY);
|
set_sortby(DEFAULT_SORTBY);
|
||||||
set_personality(DEFAULT_PERSONALITY);
|
set_personality(DEFAULT_PERSONALITY);
|
||||||
qualify("trace=all");
|
|
||||||
qualify("abbrev=all");
|
|
||||||
qualify("verbose=all");
|
|
||||||
#if DEFAULT_QUAL_FLAGS != (QUAL_TRACE | QUAL_ABBREV | QUAL_VERBOSE)
|
#if DEFAULT_QUAL_FLAGS != (QUAL_TRACE | QUAL_ABBREV | QUAL_VERBOSE)
|
||||||
# error Bug in DEFAULT_QUAL_FLAGS
|
# error Bug in DEFAULT_QUAL_FLAGS
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user