mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-17 22:05:08 +00:00
0fd77ae4a3
Ian pointed out that the libcap feature test is also used by bpftool, so we can't remove it just because perf stopped using it, revert the removal of the feature test. Since both perf and libcap uses the fast path feature detection (tools/build/feature/test-all.c), probably the best thing is to keep libcap-devel when building perf even it not being used there. This reverts commit 47b3b6435e4bfb61ae8ffc63a11bd3c310f69acf. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
21 lines
322 B
C
21 lines
322 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <sys/capability.h>
|
|
#include <linux/capability.h>
|
|
|
|
int main(void)
|
|
{
|
|
cap_flag_value_t val;
|
|
cap_t caps = cap_get_proc();
|
|
|
|
if (!caps)
|
|
return 1;
|
|
|
|
if (cap_get_flag(caps, CAP_SYS_ADMIN, CAP_EFFECTIVE, &val) != 0)
|
|
return 1;
|
|
|
|
if (cap_free(caps) != 0)
|
|
return 1;
|
|
|
|
return 0;
|
|
}
|