perf tools: Enable close-on-exec flag on perf file descriptor
authorYann Droneaud <ydroneaud@opteya.com>
Mon, 30 Jun 2014 20:28:47 +0000 (22:28 +0200)
committerJiri Olsa <jolsa@kernel.org>
Fri, 18 Jul 2014 07:09:34 +0000 (09:09 +0200)
commit57480d2cd93579d665e57e144e1e63f7f02ef058
treea1c628c2bd65a943461479ad52cd4bec179e51d7
parentec6dbcb7ade2a616675cbe3185cf299ee1615c9f
perf tools: Enable close-on-exec flag on perf file descriptor

In commit a21b0b354d4a ('perf: Introduce a flag to enable
close-on-exec in perf_event_open()'), flag PERF_FLAG_FD_CLOEXEC
was added to perf_event_open(2) syscall to allows userspace
to atomically enable close-on-exec behavor when creating
the file descriptor.

This patch makes perf tools use the new flag if supported
by the kernel, so that the event file descriptors got
automatically closed if perf tool exec a sub-command.

Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/1404160127-7475-1-git-send-email-ydroneaud@opteya.com
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
tools/perf/Makefile.perf
tools/perf/bench/mem-memcpy.c
tools/perf/bench/mem-memset.c
tools/perf/builtin-sched.c
tools/perf/tests/bp_signal.c
tools/perf/tests/bp_signal_overflow.c
tools/perf/tests/rdpmc.c
tools/perf/util/cloexec.c [new file with mode: 0644]
tools/perf/util/cloexec.h [new file with mode: 0644]
tools/perf/util/evsel.c
tools/perf/util/record.c