diff options
author | immartynov <immartynov@yandex-team.ru> | 2022-02-10 16:51:52 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:51:52 +0300 |
commit | e9b931bef4870ab86a59bda2ef913c3238f0ba19 (patch) | |
tree | 4241c6bdace6ec3178aba51687814f2abece1f9e /util | |
parent | 45d88ab6257c06a37cf909ba04512ba970eca425 (diff) | |
download | ydb-e9b931bef4870ab86a59bda2ef913c3238f0ba19.tar.gz |
Restoring authorship annotation for <immartynov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util')
-rw-r--r-- | util/system/execpath.cpp | 22 | ||||
-rw-r--r-- | util/system/execpath.h | 22 | ||||
-rw-r--r-- | util/system/execpath_ut.cpp | 4 |
3 files changed, 24 insertions, 24 deletions
diff --git a/util/system/execpath.cpp b/util/system/execpath.cpp index 33198af58b..c5ea4431a3 100644 --- a/util/system/execpath.cpp +++ b/util/system/execpath.cpp @@ -156,24 +156,24 @@ static TString GetExecPathImpl() { } static bool GetPersistentExecPathImpl(TString& to) { -#if defined(_solaris_) +#if defined(_solaris_) to = TString("/proc/self/object/a.out"); return true; #elif defined(_linux_) || defined(_cygwin_) to = TString("/proc/self/exe"); return true; -#elif defined(_freebsd_) +#elif defined(_freebsd_) to = TString("/proc/curproc/file"); return true; #else // defined(_win_) || defined(_darwin_) or unknown Y_UNUSED(to); return false; -#endif -} - +#endif +} + namespace { - struct TExecPathsHolder { - inline TExecPathsHolder() { + struct TExecPathsHolder { + inline TExecPathsHolder() { ExecPath = GetExecPathImpl(); if (!GetPersistentExecPathImpl(PersistentExecPath)) { @@ -186,14 +186,14 @@ namespace { } TString ExecPath; - TString PersistentExecPath; + TString PersistentExecPath; }; } const TString& GetExecPath() { return TExecPathsHolder::Instance()->ExecPath; } - -const TString& GetPersistentExecPath() { + +const TString& GetPersistentExecPath() { return TExecPathsHolder::Instance()->PersistentExecPath; -} +} diff --git a/util/system/execpath.h b/util/system/execpath.h index 4b914b8e85..6acb2776bd 100644 --- a/util/system/execpath.h +++ b/util/system/execpath.h @@ -4,14 +4,14 @@ // NOTE: This function has rare sporadic failures (throws exceptions) on FreeBSD. See REVIEW:54297 const TString& GetExecPath(); - -/** - * Get openable path to the binary currently being executed. - * - * The path does not match the original binary location, but stays openable even - * if the binary was moved or removed. - * - * On UNIX variants, utilizes the /proc FS. On Windows, equivalent to - * GetExecPath. - */ -const TString& GetPersistentExecPath(); + +/** + * Get openable path to the binary currently being executed. + * + * The path does not match the original binary location, but stays openable even + * if the binary was moved or removed. + * + * On UNIX variants, utilizes the /proc FS. On Windows, equivalent to + * GetExecPath. + */ +const TString& GetPersistentExecPath(); diff --git a/util/system/execpath_ut.cpp b/util/system/execpath_ut.cpp index 16b01466f5..8278adb6c4 100644 --- a/util/system/execpath_ut.cpp +++ b/util/system/execpath_ut.cpp @@ -8,11 +8,11 @@ Y_UNIT_TEST_SUITE(TExecPathTest) { Y_UNIT_TEST(TestIt) { TString execPath = GetExecPath(); - TString persistentExecPath = GetPersistentExecPath(); + TString persistentExecPath = GetPersistentExecPath(); try { UNIT_ASSERT(NFs::Exists(execPath)); - UNIT_ASSERT(NFs::Exists(persistentExecPath)); + UNIT_ASSERT(NFs::Exists(persistentExecPath)); } catch (...) { Cerr << execPath << Endl; |