forked from luck/tmp_suning_uos_patched
perf augmented_raw_syscalls: Move the probe_read_str to a separate function
One more step into copying multiple filenames to support syscalls like rename*. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Brendan Gregg <brendan.d.gregg@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lkml.kernel.org/n/tip-xdqtjexdyp81oomm1rkzeifl@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
4cae8675ea
commit
0c95a7ff76
|
@ -60,11 +60,27 @@ struct augmented_args_filename {
|
||||||
|
|
||||||
bpf_map(augmented_filename_map, PERCPU_ARRAY, int, struct augmented_args_filename, 1);
|
bpf_map(augmented_filename_map, PERCPU_ARRAY, int, struct augmented_args_filename, 1);
|
||||||
|
|
||||||
|
static inline
|
||||||
|
unsigned int augmented_args__read_filename(struct augmented_args_filename *augmented_args,
|
||||||
|
const void *filename_arg, unsigned int filename_len)
|
||||||
|
{
|
||||||
|
unsigned int len = sizeof(*augmented_args);
|
||||||
|
|
||||||
|
augmented_args->filename.reserved = 0;
|
||||||
|
augmented_args->filename.size = probe_read_str(&augmented_args->filename.value, filename_len, filename_arg);
|
||||||
|
if (augmented_args->filename.size < sizeof(augmented_args->filename.value)) {
|
||||||
|
len -= sizeof(augmented_args->filename.value) - augmented_args->filename.size;
|
||||||
|
len &= sizeof(augmented_args->filename.value) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
SEC("raw_syscalls:sys_enter")
|
SEC("raw_syscalls:sys_enter")
|
||||||
int sys_enter(struct syscall_enter_args *args)
|
int sys_enter(struct syscall_enter_args *args)
|
||||||
{
|
{
|
||||||
struct augmented_args_filename *augmented_args;
|
struct augmented_args_filename *augmented_args;
|
||||||
unsigned int len = sizeof(*augmented_args), filename_len;
|
unsigned int len, filename_len;
|
||||||
const void *filename_arg = NULL;
|
const void *filename_arg = NULL;
|
||||||
struct syscall *syscall;
|
struct syscall *syscall;
|
||||||
int key = 0;
|
int key = 0;
|
||||||
|
@ -182,14 +198,7 @@ processed 46 insns (limit 1000000) max_states_per_insn 0 total_states 12 peak_st
|
||||||
loop_iter_last(5)
|
loop_iter_last(5)
|
||||||
|
|
||||||
if (filename_arg != NULL && filename_len <= sizeof(augmented_args->filename.value)) {
|
if (filename_arg != NULL && filename_len <= sizeof(augmented_args->filename.value)) {
|
||||||
augmented_args->filename.reserved = 0;
|
len = augmented_args__read_filename(augmented_args, filename_arg, filename_len);
|
||||||
augmented_args->filename.size = probe_read_str(&augmented_args->filename.value,
|
|
||||||
filename_len,
|
|
||||||
filename_arg);
|
|
||||||
if (augmented_args->filename.size < sizeof(augmented_args->filename.value)) {
|
|
||||||
len -= sizeof(augmented_args->filename.value) - augmented_args->filename.size;
|
|
||||||
len &= sizeof(augmented_args->filename.value) - 1;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
len = sizeof(augmented_args->args);
|
len = sizeof(augmented_args->args);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user