From 2ed7ef9fc71d40405bf1302e2a179567cf4a3837 Mon Sep 17 00:00:00 2001 From: Hariharan Devarajan Date: Thu, 5 Oct 2023 22:21:39 -0700 Subject: [PATCH] remove usage of realpath --- src/dlio_profiler/brahma/posix.h | 10 ++-------- src/dlio_profiler/brahma/stdio.h | 10 ++-------- src/dlio_profiler/utils/utils.h | 17 +++++++---------- 3 files changed, 11 insertions(+), 26 deletions(-) diff --git a/src/dlio_profiler/brahma/posix.h b/src/dlio_profiler/brahma/posix.h index e5b29cd1..3a11dd77 100644 --- a/src/dlio_profiler/brahma/posix.h +++ b/src/dlio_profiler/brahma/posix.h @@ -46,16 +46,10 @@ class POSIXDLIOProfiler : public POSIX { logger = DLIO_LOGGER_INIT(); } inline void trace(const char* filename) { - char resolved_path[PATH_MAX]; - char* data = realpath(filename, resolved_path); - (void) data; - track_filename.push_back(resolved_path); + track_filename.push_back(filename); } inline void untrace(const char* filename) { - char resolved_path[PATH_MAX]; - char* data = realpath(filename, resolved_path); - (void) data; - ignore_filename.push_back(resolved_path); + ignore_filename.push_back(filename); } ~POSIXDLIOProfiler() override = default; static std::shared_ptr get_instance() { diff --git a/src/dlio_profiler/brahma/stdio.h b/src/dlio_profiler/brahma/stdio.h index 40101a48..53263764 100644 --- a/src/dlio_profiler/brahma/stdio.h +++ b/src/dlio_profiler/brahma/stdio.h @@ -44,16 +44,10 @@ class STDIODLIOProfiler : public STDIO { } inline void trace(const char* filename) { - char resolved_path[PATH_MAX]; - char* data = realpath(filename, resolved_path); - (void) data; - track_filename.push_back(resolved_path); + track_filename.push_back(filename); } inline void untrace(const char* filename) { - char resolved_path[PATH_MAX]; - char* data = realpath(filename, resolved_path); - (void) data; - ignore_filename.push_back(resolved_path); + ignore_filename.push_back(filename); } ~STDIODLIOProfiler() = default; diff --git a/src/dlio_profiler/utils/utils.h b/src/dlio_profiler/utils/utils.h index 0d07dcf7..30bd2961 100644 --- a/src/dlio_profiler/utils/utils.h +++ b/src/dlio_profiler/utils/utils.h @@ -50,30 +50,27 @@ inline std::pair is_traced_common(const char* filename, const const std::vector& track_filename) { bool found = false; bool ignore = false; - char resolved_path[PATH_MAX]; - char* data = realpath(filename, resolved_path); - (void) data; - if (ignore_files(resolved_path) || ignore_files(filename)) { - DLIO_PROFILER_LOGINFO("Profiler ignoring file %s for func %s", resolved_path, func); + if (ignore_files(filename)) { + DLIO_PROFILER_LOGINFO("Profiler ignoring file %s for func %s", filename, func); return std::pair(false, filename); } for (const auto file : ignore_filename) { - if (strstr(resolved_path, file.c_str()) != NULL) { - DLIO_PROFILER_LOGINFO("Profiler Intercepted POSIX not file %s for func %s", resolved_path, func); + if (strstr(filename, file.c_str()) != NULL) { + DLIO_PROFILER_LOGINFO("Profiler Intercepted POSIX not file %s for func %s", filename, func); ignore = true; break; } } if (!ignore) { for (const auto file : track_filename) { - if (strstr(resolved_path, file.c_str()) != NULL) { - DLIO_PROFILER_LOGINFO("Profiler Intercepted POSIX tracing file %s for func %s", resolved_path, func); + if (strstr(filename, file.c_str()) != NULL) { + DLIO_PROFILER_LOGINFO("Profiler Intercepted POSIX tracing file %s for func %s", filename, func); found = true; break; } } } - if (!found and !ignore) DLIO_PROFILER_LOGINFO("Profiler Intercepted POSIX not tracing file %s for func %s", resolved_path, func); + if (!found and !ignore) DLIO_PROFILER_LOGINFO("Profiler Intercepted POSIX not tracing file %s for func %s", filename, func); return std::pair(found, filename); } #endif // DLIO_PROFILER_UTILS_H