Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
⌀
Function
large_stringlengths
11
3.45k
Label
list
Linux Kernel
tools/bpf/bpftool/json_writer.c
void jsonw_end_object(json_writer_t *self) { jsonw_end(self, '}'); }
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/json_writer.c
void jsonw_null(json_writer_t *self) { jsonw_printf(self, "null"); }
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/json_writer.c
void jsonw_float_fmt(json_writer_t *self, const char *fmt, double num) { jsonw_printf(self, fmt, num); } #ifdef notused
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/json_writer.c
void jsonw_float(json_writer_t *self, double num) { jsonw_printf(self, "%g", num); } #endif
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/json_writer.c
void jsonw_lluint(json_writer_t *self, unsigned long long int num) { jsonw_printf(self, "%llu", num); }
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/json_writer.c
void jsonw_float_field_fmt(json_writer_t *self, const char *prop, const char *fmt, double val) { jsonw_name(self, prop); jsonw_float_fmt(self, fmt, val); }
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/link.c
static const char *cgroup_order_string(__u32 order) { switch (order) { case BPF_CGROUP_ITER_ORDER_UNSPEC: return "order_unspec"; case BPF_CGROUP_ITER_SELF_ONLY: return "self_only"; case BPF_CGROUP_ITER_DESCENDANTS_PRE: return "descendants_pre"; case BPF_CGROUP_ITER_DESCENDANTS_POST: return "de...
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/link.c
static bool is_iter_task_target(const char *target_name) { return strcmp(target_name, "task") == 0 || strcmp(target_name, "task_file") == 0 || strcmp(target_name, "task_vma") == 0; }
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/link.c
static void show_link_header_plain(struct bpf_link_info *info) { const char *link_type_str; printf("%u: ", info->id); link_type_str = libbpf_bpf_link_type_str(info->type); if (link_type_str) printf("%s ", link_type_str); else printf("type %u ", info->type); printf("prog %u ", info->prog_id); }
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/link.c
static void show_iter_plain(struct bpf_link_info *info) { const char *target_name = u64_to_ptr(info->iter.target_name); printf("target_name %s ", target_name); if (is_iter_map_target(target_name)) printf("map_id %u ", info->iter.map.map_id); else if (is_iter_task_target(target_name)) { if (info->it...
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/link.c
static int do_show(int argc, char **argv) { __u32 id = 0; int err, fd; if (show_pinned) { link_table = hashmap__new(hash_fn_for_key_as_id, equal_fn_for_key_as_id, NULL); if (IS_ERR(link_table)) { p_err("failed to create hashmap for pinned paths"); return -1; } build_pinned_ob...
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/main.c
void fprint_hex(FILE *f, void *arg, unsigned int n, const char *sep) { unsigned char *data = arg; unsigned int i; for (i = 0; i < n; i++) { const char *pfx = ""; if (!i) ; else if (!(i % 16)) fprintf(f, "\n"); else if (!(i % 8)) fprintf(f, " "); else pfx = sep; ...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/main.h
static inline __u64 ptr_to_u64(const void *ptr) { return (__u64)(unsigned long)ptr; }
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/main.h
static inline void *u64_to_ptr(__u64 ptr) { return (void *)(unsigned long)ptr; } #define NEXT_ARG() \ ({ \ argc--; ...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/main.h
static inline int disasm_print_insn(unsigned char *image, ssize_t len, int opcodes, const char *arch, const char *disassembler_options, const struct btf *btf, const struct bpf_...
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/map.c
static bool map_is_map_of_maps(__u32 type) { return type == BPF_MAP_TYPE_ARRAY_OF_MAPS || type == BPF_MAP_TYPE_HASH_OF_MAPS; }
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/map.c
static int do_dump_btf(const struct btf_dumper *d, struct bpf_map_info *map_info, void *key, void *value) { __u32 value_id; int ret = 0; jsonw_start_object(d->jw); if (map_info->btf_key_type_id) { jsonw_name(d->jw, "key"); ret = btf_dumper_type(d, map_info->btf_key_type_id, key...
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/map.c
static void print_entry_error_msg(struct bpf_map_info *info, unsigned char *key, const char *error_msg) { int msg_size = strlen(error_msg); bool single_line, break_names; break_names = info->key_size > 16 || msg_size > 16; single_line = info->key_size + msg_size <= 24 && !bre...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/map.c
static void show_map_header_json(struct bpf_map_info *info, json_writer_t *wtr) { const char *map_type_str; jsonw_uint_field(wtr, "id", info->id); map_type_str = libbpf_bpf_map_type_str(info->type); if (map_type_str) jsonw_string_field(wtr, "type", map_type_str); else ...
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/map.c
static int show_map_close_plain(int fd, struct bpf_map_info *info) { char *memlock, *frozen_str; int frozen = 0; memlock = get_fdinfo(fd, "memlock"); frozen_str = get_fdinfo(fd, "frozen"); show_map_header_plain(info); printf("\tkey %uB value %uB max_entries %u", info->key_size, info->value_siz...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/map.c
static int do_show_subset(int argc, char **argv) { struct bpf_map_info info = {}; __u32 len = sizeof(info); int *fds = NULL; int nb_fds, i; int err = -1; fds = malloc(sizeof(int)); if (!fds) { p_err("mem alloc failed"); return -1; } nb_fds = map_parse_fds(&argc, &argv, &fds); if (nb_fds < 1...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/map.c
static int map_dump(int fd, struct bpf_map_info *info, json_writer_t *wtr, bool show_header) { void *key, *value, *prev_key; unsigned int num_elems = 0; struct btf *btf = NULL; int err; key = malloc(info->key_size); value = alloc_value(info); if (!key || !value) { p_err("mem alloc...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/map.c
static void print_key_value(struct bpf_map_info *info, void *key, void *value) { json_writer_t *btf_wtr; struct btf *btf; if (get_map_kv_btf(info, &btf)) return; if (json_output) { print_entry_json(info, key, value, btf); } else if (btf) { btf_wtr = get_btf_writer(); if (!btf_wtr) { p...
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/map.c
static int do_lookup(int argc, char **argv) { struct bpf_map_info info = {}; __u32 len = sizeof(info); void *key, *value; int err; int fd; if (argc < 2) usage(); fd = map_parse_fd_and_info(&argc, &argv, &info, &len); if (fd < 0) return -1; err = alloc_key_value(&info, &key, &value); if (e...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/map.c
static int do_getnext(int argc, char **argv) { struct bpf_map_info info = {}; __u32 len = sizeof(info); void *key, *nextkey; int err; int fd; if (argc < 2) usage(); fd = map_parse_fd_and_info(&argc, &argv, &info, &len); if (fd < 0) return -1; key = malloc(info.key_size); nextkey = malloc...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/map.c
static int do_delete(int argc, char **argv) { struct bpf_map_info info = {}; __u32 len = sizeof(info); void *key; int err; int fd; if (argc < 2) usage(); fd = map_parse_fd_and_info(&argc, &argv, &info, &len); if (fd < 0) return -1; key = malloc(info.key_size); if (!key) { p_err("mem ...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/map.c
static int do_pop_dequeue(int argc, char **argv) { struct bpf_map_info info = {}; __u32 len = sizeof(info); void *key, *value; int err; int fd; if (argc < 2) usage(); fd = map_parse_fd_and_info(&argc, &argv, &info, &len); if (fd < 0) return -1; err = alloc_key_value(&info, &key, &value); ...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/map.c
int do_map(int argc, char **argv) { return cmd_select(cmds, argc, argv, do_help); }
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/net.c
static int netlink_get_qdisc(int sock, unsigned int nl_pid, int ifindex, dump_nlmsg_t dump_qdisc_nlmsg, void *cookie) { struct { struct nlmsghdr nlh; struct tcmsg t; } req = { .nlh.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)), .nlh.nlmsg_type = RTM_GETQDISC, ...
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/net.c
static int netlink_get_filter(int sock, unsigned int nl_pid, int ifindex, int handle, dump_nlmsg_t dump_filter_nlmsg, void *cookie) { struct { struct nlmsghdr nlh; struct tcmsg t; } req = { .nlh.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg))...
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/net.c
static int __dump_link_nlmsg(struct nlmsghdr *nlh, dump_nlmsg_t dump_link_nlmsg, void *cookie) { struct nlattr *tb[IFLA_MAX + 1], *attr; struct ifinfomsg *ifi = NLMSG_DATA(nlh); int len; len = nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*ifi)); attr = (struct nlattr *)((void *)ifi + NL...
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/net.c
static int dump_class_qdisc_nlmsg(void *cookie, void *msg, struct nlattr **tb) { struct bpf_tcinfo_t *tcinfo = cookie; struct tcmsg *info = msg; if (tcinfo->is_qdisc) { if (tb[TCA_KIND] && strcmp(libbpf_nla_data(tb[TCA_KIND]), "clsact") == 0) return 0; if (info->tcm_handle == 0) return 0; ...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/net.c
static int do_attach_detach_xdp(int progfd, enum net_attach_type attach_type, int ifindex, bool overwrite) { __u32 flags = 0; if (!overwrite) flags = XDP_FLAGS_UPDATE_IF_NOEXIST; if (attach_type == NET_ATTACH_TYPE_XDP_GENERIC) flags |= XDP_FLAGS_SKB_MODE; if (attach_typ...
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/net.c
static int do_help(int argc, char **argv) { if (json_output) { jsonw_null(json_wtr); return 0; } fprintf( stderr, "Usage: %1$s %2$s { show | list } [dev <devname>]\n" " %1$s %2$s attach ATTACH_TYPE PROG dev <devname> [ overwrite ]\n" " %1$s %2$s detach ATTACH_TYPE dev...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/netlink_dumper.c
static void xdp_dump_prog_id(struct nlattr **tb, int attr, const char *mode, bool new_json_object) { if (!tb[attr]) return; if (new_json_object) NET_START_OBJECT NET_DUMP_STR("mode", " %s", mode); NET_DUMP_UINT("id", " id %u", libbpf_nla_getattr_u32(tb[attr])) if (new_js...
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/netlink_dumper.c
int do_xdp_dump(struct ifinfomsg *ifinfo, struct nlattr **tb) { if (!tb[IFLA_XDP]) return 0; return do_xdp_dump_one(tb[IFLA_XDP], ifinfo->ifi_index, libbpf_nla_getattr_str(tb[IFLA_IFNAME])); }
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/netlink_dumper.c
static int do_bpf_act_dump(struct nlattr *attr) { struct nlattr *tb[TCA_ACT_MAX_PRIO + 1]; int act, ret; if (libbpf_nla_parse_nested(tb, TCA_ACT_MAX_PRIO, attr, NULL) < 0) return -LIBBPF_ERRNO__NLPARSE; NET_START_ARRAY("act", " %s ["); for (act = 0; act <= TCA_ACT_MAX_PRIO; act++) { ret = do_dump_o...
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/prog.c
static bool has_metadata_prefix(const char *s) { return strncmp(s, BPF_METADATA_PREFIX, BPF_METADATA_PREFIX_LEN) == 0; }
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/prog.c
static int show_prog(int fd) { struct bpf_prog_info info = {}; __u32 len = sizeof(info); int err; err = bpf_obj_get_info_by_fd(fd, &info, &len); if (err) { p_err("can't get prog info: %s", strerror(errno)); return -1; } if (json_output) print_prog_json(&info, fd); else print_prog_plai...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/prog.c
static int map_replace_compar(const void *p1, const void *p2) { const struct map_replace *a = p1, *b = p2; return a->idx - b->idx; }
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/prog.c
static int check_single_stdin(char *file_data_in, char *file_ctx_in) { if (file_data_in && file_ctx_in && !strcmp(file_data_in, "-") && !strcmp(file_ctx_in, "-")) { p_err("cannot use standard input for both data_in and ctx_in"); return -1; } return 0; }
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/prog.c
static int get_run_data(const char *fname, void **data_ptr, unsigned int *size) { size_t block_size = 256; size_t buf_size = block_size; size_t nb_read = 0; void *tmp; FILE *f; if (!fname) { *data_ptr = NULL; *size = 0; return 0; } if (!strcmp(fname, "-")) f = s...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/prog.c
static int get_prog_type_by_name(const char *name, enum bpf_prog_type *prog_type, enum bpf_attach_type *expected_attach_type) { libbpf_print_fn_t print_backup; int ret; ret = libbpf_prog_type_by_name(name, prog_type, expected_attach_type); if (!...
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/prog.c
static int try_loader(struct gen_loader_opts *gen) { struct bpf_load_and_run_opts opts = {}; struct bpf_loader_ctx *ctx; int ctx_sz = sizeof(*ctx) + 64 * max(sizeof(struct bpf_map_desc), sizeof(struct bpf_prog_desc)); int log_buf_sz = (1u << 24) - 1; int err, fds_before...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/prog.c
static int do_loader(int argc, char **argv) { DECLARE_LIBBPF_OPTS(bpf_object_open_opts, open_opts); DECLARE_LIBBPF_OPTS(gen_loader_opts, gen); struct bpf_object *obj; const char *file; int err = 0; if (!REQ_ARGS(1)) return -1; file = GET_ARG(); if (verifier_logs) open_opts.kernel_log_level = ...
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/prog.c
static void profile_close_perf_events(struct profiler_bpf *obj) { int i; for (i = profile_perf_event_cnt - 1; i >= 0; i--) close(profile_perf_events[i]); free(profile_perf_events); profile_perf_event_cnt = 0; }
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/prog.c
static void profile_print_and_cleanup(void) { profile_close_perf_events(profile_obj); profile_read_values(profile_obj); profile_print_readings(); profiler_bpf__destroy(profile_obj); close(profile_tgt_fd); free(profile_tgt_name); }
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/skeleton/pid_iter.bpf.c
static __u64 get_bpf_cookie(struct bpf_link *link) { struct bpf_perf_link *perf_link; struct perf_event *event; perf_link = container_of(link, struct bpf_perf_link, link); event = BPF_CORE_READ(perf_link, perf_file, private_data); return BPF_CORE_READ(event, bpf_cookie); }
[ 0, 0 ]
Linux Kernel
tools/bpf/bpftool/skeleton/profiler.bpf.c
static inline void fexit_update_maps(u32 id, struct bpf_perf_event_value *after) { struct bpf_perf_event_value *before, diff; before = bpf_map_lookup_elem(&fentry_readings, &id); if (before && before->counter) { struct bpf_perf_event_value *accum; diff.counter = aft...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/skeleton/profiler.bpf.c
int BPF_PROG(fexit_XXX) { struct bpf_perf_event_value readings[MAX_NUM_MATRICS]; u32 cpu = bpf_get_smp_processor_id(); u32 i, zero = 0; int err; u64 *count; for (i = 0; i < num_metric && i < MAX_NUM_MATRICS; i++) { err = bpf_perf_event_read_value(&events, cpu + i * num_cpu, readings + i, ...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/struct_ops.c
static __s32 get_map_info_type_id(void) { const struct btf *kern_btf; if (map_info_type_id) return map_info_type_id; kern_btf = get_btf_vmlinux(); if (!kern_btf) return 0; map_info_type_id = btf__find_by_name_kind(kern_btf, "bpf_map_info", BTF_KIND_STRUCT); if (map_info_type_id < 0) { p...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/struct_ops.c
static int do_help(int argc, char **argv) { if (json_output) { jsonw_null(json_wtr); return 0; } fprintf(stderr, "Usage: %1$s %2$s { show | list } [STRUCT_OPS_MAP]\n" " %1$s %2$s dump [STRUCT_OPS_MAP]\n" " %1$s %2$s register OBJ\n" " %1$s %2$s un...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/tracelog.c
static int validate_tracefs_mnt(const char *mnt, unsigned long magic) { struct statfs st_fs; if (statfs(mnt, &st_fs) < 0) return -ENOENT; if ((unsigned long)st_fs.f_type != magic) return -ENOENT; return 0; }
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/tracelog.c
static bool find_tracefs_mnt_single(unsigned long magic, char *mnt, const char *mntpt) { size_t src_len; if (validate_tracefs_mnt(mntpt, magic)) return false; src_len = strlen(mntpt); if (src_len + 1 >= PATH_MAX) { p_err("tracefs mount point name too long"); re...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/tracelog.c
int do_tracelog(int argc, char **argv) { const struct sigaction act = {.sa_handler = exit_tracelog}; char trace_pipe[PATH_MAX]; size_t buff_len = 0; if (json_output) jsonw_start_array(json_wtr); if (!get_tracefs_pipe(trace_pipe)) return -1; trace_pipe_fd = fopen(trace_pipe, "r"); if (!trace_pi...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/xlated_dumper.c
static const char *print_call_pcrel(struct dump_data *dd, struct kernel_sym *sym, unsigned long address, const struct bpf_insn *insn) { if (!dd->nr_jited_ksyms) snprintf(dd->scratch_buff, sizeof(dd->scratc...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpftool/xlated_dumper.c
static const char *print_call(void *private_data, const struct bpf_insn *insn) { struct dump_data *dd = private_data; unsigned long address = dd->address_call_base + insn->imm; struct kernel_sym *sym; if (insn->src_reg == BPF_PSEUDO_CALL && (__u32)insn->imm < dd->nr_jited_ksyms && dd->jited_ksyms) a...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpf_dbg.c
static void hex_dump(const uint8_t *buf, size_t len) { int i; rl_printf("%3u: ", 0); for (i = 0; i < len; i++) { if (i && !(i % 16)) rl_printf("\n%3u: ", i); rl_printf("%02x ", buf[i]); } rl_printf("\n"); }
[ 0, 0 ]
Linux Kernel
tools/bpf/bpf_dbg.c
static void bpf_disasm_all(const struct sock_filter *f, unsigned int len) { unsigned int i; for (i = 0; i < len; i++) bpf_disasm(f[i], i); }
[ 0, 0 ]
Linux Kernel
tools/bpf/bpf_dbg.c
static void bpf_dump_breakpoints(void) { int i; rl_printf("breakpoints: "); for (i = 0; i < array_size(bpf_breakpoints); i++) { if (bpf_breakpoints[i] < 0) continue; rl_printf("%d ", bpf_breakpoints[i]); } rl_printf("\n"); }
[ 0, 0 ]
Linux Kernel
tools/bpf/bpf_dbg.c
static void bpf_reset(void) { bpf_regs_len = 0; memset(bpf_regs, 0, sizeof(bpf_regs)); memset(&bpf_curr, 0, sizeof(bpf_curr)); }
[ 1, 0 ]
Linux Kernel
tools/bpf/bpf_dbg.c
static void bpf_safe_regs(void) { memcpy(&bpf_regs[bpf_regs_len++], &bpf_curr, sizeof(bpf_curr)); }
[ 1, 0 ]
Linux Kernel
tools/bpf/bpf_dbg.c
static bool bpf_restore_regs(int off) { unsigned int index = bpf_regs_len - 1 + off; if (index == 0) { bpf_reset(); return true; } else if (index < bpf_regs_len) { memcpy(&bpf_curr, &bpf_regs[index], sizeof(bpf_curr)); bpf_regs_len = index; return true; } else { rl_printf("reached bott...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpf_dbg.c
static bool bpf_handle_breakpoint(struct bpf_regs *r, struct sock_filter *f, uint8_t *pkt, uint32_t pkt_caplen, uint32_t pkt_len) { rl_printf("-- register dump --\n"); bpf_dump_curr(r, &f[r->Pc]); rl_printf("-- packet dump --\n"); bpf_dump_pkt...
[ 0, 0 ]
Linux Kernel
tools/bpf/bpf_dbg.c
static int bpf_run_all(struct sock_filter *f, uint16_t bpf_len, uint8_t *pkt, uint32_t pkt_caplen, uint32_t pkt_len) { bool stop = false; while (bpf_curr.Rs == false && stop == false) { bpf_safe_regs(); if (bpf_pc_has_breakpoint(bpf_curr.Pc)) stop = bpf_handle_breakpoint(&bpf...
[ 0, 0 ]
Linux Kernel
tools/bpf/bpf_dbg.c
static int cmd_load_bpf(char *bpf_string) { char sp, *token, separator = ','; unsigned short bpf_len, i = 0; struct sock_filter tmp; bpf_prog_len = 0; memset(bpf_image, 0, sizeof(bpf_image)); if (sscanf(bpf_string, "%hu%c", &bpf_len, &sp) != 2 || sp != separator || bpf_len > BPF_MAXINSNS || bpf_len...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpf_dbg.c
static int cmd_breakpoint(char *subcmd) { if (!bpf_prog_loaded()) return CMD_ERR; if (strlen(subcmd) == 0) bpf_dump_breakpoints(); else if (matches(subcmd, "reset") == 0) bpf_reset_breakpoints(); else { unsigned int where = strtoul(subcmd, NULL, 10); if (where < bpf_prog_len) { bpf_s...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpf_dbg.c
static char *shell_comp_gen(const char *buf, int state) { static int list_index, len; if (!state) { list_index = 0; len = strlen(buf); } for (; list_index < array_size(cmds);) { const char *name = cmds[list_index].name; list_index++; if (strncmp(name, buf, len) == 0) return strdup(...
[ 0, 0 ]
Linux Kernel
tools/bpf/bpf_jit_disasm.c
static void get_exec_path(char *tpath, size_t size) { char *path; ssize_t len; snprintf(tpath, size, "/proc/%d/exe", (int)getpid()); tpath[size - 1] = 0; path = strdup(tpath); assert(path); len = readlink(path, tpath, size); tpath[len] = 0; free(path); }
[ 1, 0 ]
Linux Kernel
tools/bpf/bpf_jit_disasm.c
static char *get_klog_buff(unsigned int *klen) { int ret, len; char *buff; len = klogctl(CMD_ACTION_SIZE_BUFFER, NULL, 0); if (len < 0) return NULL; buff = malloc(len); if (!buff) return NULL; ret = klogctl(CMD_ACTION_READ_ALL, buff, len); if (ret < 0) { free(buff); return NULL; } ...
[ 1, 0 ]
Linux Kernel
tools/bpf/bpf_jit_disasm.c
static void put_log_buff(char *buff) { free(buff); }
[ 1, 0 ]
Linux Kernel
tools/bpf/resolve_btfids/main.c
static struct btf_id *btf_id__find(struct rb_root *root, const char *name) { struct rb_node *p = root->rb_node; struct btf_id *id; int cmp; while (p) { id = rb_entry(p, struct btf_id, rb_node); cmp = strcmp(id->name, name); if (cmp < 0) p = p->rb_left; else if (cmp > 0) p = p->rb_r...
[ 0, 0 ]
Linux Kernel
tools/bpf/resolve_btfids/main.c
static int compressed_section_fix(Elf *elf, Elf_Scn *scn, GElf_Shdr *sh) { int expected = gelf_getclass(elf) == ELFCLASS32 ? 4 : 8; if (!(sh->sh_flags & SHF_COMPRESSED)) return 0; if (sh->sh_addralign == expected) return 0; pr_debug2(" - fixing wrong alignment sh_addralign %u, expected %u\n", ...
[ 1, 0 ]
Linux Kernel
tools/bpf/runqslower/runqslower.c
static error_t parse_arg(int key, char *arg, struct argp_state *state) { static int pos_args; int pid; long long min_us; switch (key) { case 'v': env.verbose = true; break; case 'p': errno = 0; pid = strtol(arg, NULL, 10); if (errno || pid <= 0) { fprintf(stderr, "Invalid PID: %s...
[ 0, 0 ]
Linux Kernel
tools/build/feature/test-backtrace.c
int main(void) { void *backtrace_fns[10]; size_t entries; entries = backtrace(backtrace_fns, 10); backtrace_symbols_fd(backtrace_fns, entries, 1); return 0; }
[ 0, 0 ]
Linux Kernel
tools/build/feature/test-file-handle.c
int main(void) { struct { struct file_handle fh; uint64_t cgroup_id; } handle; int mount_id; name_to_handle_at(AT_FDCWD, "/", &handle.fh, &mount_id, 0); return 0; }
[ 0, 0 ]
Linux Kernel
tools/build/feature/test-fortify-source.c
int main(void) { return puts("hi"); }
[ 0, 0 ]
Linux Kernel
tools/build/feature/test-jvmti-cmlr.c
int main(void) { jvmtiCompiledMethodLoadInlineRecord rec __attribute__((unused)); jvmtiCompiledMethodLoadRecordHeader hdr __attribute__((unused)); PCStackInfo p __attribute__((unused)); return 0; }
[ 0, 0 ]
Linux Kernel
tools/build/feature/test-jvmti.c
int main(void) { JavaVM jvm __attribute__((unused)); jvmtiEventCallbacks cb __attribute__((unused)); jvmtiCapabilities caps __attribute__((unused)); jvmtiJlocationFormat format __attribute__((unused)); jvmtiEnv jvmti __attribute__((unused)); return 0; }
[ 0, 0 ]
Linux Kernel
tools/build/feature/test-libaio.c
int main(void) { struct aiocb aiocb; aiocb.aio_fildes = 0; aiocb.aio_offset = 0; aiocb.aio_buf = 0; aiocb.aio_nbytes = 0; aiocb.aio_reqprio = 0; aiocb.aio_sigevent.sigev_notify = 1; return (int)aio_return(&aiocb); }
[ 0, 0 ]
Linux Kernel
tools/build/feature/test-libbfd-buildid.c
int main(void) { bfd *abfd = bfd_openr("Pedro", 0); return abfd && (!abfd->build_id || abfd->build_id->size > 0x506564726f); }
[ 1, 0 ]
Linux Kernel
tools/build/feature/test-libbpf-bpf_program__set_insns.c
int main(void) { bpf_program__set_insns(NULL, NULL /* new_insns */, 0 /* new_insn_cnt */); return 0; }
[ 0, 0 ]
Linux Kernel
tools/build/feature/test-libdebuginfod.c
int main(void) { debuginfod_client *c = debuginfod_begin(); return (long)c; }
[ 0, 0 ]
Linux Kernel
tools/build/feature/test-libelf-getshdrstrndx.c
int main(void) { size_t dst; return elf_getshdrstrndx(0, &dst); }
[ 0, 0 ]
Linux Kernel
tools/build/feature/test-libpython.c
int main(void) { Py_Initialize(); return 0; }
[ 0, 0 ]
Linux Kernel
tools/build/feature/test-libslang-include-subdir.c
int main(void) { return SLsmg_init_smg(); }
[ 0, 0 ]
Linux Kernel
tools/build/feature/test-libtraceevent.c
int main(void) { int rv = 0; struct trace_seq s; trace_seq_init(&s); rv += !(s.state == TRACE_SEQ__GOOD); trace_seq_destroy(&s); return rv; }
[ 0, 0 ]
Linux Kernel
tools/build/feature/test-lzma.c
int main(void) { lzma_stream strm = LZMA_STREAM_INIT; int ret; ret = lzma_stream_decoder(&strm, UINT64_MAX, LZMA_CONCATENATED); return ret ? -1 : 0; }
[ 0, 0 ]
Linux Kernel
tools/build/feature/test-pthread-barrier.c
int main(void) { pthread_barrier_t barrier; pthread_barrier_init(&barrier, NULL, 1); pthread_barrier_wait(&barrier); return pthread_barrier_destroy(&barrier); }
[ 0, 0 ]
Linux Kernel
tools/build/feature/test-reallocarray.c
int main(void) { return !!reallocarray(NULL, 1, 1); }
[ 0, 0 ]
Linux Kernel
tools/build/fixdep.c
int main(int argc, char **argv) { if (argc != 4) usage(); depfile = argv[1]; target = argv[2]; cmdline = argv[3]; print_cmdline(); print_deps(); return 0; }
[ 0, 0 ]
Linux Kernel
tools/build/tests/ex/a.c
int a(void) { return 0; }
[ 0, 0 ]
Linux Kernel
tools/build/tests/ex/b.c
int b(void) { return 0; }
[ 0, 0 ]
Linux Kernel
tools/firewire/list.h
static inline void list_append(struct list *list, struct list *new_link) { list_insert((struct list *)list, new_link); }
[ 0, 0 ]
Linux Kernel
tools/firewire/list.h
static inline void list_prepend(struct list *list, struct list *new_link) { list_insert(list->next, new_link); }
[ 0, 0 ]
Linux Kernel
tools/firewire/list.h
static inline void list_remove(struct list *link) { link->prev->next = link->next; link->next->prev = link->prev; } #define list_entry(link, type, member) \ ((type *)((char *)(link) - (unsigned long)(&((type *)0)->member))) #define list_head(list, type, member) list_entr...
[ 1, 0 ]
Linux Kernel
tools/firewire/nosy-dump.c
static struct link_transaction * link_transaction_lookup(int request_node, int response_node, int tlabel) { struct link_transaction *t; list_for_each_entry(t, &pending_transaction_list, link) { if (t->request_node == request_node && t->response_node == response_node && t->tlabel == tlabel) retur...
[ 1, 0 ]
Linux Kernel
tools/firewire/nosy-dump.c
static void link_transaction_destroy(struct link_transaction *t) { struct subaction *sa; while (!list_empty(&t->request_list)) { sa = list_head(&t->request_list, struct subaction, link); list_remove(&sa->link); subaction_destroy(sa); } while (!list_empty(&t->response_list)) { sa = list_head(&t...
[ 1, 0 ]
Linux Kernel
tools/firewire/nosy-dump.c
static int handle_request_packet(uint32_t *data, size_t length) { struct link_packet *p = (struct link_packet *)data; struct subaction *sa, *prev; struct link_transaction *t; t = link_transaction_lookup(p->common.source, p->common.destination, p->common.tlabel); sa = subaction_c...
[ 1, 0 ]
Linux Kernel
tools/firewire/nosy-dump.c
static int handle_packet(uint32_t *data, size_t length) { if (length == 0) { printf("bus reset\r\n"); clear_pending_transaction_list(); } else if (length > sizeof(struct phy_packet)) { struct link_packet *p = (struct link_packet *)data; switch (packet_info[p->common.tcode].type) { case PACKET_...
[ 1, 0 ]