libcutils must check /sys/kernel/tracing for tracefs first

Currently it falls back to /sys/kernel/tracing if debugfs is not found.
/sys/kernel/tracing must be checked first since debugfs is not allowed
to be mounted in user builds starting with Android R launching devices.

Test: manual
Change-Id: I2fb5ec91bbf7d5304a1a6efcb06530969485e78f
This commit is contained in:
Hridya Valsaraju 2020-09-12 15:37:39 -07:00
parent 72a0f10f51
commit 355ff8c7c1

View file

@ -30,9 +30,9 @@ void atrace_set_tracing_enabled(bool enabled)
static void atrace_init_once()
{
atrace_marker_fd = open("/sys/kernel/debug/tracing/trace_marker", O_WRONLY | O_CLOEXEC);
atrace_marker_fd = open("/sys/kernel/tracing/trace_marker", O_WRONLY | O_CLOEXEC);
if (atrace_marker_fd == -1) {
atrace_marker_fd = open("/sys/kernel/tracing/trace_marker", O_WRONLY | O_CLOEXEC);
atrace_marker_fd = open("/sys/kernel/debug/tracing/trace_marker", O_WRONLY | O_CLOEXEC);
}
if (atrace_marker_fd == -1) {