Change path order when trying to open tracing

/sys/kernel/debug/tracing is the old path[1] and only present for
backwards compatibility. Check the new path first otherwise accessing
/sys/kernel/debug/tracing will cause debugfs to be mounted. If
permissions are not set correctly after the mount, the user process may
not have a way to access the trace_marker.

[1] https://www.kernel.org/doc/Documentation/trace/ftrace.txt

Bug: None
Change-Id: Ifbd967c0f7298c8877c23bd4908d172b94f9e2d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96832
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Daniel Nicoara 2019-03-13 23:44:11 +00:00 committed by commit-bot@chromium.org
parent 6483f5238f
commit d1a943281b

View file

@ -28,9 +28,9 @@ static int OpenTraceFD() {
const char* kSystraceDebugPath = "/sys/kernel/debug/tracing/trace_marker";
const char* kSystracePath = "/sys/kernel/tracing/trace_marker";
int fd = TEMP_FAILURE_RETRY(::open(kSystraceDebugPath, O_WRONLY));
int fd = TEMP_FAILURE_RETRY(::open(kSystracePath, O_WRONLY));
if (fd < 0) {
fd = TEMP_FAILURE_RETRY(::open(kSystracePath, O_WRONLY));
fd = TEMP_FAILURE_RETRY(::open(kSystraceDebugPath, O_WRONLY));
}
if (fd < 0 && FLAG_trace_timeline) {