Lines Matching refs:sc
298 ({ struct syscall_tp *sc = evsel->priv;\
299 perf_evsel__init_tp_uint_field(evsel, &sc->name, #name); })
314 ({ struct syscall_tp *sc = evsel->priv;\
315 perf_evsel__init_tp_ptr_field(evsel, &sc->name, #name); })
325 struct syscall_tp *sc = evsel->priv = malloc(sizeof(struct syscall_tp)); in perf_evsel__init_syscall_tp() local
328 if (perf_evsel__init_tp_uint_field(evsel, &sc->id, "__syscall_nr") && in perf_evsel__init_syscall_tp()
329 perf_evsel__init_tp_uint_field(evsel, &sc->id, "nr")) in perf_evsel__init_syscall_tp()
342 struct syscall_tp *sc = evsel->priv = malloc(sizeof(struct syscall_tp)); in perf_evsel__init_augmented_syscall_tp() local
350 if (__tp_field__init_uint(&sc->id, syscall_id->size, syscall_id->offset, evsel->needs_swap)) in perf_evsel__init_augmented_syscall_tp()
364 struct syscall_tp *sc = evsel->priv; in perf_evsel__init_augmented_syscall_tp_args() local
366 return __tp_field__init_ptr(&sc->args, sc->id.offset + sizeof(u64)); in perf_evsel__init_augmented_syscall_tp_args()
371 struct syscall_tp *sc = evsel->priv; in perf_evsel__init_augmented_syscall_tp_ret() local
373 …return __tp_field__init_uint(&sc->ret, sizeof(u64), sc->id.offset + sizeof(u64), evsel->needs_swap… in perf_evsel__init_augmented_syscall_tp_ret()
1444 static int syscall__alloc_arg_fmts(struct syscall *sc, int nr_args) in syscall__alloc_arg_fmts() argument
1448 if (nr_args == RAW_SYSCALL_ARGS_NUM && sc->fmt && sc->fmt->nr_args != 0) in syscall__alloc_arg_fmts()
1449 nr_args = sc->fmt->nr_args; in syscall__alloc_arg_fmts()
1451 sc->arg_fmt = calloc(nr_args, sizeof(*sc->arg_fmt)); in syscall__alloc_arg_fmts()
1452 if (sc->arg_fmt == NULL) in syscall__alloc_arg_fmts()
1456 if (sc->fmt) in syscall__alloc_arg_fmts()
1457 sc->arg_fmt[idx] = sc->fmt->arg[idx]; in syscall__alloc_arg_fmts()
1460 sc->nr_args = nr_args; in syscall__alloc_arg_fmts()
1534 static int syscall__set_arg_fmts(struct syscall *sc) in syscall__set_arg_fmts() argument
1536 struct tep_format_field *last_field = syscall_arg_fmt__init_array(sc->arg_fmt, sc->args); in syscall__set_arg_fmts()
1539 sc->args_size = last_field->offset + last_field->size; in syscall__set_arg_fmts()
1547 struct syscall *sc; in trace__read_syscall_info() local
1551 trace->syscalls.table = calloc(trace->sctbl->syscalls.max_id + 1, sizeof(*sc)); in trace__read_syscall_info()
1556 sc = trace->syscalls.table + id; in trace__read_syscall_info()
1557 if (sc->nonexistent) in trace__read_syscall_info()
1561 sc->nonexistent = true; in trace__read_syscall_info()
1565 sc->name = name; in trace__read_syscall_info()
1566 sc->fmt = syscall_fmt__find(sc->name); in trace__read_syscall_info()
1568 snprintf(tp_name, sizeof(tp_name), "sys_enter_%s", sc->name); in trace__read_syscall_info()
1569 sc->tp_format = trace_event__tp_format("syscalls", tp_name); in trace__read_syscall_info()
1571 if (IS_ERR(sc->tp_format) && sc->fmt && sc->fmt->alias) { in trace__read_syscall_info()
1572 snprintf(tp_name, sizeof(tp_name), "sys_enter_%s", sc->fmt->alias); in trace__read_syscall_info()
1573 sc->tp_format = trace_event__tp_format("syscalls", tp_name); in trace__read_syscall_info()
1580 if (IS_ERR(sc->tp_format)) { in trace__read_syscall_info()
1581 sc->nonexistent = true; in trace__read_syscall_info()
1582 return PTR_ERR(sc->tp_format); in trace__read_syscall_info()
1585 if (syscall__alloc_arg_fmts(sc, IS_ERR(sc->tp_format) ? in trace__read_syscall_info()
1586 RAW_SYSCALL_ARGS_NUM : sc->tp_format->format.nr_fields)) in trace__read_syscall_info()
1589 sc->args = sc->tp_format->format.fields; in trace__read_syscall_info()
1595 if (sc->args && (!strcmp(sc->args->name, "__syscall_nr") || !strcmp(sc->args->name, "nr"))) { in trace__read_syscall_info()
1596 sc->args = sc->args->next; in trace__read_syscall_info()
1597 --sc->nr_args; in trace__read_syscall_info()
1600 sc->is_exit = !strcmp(name, "exit_group") || !strcmp(name, "exit"); in trace__read_syscall_info()
1601 sc->is_open = !strcmp(name, "open") || !strcmp(name, "openat"); in trace__read_syscall_info()
1603 return syscall__set_arg_fmts(sc); in trace__read_syscall_info()
1631 const char *sc = pos->s; in trace__validate_ev_qualifier() local
1632 int id = syscalltbl__id(trace->sctbl, sc), match_next = -1; in trace__validate_ev_qualifier()
1635 id = syscalltbl__strglobmatch_first(trace->sctbl, sc, &match_next); in trace__validate_ev_qualifier()
1646 pr_debug("%s", sc); in trace__validate_ev_qualifier()
1655 id = syscalltbl__strglobmatch_next(trace->sctbl, sc, &match_next); in trace__validate_ev_qualifier()
1720 static size_t syscall__scnprintf_name(struct syscall *sc, char *bf, size_t size, in syscall__scnprintf_name() argument
1723 if (sc->arg_fmt && sc->arg_fmt[arg->idx].name) in syscall__scnprintf_name()
1724 return scnprintf(bf, size, "%s: ", sc->arg_fmt[arg->idx].name); in syscall__scnprintf_name()
1734 static unsigned long syscall__mask_val(struct syscall *sc, struct syscall_arg *arg, unsigned long v… in syscall__mask_val() argument
1736 if (sc->arg_fmt && sc->arg_fmt[arg->idx].mask_val) in syscall__mask_val()
1737 return sc->arg_fmt[arg->idx].mask_val(arg, val); in syscall__mask_val()
1742 static size_t syscall__scnprintf_val(struct syscall *sc, char *bf, size_t size, in syscall__scnprintf_val() argument
1745 if (sc->arg_fmt && sc->arg_fmt[arg->idx].scnprintf) { in syscall__scnprintf_val()
1747 if (sc->arg_fmt[arg->idx].parm) in syscall__scnprintf_val()
1748 arg->parm = sc->arg_fmt[arg->idx].parm; in syscall__scnprintf_val()
1749 return sc->arg_fmt[arg->idx].scnprintf(bf, size, arg); in syscall__scnprintf_val()
1754 static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size, in syscall__scnprintf_args() argument
1782 if (sc->args != NULL) { in syscall__scnprintf_args()
1785 for (field = sc->args; field; in syscall__scnprintf_args()
1790 arg.fmt = &sc->arg_fmt[arg.idx]; in syscall__scnprintf_args()
1796 val = syscall__mask_val(sc, &arg, val); in syscall__scnprintf_args()
1805 !(sc->arg_fmt && in syscall__scnprintf_args()
1806 (sc->arg_fmt[arg.idx].show_zero || in syscall__scnprintf_args()
1807 sc->arg_fmt[arg.idx].scnprintf == SCA_STRARRAY || in syscall__scnprintf_args()
1808 sc->arg_fmt[arg.idx].scnprintf == SCA_STRARRAYS) && in syscall__scnprintf_args()
1809 sc->arg_fmt[arg.idx].parm)) in syscall__scnprintf_args()
1817 printed += syscall__scnprintf_val(sc, bf + printed, size - printed, &arg, val); in syscall__scnprintf_args()
1819 } else if (IS_ERR(sc->tp_format)) { in syscall__scnprintf_args()
1825 while (arg.idx < sc->nr_args) { in syscall__scnprintf_args()
1831 printed += syscall__scnprintf_name(sc, bf + printed, size - printed, &arg); in syscall__scnprintf_args()
1832 printed += syscall__scnprintf_val(sc, bf + printed, size - printed, &arg, val); in syscall__scnprintf_args()
1967 static void *syscall__augmented_args(struct syscall *sc, struct perf_sample *sample, int *augmented… in syscall__augmented_args() argument
1984 int args_size = raw_augmented_args_size ?: sc->args_size; in syscall__augmented_args()
2004 struct syscall *sc = trace__syscall_info(trace, evsel, id); in trace__sys_enter() local
2007 if (sc == NULL) in trace__sys_enter()
2038 …augmented_args = syscall__augmented_args(sc, sample, &augmented_args_size, trace->raw_augmented_sy… in trace__sys_enter()
2041 printed += scnprintf(msg + printed, trace__entry_str_size - printed, "%s(", sc->name); in trace__sys_enter()
2043 printed += syscall__scnprintf_args(sc, msg + printed, trace__entry_str_size - printed, in trace__sys_enter()
2046 if (sc->is_exit) { in trace__sys_enter()
2078 struct syscall *sc = trace__syscall_info(trace, evsel, id); in trace__fprintf_sys_enter() local
2083 if (sc == NULL) in trace__fprintf_sys_enter()
2096 …augmented_args = syscall__augmented_args(sc, sample, &augmented_args_size, trace->raw_augmented_sy… in trace__fprintf_sys_enter()
2097 …syscall__scnprintf_args(sc, msg, sizeof(msg), args, augmented_args, augmented_args_size, trace, th… in trace__fprintf_sys_enter()
2151 struct syscall *sc = trace__syscall_info(trace, evsel, id); in trace__sys_exit() local
2154 if (sc == NULL) in trace__sys_exit()
2169 if (!trace->fd_path_disabled && sc->is_open && ret >= 0 && ttrace->filename.pending_open) { in trace__sys_exit()
2203 printed += fprintf(trace->output, "]: %s()", sc->name); in trace__sys_exit()
2215 if (sc->fmt == NULL) { in trace__sys_exit()
2228 } else if (ret == 0 && sc->fmt->timeout) in trace__sys_exit()
2240 } else if (sc->fmt->hexret) in trace__sys_exit()
2242 else if (sc->fmt->errpid) { in trace__sys_exit()
2435 struct syscall *sc = trace__syscall_info(trace, evsel, id); in trace__event_handler() local
2437 if (sc) { in trace__event_handler()
2438 fprintf(trace->output, "%s(", sc->name); in trace__event_handler()
2846 static struct bpf_program *trace__find_syscall_bpf_prog(struct trace *trace, struct syscall *sc, in trace__find_syscall_bpf_prog() argument
2853 scnprintf(default_prog_name, sizeof(default_prog_name), "!syscalls:sys_%s_%s", type, sc->name); in trace__find_syscall_bpf_prog()
2857 if (sc->fmt && sc->fmt->alias) { in trace__find_syscall_bpf_prog()
2858 …scnprintf(default_prog_name, sizeof(default_prog_name), "!syscalls:sys_%s_%s", type, sc->fmt->alia… in trace__find_syscall_bpf_prog()
2874 prog_name, type, sc->name); in trace__find_syscall_bpf_prog()
2881 struct syscall *sc = trace__syscall_info(trace, NULL, id); in trace__init_syscall_bpf_progs() local
2883 if (sc == NULL) in trace__init_syscall_bpf_progs()
2886 …sc->bpf_prog.sys_enter = trace__find_syscall_bpf_prog(trace, sc, sc->fmt ? sc->fmt->bpf_prog_name.… in trace__init_syscall_bpf_progs()
2887 …sc->bpf_prog.sys_exit = trace__find_syscall_bpf_prog(trace, sc, sc->fmt ? sc->fmt->bpf_prog_name.… in trace__init_syscall_bpf_progs()
2892 struct syscall *sc = trace__syscall_info(trace, NULL, id); in trace__bpf_prog_sys_enter_fd() local
2893 …return sc ? bpf_program__fd(sc->bpf_prog.sys_enter) : bpf_program__fd(trace->syscalls.unaugmented_… in trace__bpf_prog_sys_enter_fd()
2898 struct syscall *sc = trace__syscall_info(trace, NULL, id); in trace__bpf_prog_sys_exit_fd() local
2899 …return sc ? bpf_program__fd(sc->bpf_prog.sys_exit) : bpf_program__fd(trace->syscalls.unaugmented_p… in trace__bpf_prog_sys_exit_fd()
2904 struct syscall *sc = trace__syscall_info(trace, NULL, id); in trace__init_bpf_map_syscall_args() local
2907 if (sc == NULL) in trace__init_bpf_map_syscall_args()
2910 for (; arg < sc->nr_args; ++arg) { in trace__init_bpf_map_syscall_args()
2912 if (sc->arg_fmt[arg].scnprintf == SCA_FILENAME) { in trace__init_bpf_map_syscall_args()
2976 …atic struct bpf_program *trace__find_usable_bpf_prog_entry(struct trace *trace, struct syscall *sc) in trace__find_usable_bpf_prog_entry() argument
2984 for (field = sc->args; field; field = field->next) { in trace__find_usable_bpf_prog_entry()
2997 if (pair == NULL || pair == sc || in trace__find_usable_bpf_prog_entry()
3001 for (field = sc->args, candidate_field = pair->args; in trace__find_usable_bpf_prog_entry()
3055 pr_debug("Reusing \"%s\" BPF sys_enter augmenter for \"%s\"\n", pair->name, sc->name); in trace__find_usable_bpf_prog_entry()
3118 struct syscall *sc = trace__syscall_info(trace, NULL, key); in trace__init_syscalls_bpf_prog_array_maps() local
3122 if (sc == NULL || sc->bpf_prog.sys_enter == NULL) in trace__init_syscalls_bpf_prog_array_maps()
3129 if (sc->bpf_prog.sys_enter != trace->syscalls.unaugmented_prog) in trace__init_syscalls_bpf_prog_array_maps()
3136 pair_prog = trace__find_usable_bpf_prog_entry(trace, sc); in trace__init_syscalls_bpf_prog_array_maps()
3140 sc->bpf_prog.sys_enter = pair_prog; in trace__init_syscalls_bpf_prog_array_maps()
3146 prog_fd = bpf_program__fd(sc->bpf_prog.sys_enter); in trace__init_syscalls_bpf_prog_array_maps()
3734 struct syscall *sc; in thread__dump_stats() local
3759 sc = &trace->syscalls.table[syscall_stats_entry->syscall]; in thread__dump_stats()
3760 printed += fprintf(fp, " %-15s", sc->name); in thread__dump_stats()
3933 struct syscall_tp *sc = evsel->priv; in evlist__set_syscall_tp_fields() local
3935 if (__tp_field__init_ptr(&sc->args, sc->id.offset + sizeof(u64))) in evlist__set_syscall_tp_fields()
3938 struct syscall_tp *sc = evsel->priv; in evlist__set_syscall_tp_fields() local
3940 if (__tp_field__init_uint(&sc->ret, sizeof(u64), sc->id.offset + sizeof(u64), evsel->needs_swap)) in evlist__set_syscall_tp_fields()
4399 struct syscall_tp *sc; in cmd_trace() local
4403 sc = evsel->priv; in cmd_trace()
4424 trace.raw_augmented_syscalls_args_size = (6 + 1) * sizeof(long) + sc->id.offset; in cmd_trace()