Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | tools/lib/rbtree.c | static inline void dummy_rotate(struct rb_node *old, struct rb_node *new) {} | [
0,
0
] |
Linux Kernel | tools/lib/rbtree.c | struct rb_node *rb_first(const struct rb_root *root) {
struct rb_node *n;
n = root->rb_node;
if (!n)
return NULL;
while (n->rb_left)
n = n->rb_left;
return n;
} | [
0,
0
] |
Linux Kernel | tools/lib/rbtree.c | struct rb_node *rb_next(const struct rb_node *node) {
struct rb_node *parent;
if (RB_EMPTY_NODE(node))
return NULL;
if (node->rb_right) {
node = node->rb_right;
while (node->rb_left)
node = node->rb_left;
return (struct rb_node *)node;
}
/*
* No right-hand children. Everything down... | [
0,
0
] |
Linux Kernel | tools/lib/slab.c |
void *kmalloc(size_t size, gfp_t gfp) {
void *ret;
if (!(gfp & __GFP_DIRECT_RECLAIM))
return NULL;
ret = malloc(size);
uatomic_inc(&kmalloc_nr_allocated);
if (kmalloc_verbose)
printf("Allocating %p from malloc\n", ret);
if (gfp & __GFP_ZERO)
memset(ret, 0, size);
return ret;
} | [
1,
0
] |
Linux Kernel | tools/lib/string.c | size_t __weak strlcpy(char *dest, const char *src, size_t size) {
size_t ret = strlen(src);
if (size) {
size_t len = (ret >= size) ? size - 1 : ret;
memcpy(dest, src, len);
dest[len] = '\0';
}
return ret;
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif | [
1,
0
] |
Linux Kernel | tools/lib/string.c | char *skip_spaces(const char *str) {
while (isspace(*str))
++str;
return (char *)str;
} | [
0,
0
] |
Linux Kernel | tools/lib/subcmd/exec-cmd.c | void exec_cmd_init(const char *exec_name, const char *prefix,
const char *exec_path, const char *exec_path_env) {
subcmd_config.exec_name = exec_name;
subcmd_config.prefix = prefix;
subcmd_config.exec_path = exec_path;
subcmd_config.exec_path_env = exec_path_env;
setenv("PREFIX", prefix, 1... | [
0,
0
] |
Linux Kernel | tools/lib/subcmd/exec-cmd.c |
char *system_path(const char *path) {
char *buf = NULL;
if (is_absolute_path(path))
return strdup(path);
astrcatf(&buf, "%s/%s", subcmd_config.prefix, path);
return buf;
} | [
0,
0
] |
Linux Kernel | tools/lib/subcmd/exec-cmd.c |
static void add_path(char **out, const char *path) {
if (path && *path) {
if (is_absolute_path(path))
astrcat(out, path);
else
astrcat(out, make_nonrelative_path(path));
astrcat(out, ":");
}
} | [
0,
0
] |
Linux Kernel | tools/lib/subcmd/exec-cmd.c |
void setup_path(void) {
const char *old_path = getenv("PATH");
char *new_path = NULL;
char *tmp = get_argv_exec_path();
add_path(&new_path, tmp);
add_path(&new_path, argv0_path);
free(tmp);
if (old_path)
astrcat(&new_path, old_path);
else
astrcat(&new_path, "/usr/local/bin:/usr/bin:/bin");
... | [
1,
0
] |
Linux Kernel | tools/lib/subcmd/exec-cmd.c | static const char **prepare_exec_cmd(const char **argv) {
int argc;
const char **nargv;
for (argc = 0; argv[argc]; argc++)
;
nargv = malloc(sizeof(*nargv) * (argc + 2));
nargv[0] = subcmd_config.exec_name;
for (argc = 0; argv[argc]; argc++)
nargv[argc + 1] = argv[argc];
nargv[argc + 1] = NULL;
... | [
1,
0
] |
Linux Kernel | tools/lib/subcmd/help.c |
void add_cmdname(struct cmdnames *cmds, const char *name, size_t len) {
struct cmdname *ent = malloc(sizeof(*ent) + len + 1);
ent->len = len;
memcpy(ent->name, name, len);
ent->name[len] = 0;
ALLOC_GROW(cmds->names, cmds->cnt + 1, cmds->alloc);
cmds->names[cmds->cnt++] = ent;
} | [
1,
0
] |
Linux Kernel | tools/lib/subcmd/help.c |
void clean_cmdnames(struct cmdnames *cmds) {
unsigned int i;
for (i = 0; i < cmds->cnt; ++i)
zfree(&cmds->names[i]);
zfree(&cmds->names);
cmds->cnt = 0;
cmds->alloc = 0;
} | [
0,
0
] |
Linux Kernel | tools/lib/subcmd/help.c | static int is_executable(const char *name) {
struct stat st;
if (stat(name, &st) || !S_ISREG(st.st_mode))
return 0;
return st.st_mode & S_IXUSR;
} | [
0,
0
] |
Linux Kernel | tools/lib/subcmd/help.c |
static void list_commands_in_dir(struct cmdnames *cmds, const char *path,
const char *prefix) {
int prefix_len;
DIR *dir = opendir(path);
struct dirent *de;
char *buf = NULL;
if (!dir)
return;
if (!prefix)
prefix = "perf-";
prefix_len = strlen(prefix);
astrcat... | [
1,
0
] |
Linux Kernel | tools/lib/subcmd/pager.c |
void pager_init(const char *pager_env) { subcmd_config.pager_env = pager_env; } | [
0,
0
] |
Linux Kernel | tools/lib/subcmd/parse-options.c |
static void optwarning(const struct option *opt, const char *reason,
int flags) {
if (flags & OPT_SHORT)
fprintf(stderr, " Warning: switch `%c' %s", opt->short_name, reason);
else if (flags & OPT_UNSET)
fprintf(stderr, " Warning: option `no-%s' %s", opt->long_name, reason);
else
... | [
1,
0
] |
Linux Kernel | tools/lib/subcmd/parse-options.c |
static void parse_options_start(struct parse_opt_ctx_t *ctx, int argc,
const char **argv, int flags) {
memset(ctx, 0, sizeof(*ctx));
ctx->argc = argc - 1;
ctx->argv = argv + 1;
ctx->out = argv;
ctx->cpidx = ((flags & PARSE_OPT_KEEP_ARGV0) != 0);
ctx->flags = flags;
if ((fl... | [
1,
0
] |
Linux Kernel | tools/lib/subcmd/parse-options.c |
static int parse_options_end(struct parse_opt_ctx_t *ctx) {
memmove(ctx->out + ctx->cpidx, ctx->argv, ctx->argc * sizeof(*ctx->out));
ctx->out[ctx->cpidx + ctx->argc] = NULL;
return ctx->cpidx + ctx->argc;
} | [
1,
0
] |
Linux Kernel | tools/lib/subcmd/parse-options.c | int parse_options_subcommand(int argc, const char **argv,
const struct option *options,
const char *const subcommands[],
const char *usagestr[], int flags) {
struct parse_opt_ctx_t ctx;
if (subcommands && !usagestr[0]) {
cha... | [
0,
0
] |
Linux Kernel | tools/lib/subcmd/parse-options.c | static struct option *options__order(const struct option *opts) {
int nr_opts = 0, nr_group = 0, len;
const struct option *o = opts;
struct option *opt, *ordered, *group;
for (o = opts; o->type != OPTION_END; o++)
++nr_opts;
len = sizeof(*o) * (nr_opts + 1);
ordered = malloc(len);
if (!ordered)
... | [
1,
0
] |
Linux Kernel | tools/lib/subcmd/parse-options.c |
static struct option *find_option(struct option *opts, int shortopt,
const char *longopt) {
for (; opts->type != OPTION_END; opts++) {
if ((shortopt && opts->short_name == shortopt) ||
(opts->long_name && longopt && !strcmp(opts->long_name, longopt)))
return opts;
... | [
1,
0
] |
Linux Kernel | tools/lib/subcmd/parse-options.c |
void set_option_nobuild(struct option *opts, int shortopt, const char *longopt,
const char *build_opt, bool can_skip) {
struct option *opt = find_option(opts, shortopt, longopt);
if (!opt)
return;
opt->flags |= PARSE_OPT_NOBUILD;
opt->flags |= can_skip ? PARSE_OPT_CANSKIP : 0;
o... | [
0,
0
] |
Linux Kernel | tools/lib/subcmd/run-command.c |
static int wait_or_whine(pid_t pid) {
char sbuf[STRERR_BUFSIZE];
for (;;) {
int status, code;
pid_t waiting = waitpid(pid, &status, 0);
if (waiting < 0) {
if (errno == EINTR)
continue;
fprintf(stderr, " Error: waitpid failed (%s)",
str_error_r(errno, sbuf, sizeof(sbu... | [
1,
0
] |
Linux Kernel | tools/lib/subcmd/run-command.c |
int run_command(struct child_process *cmd) {
int code = start_command(cmd);
if (code)
return code;
return finish_command(cmd);
} | [
0,
0
] |
Linux Kernel | tools/lib/subcmd/sigchain.c |
static void check_signum(int sig) {
if (sig < 1 || sig >= SIGCHAIN_MAX_SIGNALS)
die("BUG: signal out of range: %d", sig);
} | [
1,
0
] |
Linux Kernel | tools/lib/subcmd/sigchain.c |
int sigchain_pop(int sig) {
struct sigchain_signal *s = signals + sig;
check_signum(sig);
if (s->n < 1)
return 0;
if (signal(sig, s->old[s->n - 1]) == SIG_ERR)
return -1;
s->n--;
return 0;
} | [
1,
0
] |
Linux Kernel | tools/lib/subcmd/subcmd-util.h | static NORETURN inline void die(const char *err, ...) {
va_list params;
va_start(params, err);
report(" Fatal: ", err, params);
exit(128);
va_end(params);
}
#define zfree(ptr) \
({ ... | [
1,
0
] |
Linux Kernel | tools/lib/subcmd/subcmd-util.h |
static inline void *xrealloc(void *ptr, size_t size) {
void *ret = realloc(ptr, size);
if (!ret)
die("Out of memory, realloc failed");
return ret;
}
#define astrcatf(out, fmt, ...) \
({ ... | [
1,
0
] |
Linux Kernel | tools/lib/symbol/kallsyms.c |
u8 kallsyms2elf_type(char type) {
type = tolower(type);
return (type == 't' || type == 'w') ? STT_FUNC : STT_OBJECT;
} | [
0,
0
] |
Linux Kernel | tools/lib/thermal/commands.c |
static int parse_tz_get_trip(struct genl_info *info, struct thermal_zone *tz) {
struct nlattr *attr;
struct thermal_trip *__tt = NULL;
size_t size = 0;
int rem;
nla_for_each_nested(attr, info->attrs[THERMAL_GENL_ATTR_TZ_TRIP], rem) {
if (nla_type(attr) == THERMAL_GENL_ATTR_TZ_TRIP_ID) {
size++;
... | [
1,
0
] |
Linux Kernel | tools/lib/thermal/commands.c |
static int parse_tz_get_gov(struct genl_info *info, struct thermal_zone *tz) {
int id = -1;
if (info->attrs[THERMAL_GENL_ATTR_TZ_ID])
id = nla_get_u32(info->attrs[THERMAL_GENL_ATTR_TZ_ID]);
if (tz->id != id)
return THERMAL_ERROR;
if (info->attrs[THERMAL_GENL_ATTR_TZ_GOV_NAME]) {
nla_strlcpy(tz->... | [
0,
0
] |
Linux Kernel | tools/lib/thermal/commands.c |
static int handle_netlink(struct nl_cache_ops *unused, struct genl_cmd *cmd,
struct genl_info *info, void *arg) {
int ret;
switch (cmd->c_id) {
case THERMAL_GENL_CMD_TZ_GET_ID:
ret = parse_tz_get(info, arg);
break;
case THERMAL_GENL_CMD_CDEV_GET:
ret = parse_cdev_get(in... | [
0,
0
] |
Linux Kernel | tools/lib/thermal/commands.c |
static thermal_error_t thermal_genl_auto(struct thermal_handler *th, int id,
int cmd, int flags, void *arg) {
struct nl_msg *msg;
void *hdr;
msg = nlmsg_alloc();
if (!msg)
return THERMAL_ERROR;
hdr = genlmsg_put(msg, NL_AUTO_PORT, NL_AUTO_SEQ, thermal_cmd_ops.o_... | [
0,
0
] |
Linux Kernel | tools/lib/thermal/commands.c |
thermal_error_t thermal_cmd_get_tz(struct thermal_handler *th,
struct thermal_zone **tz) {
return thermal_genl_auto(th, -1, THERMAL_GENL_CMD_TZ_GET_ID,
NLM_F_DUMP | NLM_F_ACK, tz);
} | [
0,
0
] |
Linux Kernel | tools/lib/thermal/commands.c |
thermal_error_t thermal_cmd_get_governor(struct thermal_handler *th,
struct thermal_zone *tz) {
return thermal_genl_auto(th, tz->id, THERMAL_GENL_CMD_TZ_GET_GOV, 0, tz);
} | [
0,
0
] |
Linux Kernel | tools/lib/thermal/commands.c |
thermal_error_t thermal_cmd_exit(struct thermal_handler *th) {
if (genl_unregister_family(&thermal_cmd_ops))
return THERMAL_ERROR;
nl_thermal_disconnect(th->sk_cmd, th->cb_cmd);
return THERMAL_SUCCESS;
} | [
0,
0
] |
Linux Kernel | tools/lib/thermal/sampling.c |
thermal_error_t thermal_sampling_init(struct thermal_handler *th) {
if (nl_thermal_connect(&th->sk_sampling, &th->cb_sampling))
return THERMAL_ERROR;
if (nl_subscribe_thermal(th->sk_sampling, th->cb_sampling,
THERMAL_GENL_SAMPLING_GROUP_NAME))
return THERMAL_ERROR;
return THE... | [
0,
0
] |
Linux Kernel | tools/lib/thermal/thermal.c |
int for_each_thermal_zone(struct thermal_zone *tz, cb_tz_t cb, void *arg) {
int i, ret = 0;
if (!tz)
return 0;
for (i = 0; tz[i].id != -1; i++)
ret |= cb(&tz[i], arg);
return ret;
} | [
1,
0
] |
Linux Kernel | tools/lib/thermal/thermal_nl.c |
static int nl_ack_handler(struct nl_msg *msg, void *arg) {
int *ret = arg;
if (ret)
*ret = 1;
return NL_OK;
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse-api.c | struct tep_event *tep_get_event(struct tep_handle *tep, int index) {
if (tep && tep->events && index < tep->nr_events)
return tep->events[index];
return NULL;
} | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse-api.c |
__hidden unsigned short data2host2(struct tep_handle *tep,
unsigned short data) {
unsigned short swap;
if (!tep || tep->host_bigendian == tep->file_bigendian)
return data;
swap = ((data & 0xffULL) << 8) | ((data & (0xffULL << 8)) >> 8);
return swap;
} | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse-api.c |
__hidden unsigned long long data2host8(struct tep_handle *tep,
unsigned long long data) {
unsigned long long swap;
if (!tep || tep->host_bigendian == tep->file_bigendian)
return data;
swap = ((data & 0xffULL) << 56) | ((data & (0xffULL << 8)) << 40) |
((data ... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse-api.c | int tep_get_header_timestamp_size(struct tep_handle *tep) {
if (tep)
return tep->header_page_ts_size;
return 0;
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse-api.c | void tep_set_page_size(struct tep_handle *tep, int _page_size) {
if (tep)
tep->page_size = _page_size;
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse-api.c | void tep_set_test_filters(struct tep_handle *tep, int test_filters) {
if (tep)
tep->test_filters = test_filters;
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static struct tep_print_arg *alloc_arg(void) {
return calloc(1, sizeof(struct tep_print_arg));
} | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static int cmdline_cmp(const void *a, const void *b) {
const struct tep_cmdline *ca = a;
const struct tep_cmdline *cb = b;
if (ca->pid < cb->pid)
return -1;
if (ca->pid > cb->pid)
return 1;
return 0;
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static const char *find_cmdline(struct tep_handle *tep, int pid) {
const struct tep_cmdline *comm;
struct tep_cmdline key;
if (!pid)
return "<idle>";
if (!tep->cmdlines && cmdline_init(tep))
return "<not enough memory for cmdlines!>";
key.pid = pid;
comm = bsearch(&key, tep->cmdlines, tep->cmdl... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | bool tep_is_pid_registered(struct tep_handle *tep, int pid) {
const struct tep_cmdline *comm;
struct tep_cmdline key;
if (!pid)
return true;
if (!tep->cmdlines && cmdline_init(tep))
return false;
key.pid = pid;
comm = bsearch(&key, tep->cmdlines, tep->cmdline_count,
sizeof(*tep-... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static int func_cmp(const void *a, const void *b) {
const struct func_map *fa = a;
const struct func_map *fb = b;
if (fa->addr < fb->addr)
return -1;
if (fa->addr > fb->addr)
return 1;
return 0;
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static struct func_map *__find_func(struct tep_handle *tep,
unsigned long long addr) {
struct func_map *func;
struct func_map key;
if (!tep->func_map)
func_map_init(tep);
key.addr = addr;
func = bsearch(&key, tep->func_map, tep->func_count, sizeof(*tep->func_map),
... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static struct func_map *find_func(struct tep_handle *tep,
unsigned long long addr) {
struct func_map *map;
if (!tep->func_resolver)
return __find_func(tep, addr);
map = &tep->func_resolver->map;
map->mod = NULL;
map->addr = addr;
map->func =
tep->func_resolver-... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | unsigned long long tep_find_function_address(struct tep_handle *tep,
unsigned long long addr) {
struct func_map *map;
map = find_func(tep, addr);
if (!map)
return 0;
return map->addr;
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | int tep_register_function(struct tep_handle *tep, char *func,
unsigned long long addr, char *mod) {
struct func_list *item = malloc(sizeof(*item));
if (!item)
return -1;
item->next = tep->funclist;
item->func = strdup(func);
if (!item->func)
goto out_free;
if (mod) {
... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | void tep_print_funcs(struct tep_handle *tep) {
int i;
if (!tep->func_map)
func_map_init(tep);
for (i = 0; i < (int)tep->func_count; i++) {
printf("%016llx %s", tep->func_map[i].addr, tep->func_map[i].func);
if (tep->func_map[i].mod)
printf(" [%s]\n", tep->func_map[i].mod);
else
print... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static struct tep_event *alloc_event(void) {
return calloc(1, sizeof(struct tep_event));
} | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | __hidden void free_token(char *tok) {
if (tok)
free(tok);
} | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static int __read_expected(enum tep_event_type expect, const char *str,
int newline_ok) {
enum tep_event_type type;
char *token;
int ret;
if (newline_ok)
type = read_token(&token);
else
type = read_token_item(&token);
ret = test_type_token(type, token, expect, str);
... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static int read_expected(enum tep_event_type expect, const char *str) {
return __read_expected(expect, str, 1);
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static int field_is_dynamic(struct tep_format_field *field) {
if (strncmp(field->type, "__data_loc", 10) == 0)
return 1;
return 0;
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | static int field_is_long(struct tep_format_field *field) {
if (strstr(field->type, "long"))
return 1;
return 0;
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | static unsigned int type_size(const char *name) {
static struct {
const char *type;
unsigned int size;
} table[] = {
{"u8", 1}, {"u16", 2}, {"u32", 4}, {"u64", 8}, {"s8", 1},
{"s16", 2}, {"s32", 4}, {"s64", 8}, {"char", 1}, {},
};
int i;
for (i = 0; table[i].type; i++) {
if (!strcm... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | static enum tep_event_type process_field_arg(struct tep_event *event,
struct tep_print_arg *arg,
char **tok) {
enum tep_event_type type;
type = process_arg(event, arg, tok);
while (type == TEP_EVENT_OP) {
type = proces... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static enum tep_event_type process_entry(struct tep_event *event __maybe_unused,
struct tep_print_arg *arg,
char **tok) {
enum tep_event_type type;
char *field;
char *token;
if (read_expected(TEP_EVENT_OP, "->") < 0)
goto ou... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static int alloc_and_process_delim(struct tep_event *event, char *next_token,
struct tep_print_arg **print_arg) {
struct tep_print_arg *field;
enum tep_event_type type;
char *token;
int ret = 0;
field = alloc_arg();
if (!field) {
do_warning_event(event, "%s: not enou... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static char *arg_eval(struct tep_print_arg *arg) {
long long val;
static char buf[24];
switch (arg->type) {
case TEP_PRINT_ATOM:
return arg->atom.atom;
case TEP_PRINT_TYPE:
return arg_eval(arg->typecast.item);
case TEP_PRINT_OP:
if (!arg_num_eval(arg, &val))
break;
sprintf(buf, "%lld... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static enum tep_event_type process_fields(struct tep_event *event,
struct tep_print_flag_sym **list,
char **tok) {
enum tep_event_type type;
struct tep_print_arg *arg = NULL;
struct tep_print_flag_sym *field;
char *token = *tok... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static enum tep_event_type process_int_array(struct tep_event *event,
struct tep_print_arg *arg,
char **tok) {
memset(arg, 0, sizeof(*arg));
arg->type = TEP_PRINT_INT_ARRAY;
if (alloc_and_process_delim(event, ",", &arg->in... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | static enum tep_event_type
process_paren(struct tep_event *event, struct tep_print_arg *arg, char **tok) {
struct tep_print_arg *item_arg;
enum tep_event_type type;
char *token;
type = process_arg(event, arg, &token);
if (type == TEP_EVENT_ERROR)
goto out_free;
if (type == TEP_EVENT_OP)
type = pr... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static struct tep_function_handler *find_func_handler(struct tep_handle *tep,
char *func_name) {
struct tep_function_handler *func;
if (!tep)
return NULL;
for (func = tep->func_handlers; func; func = func->next) {
if (strcmp(func->name, func_name) =... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | static enum tep_event_type process_builtin_expect(struct tep_event *event,
struct tep_print_arg *arg,
char **tok) {
enum tep_event_type type;
char *token = NULL;
type = process_arg(event, arg, &token);
if (type... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static int event_read_print_args(struct tep_event *event,
struct tep_print_arg **list) {
enum tep_event_type type = TEP_EVENT_ERROR;
struct tep_print_arg *arg;
char *token;
int args = 0;
do {
if (type == TEP_EVENT_NEWLINE) {
type = read_token_item(&token);
co... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | int tep_read_number_field(struct tep_format_field *field, const void *data,
unsigned long long *value) {
if (!field)
return -1;
switch (field->size) {
case 1:
case 2:
case 4:
case 8:
*value =
tep_read_number(field->event->tep, data + field->offset, field->size);
... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | static int get_common_info(struct tep_handle *tep, const char *type,
int *offset, int *size) {
struct tep_event *event;
struct tep_format_field *field;
if (!tep->events) {
do_warning("no event_list!");
return -1;
}
event = tep->events[0];
field = tep_find_common_field(ev... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static int parse_common_pid(struct tep_handle *tep, void *data) {
return __parse_common(tep, data, &tep->pid_size, &tep->pid_offset,
"common_pid");
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static int parse_common_flags(struct tep_handle *tep, void *data) {
return __parse_common(tep, data, &tep->flags_size, &tep->flags_offset,
"common_flags");
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static int parse_common_lock_depth(struct tep_handle *tep, void *data) {
return __parse_common(tep, data, &tep->ld_size, &tep->ld_offset,
"common_lock_depth");
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | struct tep_event *tep_find_event(struct tep_handle *tep, int id) {
struct tep_event **eventptr;
struct tep_event key;
struct tep_event *pkey = &key;
if (tep->last_event && tep->last_event->id == id)
return tep->last_event;
key.id = id;
eventptr = bsearch(&pkey, tep->events, tep->nr_events, sizeof(*te... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | struct tep_event *tep_find_event_by_name(struct tep_handle *tep,
const char *sys, const char *name) {
struct tep_event *event = NULL;
int i;
if (tep->last_event && strcmp(tep->last_event->name, name) == 0 &&
(!sys || strcmp(tep->last_event->system, sys) == 0))
r... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | static long long eval_flag(const char *flag) {
int i;
if (isdigit(flag[0]))
return strtoull(flag, NULL, 0);
for (i = 0; i < (int)(sizeof(flags) / sizeof(flags[0])); i++)
if (strcmp(flags[i].name, flag) == 0)
return flags[i].value;
return -1LL;
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static int print_mac_arg(struct trace_seq *s, const char *format, void *data,
int size, struct tep_event *event,
struct tep_print_arg *arg) {
const char *fmt = "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x";
bool reverse = false;
unsigned char *buf;
int ret = 0;
if (arg->t... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | static int parse_ip4_print_args(struct tep_handle *tep, const char *ptr,
bool *reverse) {
int ret = 0;
*reverse = false;
switch (*ptr) {
case 'h':
if (tep->file_bigendian)
*reverse = false;
else
*reverse = true;
ret++;
break;
case 'l':
*reverse... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static inline bool ipv6_addr_is_isatap(const struct in6_addr *addr) {
return (addr->s6_addr32[2] | htonl(0x02000000)) == htonl(0x02005EFE);
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | static int print_ipv6_arg(struct trace_seq *s, const char *ptr, char i,
void *data, int size, struct tep_event *event,
struct tep_print_arg *arg) {
char have_c = 0;
unsigned char *buf;
int rc = 0;
if (i == 'I' && *ptr == 'c') {
have_c = 1;
ptr++;
... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | static int print_uuid_arg(struct trace_seq *s, const char *ptr, void *data,
int size, struct tep_event *event,
struct tep_print_arg *arg) {
const int *index = uuid_index;
char *format = "%02x";
int ret = 0;
char *buf;
int i;
switch (*(ptr + 1)) {
case '... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static int print_raw_buff_arg(struct trace_seq *s, const char *ptr, void *data,
int size, struct tep_event *event,
struct tep_print_arg *arg, int print_len) {
int plen = print_len;
char *delim = " ";
int ret = 0;
char *buf;
int i;
unsigned long of... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static int is_printable_array(char *p, unsigned int len) {
unsigned int i;
for (i = 0; i < len && p[i]; i++)
if (!isprint(p[i]) && !isspace(p[i]))
return 0;
return 1;
} | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static int print_function(struct trace_seq *s, const char *format, void *data,
int size, struct tep_event *event,
struct tep_print_arg *arg) {
struct func_map *func;
unsigned long long val;
val = eval_num_arg(data, size, event, arg);
func = find_func(event->... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static int print_arg_pointer(struct trace_seq *s, const char *format, int plen,
void *data, int size, struct tep_event *event,
struct tep_print_arg *arg) {
unsigned long long val;
int ret = 1;
if (arg->type == TEP_PRINT_BSTRING) {
trace_seq_puts(s, a... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | static void print_arg_string(struct trace_seq *s, const char *format, int plen,
void *data, int size, struct tep_event *event,
struct tep_print_arg *arg) {
struct trace_seq p;
trace_seq_init(&p);
print_str_arg(&p, data, size, event, format, plen, arg);
... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | static int parse_arg_format_pointer(const char *format) {
int ret = 0;
int index;
int loop;
switch (*format) {
case 'F':
case 'S':
case 'f':
case 's':
ret++;
break;
case 'M':
case 'm':
switch (format[1]) {
case 'R':
case 'F':
ret++;
break;
}
ret++;
break... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static void free_parse_args(struct tep_print_parse *arg) {
struct tep_print_parse *del;
while (arg) {
del = arg;
arg = del->next;
free(del->format);
free(del);
}
} | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static int parse_arg_add(struct tep_print_parse **parse, char *format,
enum tep_print_parse_type type,
struct tep_print_arg *arg,
struct tep_print_arg *len_as_arg, int ls) {
struct tep_print_parse *parg = NULL;
parg = calloc(1, sizeof(*par... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static void pretty_print(struct trace_seq *s, void *data, int size,
struct tep_event *event) {
struct tep_print_parse *parse = event->print_fmt.print_cache;
struct tep_print_arg *args = NULL;
char *bprint_fmt = NULL;
if (event->flags & TEP_EVENT_FL_FAILED) {
trace_seq_printf(s, "[... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | int tep_data_pid(struct tep_handle *tep, struct tep_record *rec) {
return parse_common_pid(tep, rec->data);
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static struct tep_cmdline *pid_from_cmdlist(struct tep_handle *tep,
const char *comm,
struct tep_cmdline *next) {
struct cmdline_list *cmdlist = (struct cmdline_list *)next;
if (cmdlist)
cmdlist = cmdlist->next;
else
... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | struct tep_cmdline *tep_data_pid_from_comm(struct tep_handle *tep,
const char *comm,
struct tep_cmdline *next) {
struct tep_cmdline *cmdline;
if (!tep->cmdlines)
return pid_from_cmdlist(tep, comm, next);
if (next) {
/*... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | struct tep_event *tep_find_event_by_record(struct tep_handle *tep,
struct tep_record *record) {
int type;
if (record->size < 0) {
do_warning("ug! negative record size %d", record->size);
return NULL;
}
type = trace_parse_common_type(tep, record->data);
ret... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
static struct tep_event **list_events_copy(struct tep_handle *tep) {
struct tep_event **events;
if (!tep)
return NULL;
events = malloc(sizeof(*events) * (tep->nr_events + 1));
if (!events)
return NULL;
memcpy(events, tep->events, sizeof(*events) * tep->nr_events);
events[tep->nr_events] = NULL;
... | [
1,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.