perf tools: Fix permission checks
authorPekka Enberg <penberg@cs.helsinki.fi>
Sun, 8 Nov 2009 16:01:06 +0000 (18:01 +0200)
committerIngo Molnar <mingo@elte.hu>
Sun, 8 Nov 2009 16:04:54 +0000 (17:04 +0100)
commitc10edee2e1716f8cf217cf52ed01ae4742fcdf3c
tree30d894124621ba13ea5e7e06050b99953a401b62
parentdd77038d233d106f297b907bf51459dfb1099eb1
perf tools: Fix permission checks

The perf_event_open() system call returns EACCES if the user is
not root which results in a very confusing error message:

  $ perf record -A -a -f

    Error: perfcounter syscall returned with -1 (Permission denied)

    Fatal: No CONFIG_PERF_EVENTS=y kernel support configured?

It turns out that's because perf tools are checking only for
EPERM. Fix that up to get a much better error message:

  $ perf record -A -a -f
    Fatal: Permission error - are you root?

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <1257696066-4046-1-git-send-email-penberg@cs.helsinki.fi>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
tools/perf/builtin-record.c
tools/perf/builtin-top.c