A function added by the next commit will want to call this code too. Signed-off-by: Luiz Capitulino <lcapitulino@xxxxxxxxxx> --- src/cyclictest/cyclictest.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index 4e80831..65f2aec 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -532,6 +532,19 @@ static void debugfs_prepare(void) fileprefix = procfileprefix; } +static void open_tracemark_fd(void) +{ + char path[MAX_PATH]; + + if (tracemark_fd >= 0) + return; + + sprintf(path, "%s/%s", fileprefix, "trace_marker"); + tracemark_fd = open(path, O_WRONLY); + if (tracemark_fd < 0) + warn("unable to open trace_marker file: %s\n", path); +} + static void setup_tracer(void) { if (!tracelimit || notrace) @@ -647,14 +660,7 @@ static void setup_tracer(void) fatal("unable to open %s for tracing", path); } - /* open the tracemark file descriptor */ - if (tracemark_fd == -1) { - char path[MAX_PATH]; - strcat(strcpy(path, fileprefix), "trace_marker"); - if ((tracemark_fd = open(path, O_WRONLY)) == -1) - warn("unable to open trace_marker file: %s\n", path); - } - + open_tracemark_fd(); } else { setkernvar("trace_all_cpus", "1"); setkernvar("trace_freerunning", "1"); -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html