perf record: handle death by SIGTERM
authorDavid Ahern <dsahern@gmail.com>
Mon, 6 May 2013 18:24:23 +0000 (12:24 -0600)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 28 May 2013 13:23:58 +0000 (16:23 +0300)
commit804f7ac78803ed095bb0402d540f859ecb1be9f1
treed1b49c085046c553d5b59b4706482044aa5aa415
parent89365e6c9ad4c0e090e4c6a4b67a3ce319381d89
perf record: handle death by SIGTERM

Perf data files cannot be processed until the header is updated which is
done via an on_exit handler.

If perf is killed due to a SIGTERM it does not run the on_exit hooks
leaving the perf.data file in a random state which perf-report will
happily spin on trying to read.

As noted by Mike an easy reproducer is:

perf record -a -g & sleep 1; killall perf

Fix by catching SIGTERM like it does SIGINT.

Also need to remove the kill which was added via commit f7b7c26e.

Acked-by: Stephane Eranian <eranian@google.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1367864663-1309-1-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-record.c