builtin-probe.c (1f3736c9c833e40ac4d3a8dc6d661e341df8a259) builtin-probe.c (4a0f65c102ec3a718b4a0b90981232b6cb019477)
1/*
2 * builtin-probe.c
3 *
4 * Builtin probe command: Set up probe events by C expression
5 *
6 * Written by Masami Hiramatsu <mhiramat@redhat.com>
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 349 unchanged lines hidden (view full) ---

358 }
359
360out_cleanup:
361 cleanup_perf_probe_events(pevs, npevs);
362 exit_probe_symbol_maps();
363 return ret;
364}
365
1/*
2 * builtin-probe.c
3 *
4 * Builtin probe command: Set up probe events by C expression
5 *
6 * Written by Masami Hiramatsu <mhiramat@redhat.com>
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 349 unchanged lines hidden (view full) ---

358 }
359
360out_cleanup:
361 cleanup_perf_probe_events(pevs, npevs);
362 exit_probe_symbol_maps();
363 return ret;
364}
365
366static int del_perf_probe_caches(struct strfilter *filter)
367{
368 struct probe_cache *cache;
369 struct strlist *bidlist;
370 struct str_node *nd;
371 int ret;
372
373 bidlist = build_id_cache__list_all();
374 if (!bidlist) {
375 ret = -errno;
376 pr_debug("Failed to get buildids: %d\n", ret);
377 return ret ?: -ENOMEM;
378 }
379
380 strlist__for_each_entry(nd, bidlist) {
381 cache = probe_cache__new(nd->s);
382 if (!cache)
383 continue;
384 if (probe_cache__filter_purge(cache, filter) < 0 ||
385 probe_cache__commit(cache) < 0)
386 pr_warning("Failed to remove entries for %s\n", nd->s);
387 probe_cache__delete(cache);
388 }
389 return 0;
390}
391
366static int perf_del_probe_events(struct strfilter *filter)
367{
368 int ret, ret2, ufd = -1, kfd = -1;
369 char *str = strfilter__string(filter);
370 struct strlist *klist = NULL, *ulist = NULL;
371 struct str_node *ent;
372
373 if (!str)
374 return -EINVAL;
375
376 pr_debug("Delete filter: \'%s\'\n", str);
377
392static int perf_del_probe_events(struct strfilter *filter)
393{
394 int ret, ret2, ufd = -1, kfd = -1;
395 char *str = strfilter__string(filter);
396 struct strlist *klist = NULL, *ulist = NULL;
397 struct str_node *ent;
398
399 if (!str)
400 return -EINVAL;
401
402 pr_debug("Delete filter: \'%s\'\n", str);
403
404 if (probe_conf.cache)
405 return del_perf_probe_caches(filter);
406
378 /* Get current event names */
379 ret = probe_file__open_both(&kfd, &ufd, PF_FL_RW);
380 if (ret < 0)
381 goto out;
382
383 klist = strlist__new(NULL, NULL);
384 ulist = strlist__new(NULL, NULL);
385 if (!klist || !ulist) {

--- 264 unchanged lines hidden ---
407 /* Get current event names */
408 ret = probe_file__open_both(&kfd, &ufd, PF_FL_RW);
409 if (ret < 0)
410 goto out;
411
412 klist = strlist__new(NULL, NULL);
413 ulist = strlist__new(NULL, NULL);
414 if (!klist || !ulist) {

--- 264 unchanged lines hidden ---