tracing/filters: return proper error code when writing filter file
[cascardo/linux.git] / kernel / trace / trace_stack.c
index d0871bc..c750f65 100644 (file)
@@ -245,16 +245,31 @@ static int trace_lookup_stack(struct seq_file *m, long i)
 #endif
 }
 
+static void print_disabled(struct seq_file *m)
+{
+       seq_puts(m, "#\n"
+                "#  Stack tracer disabled\n"
+                "#\n"
+                "# To enable the stack tracer, either add 'stacktrace' to the\n"
+                "# kernel command line\n"
+                "# or 'echo 1 > /proc/sys/kernel/stack_tracer_enabled'\n"
+                "#\n");
+}
+
 static int t_show(struct seq_file *m, void *v)
 {
        long i;
        int size;
 
        if (v == SEQ_START_TOKEN) {
-               seq_printf(m, "        Depth   Size      Location"
+               seq_printf(m, "        Depth    Size   Location"
                           "    (%d entries)\n"
-                          "        -----   ----      --------\n",
+                          "        -----    ----   --------\n",
                           max_stack_trace.nr_entries);
+
+               if (!stack_tracer_enabled && !max_stack_size)
+                       print_disabled(m);
+
                return 0;
        }