CONTEXT_VPPID = 9,
CONTEXT_PTHREAD_ID = 10,
CONTEXT_HOSTNAME = 11,
+ CONTEXT_IP = 12,
};
/*
{ "ppid", CONTEXT_PPID },
{ "vppid", CONTEXT_VPPID },
{ "hostname", CONTEXT_HOSTNAME },
+ { "ip", CONTEXT_IP },
/* Perf options */
PERF_HW(cpu-cycles, CPU_CYCLES),
PERF_HW(cycles, CPU_CYCLES),
} else if (opt_userspace) {
dom.type = LTTNG_DOMAIN_UST;
} else {
- ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
+ print_missing_domain();
ret = CMD_ERROR;
goto error;
}
if (context.ctx == LTTNG_EVENT_CONTEXT_PERF_COUNTER) {
context.u.perf_counter.type = type->opt->u.perf.type;
context.u.perf_counter.config = type->opt->u.perf.config;
- strcpy(context.u.perf_counter.name, type->opt->symbol);
+ strncpy(context.u.perf_counter.name, type->opt->symbol,
+ LTTNG_SYMBOL_NAME_LEN);
+ context.u.perf_counter.name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
/* Replace : and - by _ */
while ((ptr = strchr(context.u.perf_counter.name, '-')) != NULL) {
*ptr = '_';
}
type->opt = &ctx_opts[index];
- if (type->opt->ctx_type == -1) {
+ if (type->opt->symbol == NULL) {
ERR("Unknown context type %s", opt_type);
free(type);
ret = CMD_ERROR;
goto end;
} else {
- cds_list_add(&type->list, &ctx_type_list.head);
+ cds_list_add_tail(&type->list, &ctx_type_list.head);
}
break;
case OPT_USERSPACE: