diff options
Diffstat (limited to 'lang/intel-compute-runtime/files/patch-getPath')
-rw-r--r-- | lang/intel-compute-runtime/files/patch-getPath | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lang/intel-compute-runtime/files/patch-getPath b/lang/intel-compute-runtime/files/patch-getPath new file mode 100644 index 000000000000..3b648a653c65 --- /dev/null +++ b/lang/intel-compute-runtime/files/patch-getPath @@ -0,0 +1,38 @@ +Implement getPath on BSDs + +--- shared/offline_compiler/source/utilities/linux/get_path.cpp.orig 2020-02-28 16:16:42 UTC ++++ shared/offline_compiler/source/utilities/linux/get_path.cpp +@@ -10,11 +10,33 @@ + #include <sys/types.h> + #include <unistd.h> + ++#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) ++#include <sys/sysctl.h> ++#endif ++ + std::string getPath() { ++#if defined(KERN_PROC_PATHNAME) ++ char exepath[PATH_MAX + 1] = {0}; ++ size_t len = sizeof(exepath); ++ int mib[] = { ++ CTL_KERN, ++#if defined(__NetBSD__) ++ KERN_PROC_ARGS, ++ -1, ++ KERN_PROC_PATHNAME, ++#else ++ KERN_PROC, ++ KERN_PROC_PATHNAME, ++ -1, ++#endif ++ }; ++ if (sysctl(mib, sizeof(mib)/sizeof(mib[0]), exepath, &len, NULL, 0) != -1) { ++#else // Linux + char exepath[128] = {0}; + std::stringstream ss; + ss << "/proc/" << getpid() << "/exe"; + if (readlink(ss.str().c_str(), exepath, 128) != -1) { ++#endif + std::string path = std::string(exepath); + path = path.substr(0, path.find_last_of('/') + 1); + return path; |