perf probe: Return errno when not hitting any event
authorKefeng Wang <wangkefeng.wang@huawei.com>
Fri, 17 Mar 2017 08:16:32 +0000 (16:16 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 21 Mar 2017 13:45:02 +0000 (10:45 -0300)
commit70946723eeb859466f026274b29c6196e39149c4
treee6e529e129e7a7831bd4d0c9ec905fe098334fb7
parent2e1f8f7895731a8592d483a7364a23855843af17
perf probe: Return errno when not hitting any event

On old perf, when using 'perf probe -d' to delete an inexistent event,
it returns errno, eg,

  -bash-4.3# perf probe -d xxx  || echo $?
  Info: Event "*:xxx" does not exist.
    Error: Failed to delete events.
  255

But now perf_del_probe_events() will always set ret = 0, different from
previous del_perf_probe_events(). After this, it returns errno again,
eg,

  -bash-4.3# ./perf probe -d xxx  || echo $?
  "xxx" does not hit any event.
    Error: Failed to delete events.
  254

And it is more appropriate to return -ENOENT instead of -EPERM.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Hanjun Guo <guohanjun@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: dddc7ee32fa1 ("perf probe: Fix an error when deleting probes successfully")
Link: http://lkml.kernel.org/r/1489738592-61011-1-git-send-email-wangkefeng.wang@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-probe.c