atrace: setup saved_cmdlines_size and write only if available
Older kernels (bullhead etc) don't have saved_cmdlines_size, check and
write only if available. Also make work on non-root by setting
permissions in rc file (thanks John Reck for suggestion).
Bug: 62375794
Change-Id: Iefffc3203afd092ffb6cf420a144b38844aaee39
Signed-off-by: Joel Fernandes <joelaf@google.com>
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp
index 6f2159d..8758516 100644
--- a/cmds/atrace/atrace.cpp
+++ b/cmds/atrace/atrace.cpp
@@ -444,7 +444,10 @@
// Set the default size of cmdline hashtable
static bool setCmdlineSize()
{
- return writeStr(k_traceCmdlineSizePath, "8192");
+ if (fileExists(k_traceCmdlineSizePath)) {
+ return writeStr(k_traceCmdlineSizePath, "8192");
+ }
+ return true;
}
// Set the clock to the best available option while tracing. Use 'boot' if it's