diff options
| author | alexnick <[email protected]> | 2022-02-17 14:23:34 +0300 |
|---|---|---|
| committer | alexnick <[email protected]> | 2022-02-17 14:23:34 +0300 |
| commit | fd03a905d0671edeffde43ade486dc608bf69d95 (patch) | |
| tree | d01659ada27349df9be25f8a8d5dab4f9ec4cd12 /library/cpp/tvmauth/client/misc/proc_info.cpp | |
| parent | 3dba88133a0e2bf63394fdba2affc51a771eff03 (diff) | |
remove tvm dependecy KIKIMR-14386
ref:d40a6e54d3da55ed1f9c9a0763552940acb0988b
Diffstat (limited to 'library/cpp/tvmauth/client/misc/proc_info.cpp')
| -rw-r--r-- | library/cpp/tvmauth/client/misc/proc_info.cpp | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/library/cpp/tvmauth/client/misc/proc_info.cpp b/library/cpp/tvmauth/client/misc/proc_info.cpp deleted file mode 100644 index e2e5ec15b9e..00000000000 --- a/library/cpp/tvmauth/client/misc/proc_info.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include "proc_info.h" - -#include <library/cpp/tvmauth/version.h> - -#include <library/cpp/string_utils/quote/quote.h> - -#include <util/stream/file.h> -#include <util/string/cast.h> -#include <util/system/getpid.h> - -namespace NTvmAuth::NUtils { - void TProcInfo::AddToRequest(IOutputStream& out) const { - out << "_pid=" << Pid; - if (ProcessName) { - out << "&_procces_name=" << *ProcessName; - } - out << "&lib_version=client_" << VersionPrefix << LibVersion(); - } - - TProcInfo TProcInfo::Create(const TString& versionPrefix) { - TProcInfo res; - res.Pid = IntToString<10>(GetPID()); - res.ProcessName = GetProcessName(); - res.VersionPrefix = versionPrefix; - return res; - } - - std::optional<TString> TProcInfo::GetProcessName() { - try { - // works only for linux - TFileInput proc("/proc/self/status"); - - TString line; - while (proc.ReadLine(line)) { - TStringBuf buf(line); - if (!buf.SkipPrefix("Name:")) { - continue; - } - - while (buf && isspace(buf.front())) { - buf.Skip(1); - } - - TString res(buf); - CGIEscape(res); - return res; - } - } catch (...) { - } - - return {}; - } -} |
