]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - tools/perf/builtin-record.c
Merge branch 'for-linus' of git://neil.brown.name/md
[karo-tx-linux.git] / tools / perf / builtin-record.c
index a5a050af8e7dbca2e474d3f2907b4bc5f5cebbae..a4be453fc8a92e3059fabb1a680ac008fe5569b9 100644 (file)
@@ -41,6 +41,7 @@ static int                    raw_samples                     = 0;
 static int                     system_wide                     = 0;
 static int                     profile_cpu                     = -1;
 static pid_t                   target_pid                      = -1;
+static pid_t                   child_pid                       = -1;
 static int                     inherit                         = 1;
 static int                     force                           = 0;
 static int                     append_file                     = 0;
@@ -184,6 +185,9 @@ static void sig_handler(int sig)
 
 static void sig_atexit(void)
 {
+       if (child_pid != -1)
+               kill(child_pid, SIGTERM);
+
        if (signr == -1)
                return;
 
@@ -422,7 +426,7 @@ try_again:
        if (fd[nr_cpu][counter] < 0) {
                int err = errno;
 
-               if (err == EPERM)
+               if (err == EPERM || err == EACCES)
                        die("Permission error - are you root?\n");
                else if (err ==  ENODEV && profile_cpu != -1)
                        die("No such device - did you specify an out-of-range profile CPU?\n");
@@ -610,6 +614,8 @@ static int __cmd_record(int argc, const char **argv)
                                exit(-1);
                        }
                }
+
+               child_pid = pid;
        }
 
        if (realtime_prio) {