aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/execpath.cpp
diff options
context:
space:
mode:
authornga <nga@yandex-team.ru>2022-02-10 16:48:09 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:09 +0300
commitc2a1af049e9deca890e9923abe64fe6c59060348 (patch)
treeb222e5ac2e2e98872661c51ccceee5da0d291e13 /util/system/execpath.cpp
parent1f553f46fb4f3c5eec631352cdd900a0709016af (diff)
downloadydb-c2a1af049e9deca890e9923abe64fe6c59060348.tar.gz
Restoring authorship annotation for <nga@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/system/execpath.cpp')
-rw-r--r--util/system/execpath.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/util/system/execpath.cpp b/util/system/execpath.cpp
index 836edeb76d..33198af58b 100644
--- a/util/system/execpath.cpp
+++ b/util/system/execpath.cpp
@@ -2,11 +2,11 @@
#include <stdlib.h>
-#if defined(_solaris_)
+#if defined(_solaris_)
#include <stdlib.h>
-#elif defined(_darwin_)
+#elif defined(_darwin_)
#include <mach-o/dyld.h>
-#elif defined(_win_)
+#elif defined(_win_)
#include "winint.h"
#include <io.h>
#elif defined(_linux_)
@@ -16,13 +16,13 @@
#include <sys/types.h> // for u_int not defined in sysctl.h
#include <sys/sysctl.h>
#include <unistd.h>
-#endif
-
+#endif
+
#include <util/folder/dirut.h>
#include <util/generic/singleton.h>
#include <util/generic/function.h>
#include <util/generic/yexception.h>
-#include <util/memory/tempbuf.h>
+#include <util/memory/tempbuf.h>
#include <util/stream/file.h>
#include <util/stream/pipe.h>
#include <util/string/cast.h>
@@ -30,7 +30,7 @@
#include "filemap.h"
#include "execpath.h"
#include "fs.h"
-
+
#if defined(_freebsd_)
static inline bool GoodPath(const TString& path) {
return path.find('/') != TString::npos;
@@ -101,9 +101,9 @@ static inline bool FreeBSDGuessExecBasePath(const TString& guessBasePath, TStrin
#endif
static TString GetExecPathImpl() {
-#if defined(_solaris_)
+#if defined(_solaris_)
return execname();
-#elif defined(_darwin_)
+#elif defined(_darwin_)
TTempBuf execNameBuf;
for (size_t i = 0; i < 2; ++i) {
std::remove_pointer_t<TFunctionArg<decltype(_NSGetExecutablePath), 1>> bufsize = execNameBuf.Size();
@@ -112,10 +112,10 @@ static TString GetExecPathImpl() {
return execNameBuf.Data();
} else if (r == -1) {
execNameBuf = TTempBuf(bufsize);
- }
+ }
}
ythrow yexception() << "GetExecPathImpl() failed";
-#elif defined(_win_)
+#elif defined(_win_)
TTempBuf execNameBuf;
for (;;) {
DWORD r = GetModuleFileName(nullptr, execNameBuf.Data(), execNameBuf.Size());
@@ -125,13 +125,13 @@ static TString GetExecPathImpl() {
ythrow yexception() << "GetExecPathImpl() failed: " << LastSystemErrorText();
} else {
return execNameBuf.Data();
- }
+ }
}
#elif defined(_linux_) || defined(_cygwin_)
TString path("/proc/self/exe");
return NFs::ReadLink(path);
// TODO(yoda): check if the filename ends with " (deleted)"
-#elif defined(_freebsd_)
+#elif defined(_freebsd_)
TString execPath = FreeBSDGetExecPath();
if (GoodPath(execPath)) {
return execPath;
@@ -150,9 +150,9 @@ static TString GetExecPathImpl() {
}
ythrow yexception() << "can not resolve exec path";
-#else
+#else
#error dont know how to implement GetExecPath on this platform
-#endif
+#endif
}
static bool GetPersistentExecPathImpl(TString& to) {
@@ -189,10 +189,10 @@ namespace {
TString PersistentExecPath;
};
}
-
+
const TString& GetExecPath() {
return TExecPathsHolder::Instance()->ExecPath;
-}
+}
const TString& GetPersistentExecPath() {
return TExecPathsHolder::Instance()->PersistentExecPath;