All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf probe: Return errno when does not hit any event
@ 2017-03-06  9:34 Kefeng Wang
  2017-03-07  7:33 ` Kefeng Wang
  0 siblings, 1 reply; 11+ messages in thread
From: Kefeng Wang @ 2017-03-06  9:34 UTC (permalink / raw)
  To: linux-kernel
  Cc: Peter Zijlstra, Jiri Olsa, Namhyung Kim, Wang Nan, guohanjun,
	Kefeng Wang

On old perf, when using perf probe -d to delete an inexistent event,
it return 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 return errno
again, eg,

-bash-4.3# ./perf probe -d xxx  || echo $?
  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>
---
 tools/perf/builtin-probe.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 1fcebc3..c46b41c 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -444,7 +444,8 @@ static int perf_del_probe_events(struct strfilter *filter)
 	if (ret == -ENOENT && ret2 == -ENOENT)
 		pr_debug("\"%s\" does not hit any event.\n", str);
 		/* Note that this is silently ignored */
-	ret = 0;
+	else
+		ret = 0;
 
 error:
 	if (kfd >= 0)
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-03-24 18:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-06  9:34 [PATCH] perf probe: Return errno when does not hit any event Kefeng Wang
2017-03-07  7:33 ` Kefeng Wang
2017-03-14 13:19   ` Kefeng Wang
2017-03-14 13:30     ` Arnaldo Carvalho de Melo
2017-03-16  9:39       ` Masami Hiramatsu
2017-03-16 12:07         ` Kefeng Wang
2017-03-17  1:57           ` Masami Hiramatsu
2017-03-17  8:16             ` [PATCH v2] " Kefeng Wang
2017-03-17 23:23               ` Masami Hiramatsu
2017-03-21 13:46                 ` Arnaldo Carvalho de Melo
2017-03-24 18:43               ` [tip:perf/core] perf probe: Return errno when not hitting " tip-bot for Kefeng Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.