aboutsummaryrefslogtreecommitdiffstats
path: root/util/system
diff options
context:
space:
mode:
authorakhropov <akhropov@yandex-team.ru>2022-02-10 16:46:32 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:32 +0300
commit298c6da79f1d8f35089a67f463f0b541bec36d9b (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/system
parent00afc96e9c0298054b7386fa7fb9e3cc3d67b974 (diff)
downloadydb-298c6da79f1d8f35089a67f463f0b541bec36d9b.tar.gz
Restoring authorship annotation for <akhropov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/system')
-rw-r--r--util/system/compat.cpp6
-rw-r--r--util/system/compat.h8
-rw-r--r--util/system/execpath.cpp114
-rw-r--r--util/system/execpath_ut.cpp2
-rw-r--r--util/system/info.cpp44
-rw-r--r--util/system/interrupt_signals.cpp118
-rw-r--r--util/system/interrupt_signals.h36
-rw-r--r--util/system/interrupt_signals_ut.cpp86
-rw-r--r--util/system/mktemp_system.cpp24
-rw-r--r--util/system/platform.h6
-rw-r--r--util/system/progname.cpp2
-rw-r--r--util/system/rusage.cpp2
-rw-r--r--util/system/shellcommand_ut.cpp2
-rw-r--r--util/system/user.cpp58
-rw-r--r--util/system/user.h6
-rw-r--r--util/system/ut/ya.make2
16 files changed, 258 insertions, 258 deletions
diff --git a/util/system/compat.cpp b/util/system/compat.cpp
index 1c8c9b5289..18fbfa296a 100644
--- a/util/system/compat.cpp
+++ b/util/system/compat.cpp
@@ -17,11 +17,11 @@
#endif
#ifndef HAVE_NATIVE_GETPROGNAME
-const char* getprogname() {
+const char* getprogname() {
return GetProgramName().data();
-}
+}
#endif
-
+
#ifdef _win_
void sleep(i64 len) {
diff --git a/util/system/compat.h b/util/system/compat.h
index 205e79c8f6..c53dbcca17 100644
--- a/util/system/compat.h
+++ b/util/system/compat.h
@@ -12,8 +12,8 @@
#if defined(_win_)
#include <process.h>
-#endif
-
+#endif
+
extern "C" {
#if defined(_win_)
using pid_t = int;
@@ -34,8 +34,8 @@ extern "C" {
#ifndef HAVE_NATIVE_GETPROGNAME
const char* getprogname();
-#endif
-
+#endif
+
#if defined(_MSC_VER)
void err(int e, const char* m, ...);
void errx(int e, const char* m, ...);
diff --git a/util/system/execpath.cpp b/util/system/execpath.cpp
index 7cff2d5973..33198af58b 100644
--- a/util/system/execpath.cpp
+++ b/util/system/execpath.cpp
@@ -9,9 +9,9 @@
#elif defined(_win_)
#include "winint.h"
#include <io.h>
-#elif defined(_linux_)
+#elif defined(_linux_)
#include <unistd.h>
-#elif defined(_freebsd_)
+#elif defined(_freebsd_)
#include <string.h>
#include <sys/types.h> // for u_int not defined in sysctl.h
#include <sys/sysctl.h>
@@ -28,7 +28,7 @@
#include <util/string/cast.h>
#include "filemap.h"
-#include "execpath.h"
+#include "execpath.h"
#include "fs.h"
#if defined(_freebsd_)
@@ -36,28 +36,28 @@ static inline bool GoodPath(const TString& path) {
return path.find('/') != TString::npos;
}
-static inline int FreeBSDSysCtl(int* mib, size_t mibSize, TTempBuf& res) {
- for (size_t i = 0; i < 2; ++i) {
- size_t cb = res.Size();
+static inline int FreeBSDSysCtl(int* mib, size_t mibSize, TTempBuf& res) {
+ for (size_t i = 0; i < 2; ++i) {
+ size_t cb = res.Size();
if (sysctl(mib, mibSize, res.Data(), &cb, nullptr, 0) == 0) {
- res.Proceed(cb);
- return 0;
- } else if (errno == ENOMEM) {
- res = TTempBuf(cb);
- } else {
- return errno;
- }
+ res.Proceed(cb);
+ return 0;
+ } else if (errno == ENOMEM) {
+ res = TTempBuf(cb);
+ } else {
+ return errno;
+ }
}
- return errno;
+ return errno;
}
static inline TString FreeBSDGetExecPath() {
int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
- TTempBuf buf;
+ TTempBuf buf;
int r = FreeBSDSysCtl(mib, Y_ARRAY_SIZE(mib), buf);
- if (r == 0) {
+ if (r == 0) {
return TString(buf.Data(), buf.Filled() - 1);
- } else if (r == ENOTSUP) { // older FreeBSD version
+ } else if (r == ENOTSUP) { // older FreeBSD version
/*
* BSD analogue for /proc/self is /proc/curproc.
* See:
@@ -65,7 +65,7 @@ static inline TString FreeBSDGetExecPath() {
*/
TString path("/proc/curproc/file");
return NFs::ReadLink(path);
- } else {
+ } else {
return TString();
}
}
@@ -74,56 +74,56 @@ static inline TString FreeBSDGetArgv0() {
int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_ARGS, getpid()};
TTempBuf buf;
int r = FreeBSDSysCtl(mib, Y_ARRAY_SIZE(mib), buf);
- if (r == 0) {
+ if (r == 0) {
return TString(buf.Data());
- } else if (r == ENOTSUP) {
+ } else if (r == ENOTSUP) {
return TString();
- } else {
- ythrow yexception() << "FreeBSDGetArgv0() failed: " << LastSystemErrorText();
- }
+ } else {
+ ythrow yexception() << "FreeBSDGetArgv0() failed: " << LastSystemErrorText();
+ }
}
static inline bool FreeBSDGuessExecPath(const TString& guessPath, TString& execPath) {
if (NFs::Exists(guessPath)) {
- // now it should work for real
- execPath = FreeBSDGetExecPath();
- if (RealPath(execPath) == RealPath(guessPath)) {
- return true;
- }
- }
- return false;
-}
-
+ // now it should work for real
+ execPath = FreeBSDGetExecPath();
+ if (RealPath(execPath) == RealPath(guessPath)) {
+ return true;
+ }
+ }
+ return false;
+}
+
static inline bool FreeBSDGuessExecBasePath(const TString& guessBasePath, TString& execPath) {
return FreeBSDGuessExecPath(TString(guessBasePath) + "/" + getprogname(), execPath);
-}
-
+}
+
#endif
static TString GetExecPathImpl() {
#if defined(_solaris_)
return execname();
#elif defined(_darwin_)
- TTempBuf execNameBuf;
- for (size_t i = 0; i < 2; ++i) {
+ TTempBuf execNameBuf;
+ for (size_t i = 0; i < 2; ++i) {
std::remove_pointer_t<TFunctionArg<decltype(_NSGetExecutablePath), 1>> bufsize = execNameBuf.Size();
int r = _NSGetExecutablePath(execNameBuf.Data(), &bufsize);
if (r == 0) {
return execNameBuf.Data();
- } else if (r == -1) {
- execNameBuf = TTempBuf(bufsize);
+ } else if (r == -1) {
+ execNameBuf = TTempBuf(bufsize);
}
}
- ythrow yexception() << "GetExecPathImpl() failed";
+ ythrow yexception() << "GetExecPathImpl() failed";
#elif defined(_win_)
- TTempBuf execNameBuf;
+ TTempBuf execNameBuf;
for (;;) {
DWORD r = GetModuleFileName(nullptr, execNameBuf.Data(), execNameBuf.Size());
- if (r == execNameBuf.Size()) {
- execNameBuf = TTempBuf(execNameBuf.Size() * 2);
- } else if (r == 0) {
- ythrow yexception() << "GetExecPathImpl() failed: " << LastSystemErrorText();
- } else {
+ if (r == execNameBuf.Size()) {
+ execNameBuf = TTempBuf(execNameBuf.Size() * 2);
+ } else if (r == 0) {
+ ythrow yexception() << "GetExecPathImpl() failed: " << LastSystemErrorText();
+ } else {
return execNameBuf.Data();
}
}
@@ -133,23 +133,23 @@ static TString GetExecPathImpl() {
// TODO(yoda): check if the filename ends with " (deleted)"
#elif defined(_freebsd_)
TString execPath = FreeBSDGetExecPath();
- if (GoodPath(execPath)) {
- return execPath;
+ if (GoodPath(execPath)) {
+ return execPath;
+ }
+ if (FreeBSDGuessExecPath(FreeBSDGetArgv0(), execPath)) {
+ return execPath;
}
- if (FreeBSDGuessExecPath(FreeBSDGetArgv0(), execPath)) {
- return execPath;
+ if (FreeBSDGuessExecPath(getenv("_"), execPath)) {
+ return execPath;
}
- if (FreeBSDGuessExecPath(getenv("_"), execPath)) {
- return execPath;
+ if (FreeBSDGuessExecBasePath(getenv("PWD"), execPath)) {
+ return execPath;
}
- if (FreeBSDGuessExecBasePath(getenv("PWD"), execPath)) {
- return execPath;
- }
if (FreeBSDGuessExecBasePath(NFs::CurrentWorkingDirectory(), execPath)) {
- return execPath;
- }
+ return execPath;
+ }
- ythrow yexception() << "can not resolve exec path";
+ ythrow yexception() << "can not resolve exec path";
#else
#error dont know how to implement GetExecPath on this platform
#endif
diff --git a/util/system/execpath_ut.cpp b/util/system/execpath_ut.cpp
index d83523de15..16b01466f5 100644
--- a/util/system/execpath_ut.cpp
+++ b/util/system/execpath_ut.cpp
@@ -14,7 +14,7 @@ Y_UNIT_TEST_SUITE(TExecPathTest) {
UNIT_ASSERT(NFs::Exists(execPath));
UNIT_ASSERT(NFs::Exists(persistentExecPath));
} catch (...) {
- Cerr << execPath << Endl;
+ Cerr << execPath << Endl;
throw;
}
diff --git a/util/system/info.cpp b/util/system/info.cpp
index dacad12282..cf6681e89a 100644
--- a/util/system/info.cpp
+++ b/util/system/info.cpp
@@ -1,7 +1,7 @@
#include "info.h"
-#include "error.h"
-
+#include "error.h"
+
#include <cstdlib>
#if defined(_linux_) || defined(_cygwin_)
@@ -26,7 +26,7 @@ static int getloadavg(double* loadavg, int nelem) {
return nelem;
}
-#elif defined(_unix_) || defined(_darwin_)
+#elif defined(_unix_) || defined(_darwin_)
#include <sys/types.h>
#endif
@@ -38,7 +38,7 @@ static int getloadavg(double* loadavg, int nelem) {
#include <util/string/cast.h>
#include <util/string/strip.h>
#include <util/stream/file.h>
-#include <util/generic/yexception.h>
+#include <util/generic/yexception.h>
#if defined(_linux_)
static inline size_t CgroupCpus() {
@@ -204,25 +204,25 @@ size_t NSystemInfo::TotalMemorySize() {
sysinfo(&info);
return info.totalram;
#elif defined(_darwin_)
- int mib[2];
- int64_t memSize;
- size_t length;
-
- // Get the Physical memory size
- mib[0] = CTL_HW;
- mib[1] = HW_MEMSIZE;
- length = sizeof(int64_t);
- if (sysctl(mib, 2, &memSize, &length, NULL, 0) != 0) {
- ythrow yexception() << "sysctl failed: " << LastSystemErrorText();
- }
- return (size_t)memSize;
+ int mib[2];
+ int64_t memSize;
+ size_t length;
+
+ // Get the Physical memory size
+ mib[0] = CTL_HW;
+ mib[1] = HW_MEMSIZE;
+ length = sizeof(int64_t);
+ if (sysctl(mib, 2, &memSize, &length, NULL, 0) != 0) {
+ ythrow yexception() << "sysctl failed: " << LastSystemErrorText();
+ }
+ return (size_t)memSize;
#elif defined(_win_)
- MEMORYSTATUSEX memoryStatusEx;
- memoryStatusEx.dwLength = sizeof(memoryStatusEx);
- if (!GlobalMemoryStatusEx(&memoryStatusEx)) {
- ythrow yexception() << "GlobalMemoryStatusEx failed: " << LastSystemErrorText();
- }
- return (size_t)memoryStatusEx.ullTotalPhys;
+ MEMORYSTATUSEX memoryStatusEx;
+ memoryStatusEx.dwLength = sizeof(memoryStatusEx);
+ if (!GlobalMemoryStatusEx(&memoryStatusEx)) {
+ ythrow yexception() << "GlobalMemoryStatusEx failed: " << LastSystemErrorText();
+ }
+ return (size_t)memoryStatusEx.ullTotalPhys;
#else
return 0;
#endif
diff --git a/util/system/interrupt_signals.cpp b/util/system/interrupt_signals.cpp
index 61ff8dd720..96b723f2b8 100644
--- a/util/system/interrupt_signals.cpp
+++ b/util/system/interrupt_signals.cpp
@@ -1,60 +1,60 @@
-#include "interrupt_signals.h"
-
-#include "compiler.h"
-#include "error.h"
-
-#include <util/generic/yexception.h>
-
-#include <csignal>
-
-static void (*InterruptSignalsHandler)(int signum) = nullptr;
-
-#ifdef _win_
-
+#include "interrupt_signals.h"
+
+#include "compiler.h"
+#include "error.h"
+
+#include <util/generic/yexception.h>
+
+#include <csignal>
+
+static void (*InterruptSignalsHandler)(int signum) = nullptr;
+
+#ifdef _win_
+
#include <windows.h>
-
-static BOOL WINAPI WindowsSignalsHandler(_In_ DWORD dwCtrlType) {
- if (!InterruptSignalsHandler) {
- return FALSE;
- }
-
- switch (dwCtrlType) {
- case CTRL_C_EVENT:
- InterruptSignalsHandler(SIGINT);
- return TRUE;
- case CTRL_BREAK_EVENT:
- InterruptSignalsHandler(SIGTERM);
- return TRUE;
- case CTRL_CLOSE_EVENT:
- InterruptSignalsHandler(SIGHUP);
- return TRUE;
- default:
- return FALSE;
- }
- Y_UNREACHABLE();
-}
-
-#endif
-
-// separate function is to enforce 'extern "C"' linkage
-extern "C" void CppSignalsHandler(int signum) {
- if (InterruptSignalsHandler) {
- InterruptSignalsHandler(signum);
- }
-}
-
-void SetInterruptSignalsHandler(void (*handler)(int signum)) {
- InterruptSignalsHandler = handler;
-#ifdef _win_
- if (!SetConsoleCtrlHandler(WindowsSignalsHandler, TRUE)) {
- ythrow TSystemError() << "SetConsoleCtrlHandler failed: " << LastSystemErrorText();
- }
- for (int signum : {SIGINT, SIGTERM}) {
-#else
- for (int signum : {SIGINT, SIGTERM, SIGHUP}) {
-#endif
- if (std::signal(signum, CppSignalsHandler) == SIG_ERR) {
- ythrow TSystemError() << "std::signal failed to set handler for signal with id " << signum;
- }
- }
-}
+
+static BOOL WINAPI WindowsSignalsHandler(_In_ DWORD dwCtrlType) {
+ if (!InterruptSignalsHandler) {
+ return FALSE;
+ }
+
+ switch (dwCtrlType) {
+ case CTRL_C_EVENT:
+ InterruptSignalsHandler(SIGINT);
+ return TRUE;
+ case CTRL_BREAK_EVENT:
+ InterruptSignalsHandler(SIGTERM);
+ return TRUE;
+ case CTRL_CLOSE_EVENT:
+ InterruptSignalsHandler(SIGHUP);
+ return TRUE;
+ default:
+ return FALSE;
+ }
+ Y_UNREACHABLE();
+}
+
+#endif
+
+// separate function is to enforce 'extern "C"' linkage
+extern "C" void CppSignalsHandler(int signum) {
+ if (InterruptSignalsHandler) {
+ InterruptSignalsHandler(signum);
+ }
+}
+
+void SetInterruptSignalsHandler(void (*handler)(int signum)) {
+ InterruptSignalsHandler = handler;
+#ifdef _win_
+ if (!SetConsoleCtrlHandler(WindowsSignalsHandler, TRUE)) {
+ ythrow TSystemError() << "SetConsoleCtrlHandler failed: " << LastSystemErrorText();
+ }
+ for (int signum : {SIGINT, SIGTERM}) {
+#else
+ for (int signum : {SIGINT, SIGTERM, SIGHUP}) {
+#endif
+ if (std::signal(signum, CppSignalsHandler) == SIG_ERR) {
+ ythrow TSystemError() << "std::signal failed to set handler for signal with id " << signum;
+ }
+ }
+}
diff --git a/util/system/interrupt_signals.h b/util/system/interrupt_signals.h
index e38f95908d..9f9c2427f1 100644
--- a/util/system/interrupt_signals.h
+++ b/util/system/interrupt_signals.h
@@ -1,22 +1,22 @@
-#pragma once
-
-#include "platform.h"
-
-#include <csignal>
-
-#ifdef _win_
- #ifndef SIGHUP
+#pragma once
+
+#include "platform.h"
+
+#include <csignal>
+
+#ifdef _win_
+ #ifndef SIGHUP
#define SIGHUP 1 /* Hangup (POSIX). */
- #endif
-#endif
-
+ #endif
+#endif
+
/**
- * Set handler for interrupt signals.
- *
- * All OSes: SIGINT, SIGTERM (defined by C++ standard)
- * UNIX variants: Also SIGHUP
- * Windows: CTRL_C_EVENT handled as SIGINT, CTRL_BREAK_EVENT as SIGTERM, CTRL_CLOSE_EVENT as SIGHUP
+ * Set handler for interrupt signals.
+ *
+ * All OSes: SIGINT, SIGTERM (defined by C++ standard)
+ * UNIX variants: Also SIGHUP
+ * Windows: CTRL_C_EVENT handled as SIGINT, CTRL_BREAK_EVENT as SIGTERM, CTRL_CLOSE_EVENT as SIGHUP
*
* \param handler Signal handler to use. Pass nullptr to clear currently set handler.
- */
-void SetInterruptSignalsHandler(void (*handler)(int signum));
+ */
+void SetInterruptSignalsHandler(void (*handler)(int signum));
diff --git a/util/system/interrupt_signals_ut.cpp b/util/system/interrupt_signals_ut.cpp
index 822c290e82..bec54fec61 100644
--- a/util/system/interrupt_signals_ut.cpp
+++ b/util/system/interrupt_signals_ut.cpp
@@ -1,46 +1,46 @@
-#include "interrupt_signals.h"
-
-#include "atomic.h"
-
-#include <util/datetime/base.h>
-
+#include "interrupt_signals.h"
+
+#include "atomic.h"
+
+#include <util/datetime/base.h>
+
#include <library/cpp/testing/unittest/registar.h>
-
-#ifdef _win_
- #include <windows.h>
-#endif
-
+
+#ifdef _win_
+ #include <windows.h>
+#endif
+
Y_UNIT_TEST_SUITE(TTestInterruptSignals) {
- static TAtomic HandledSigNum = 0;
-
- static void Handler(int signum) {
- AtomicSet(HandledSigNum, signum);
- }
-
+ static TAtomic HandledSigNum = 0;
+
+ static void Handler(int signum) {
+ AtomicSet(HandledSigNum, signum);
+ }
+
Y_UNIT_TEST(Test1) {
- SetInterruptSignalsHandler(Handler);
-#ifdef _win_
- // TODO: unfortunately GenerateConsoleCtrlEvent fails under Wine
- /*
- for (auto [winEvent, posixSigNum] : {
- std::make_pair(CTRL_C_EVENT, SIGINT),
- std::make_pair(CTRL_BREAK_EVENT, SIGTERM)
- })
- {
- if (!GenerateConsoleCtrlEvent(winEvent, 0)) {
- UNIT_FAIL("GenerateConsoleCtrlEvent failed: " << LastSystemErrorText());
- }
- Sleep(TDuration::MilliSeconds(100));
- UNIT_ASSERT_VALUES_EQUAL(HandledSigNum, posixSigNum);
- }
- */
- for (int signum : {SIGINT, SIGTERM}) {
-#else
- for (int signum : {SIGINT, SIGTERM, SIGHUP}) {
-#endif
- std::raise(signum);
- Sleep(TDuration::MilliSeconds(100)); // give it time to handle an async signal
- UNIT_ASSERT_VALUES_EQUAL(HandledSigNum, signum);
- }
- }
-}
+ SetInterruptSignalsHandler(Handler);
+#ifdef _win_
+ // TODO: unfortunately GenerateConsoleCtrlEvent fails under Wine
+ /*
+ for (auto [winEvent, posixSigNum] : {
+ std::make_pair(CTRL_C_EVENT, SIGINT),
+ std::make_pair(CTRL_BREAK_EVENT, SIGTERM)
+ })
+ {
+ if (!GenerateConsoleCtrlEvent(winEvent, 0)) {
+ UNIT_FAIL("GenerateConsoleCtrlEvent failed: " << LastSystemErrorText());
+ }
+ Sleep(TDuration::MilliSeconds(100));
+ UNIT_ASSERT_VALUES_EQUAL(HandledSigNum, posixSigNum);
+ }
+ */
+ for (int signum : {SIGINT, SIGTERM}) {
+#else
+ for (int signum : {SIGINT, SIGTERM, SIGHUP}) {
+#endif
+ std::raise(signum);
+ Sleep(TDuration::MilliSeconds(100)); // give it time to handle an async signal
+ UNIT_ASSERT_VALUES_EQUAL(HandledSigNum, signum);
+ }
+ }
+}
diff --git a/util/system/mktemp_system.cpp b/util/system/mktemp_system.cpp
index 03a16254a4..32bea2987c 100644
--- a/util/system/mktemp_system.cpp
+++ b/util/system/mktemp_system.cpp
@@ -41,13 +41,13 @@
#include <string.h>
#include <ctype.h>
-#ifdef _win32_
+#ifdef _win32_
#include "winint.h"
#include <util/folder/dirut.h>
#else
- #include <unistd.h>
-#endif
-
+ #include <unistd.h>
+#endif
+
#include <util/random/random.h>
#include "sysstat.h"
@@ -59,10 +59,10 @@ GetTemp(char* path, int* doopen, int domkdir, int slen)
{
char *start, *trv, *suffp;
char* pad;
-#ifndef _win32_
+#ifndef _win32_
struct stat sbuf;
int rval;
-#endif
+#endif
ui32 rand;
if (doopen != nullptr && domkdir) {
@@ -95,7 +95,7 @@ GetTemp(char* path, int* doopen, int domkdir, int slen)
for (; trv > path; --trv) {
if (*trv == '/') {
*trv = '\0';
-#ifdef _win32_
+#ifdef _win32_
ui32 attr = ::GetFileAttributesA(path);
*trv = '/';
if (attr == 0xFFFFFFFF)
@@ -104,7 +104,7 @@ GetTemp(char* path, int* doopen, int domkdir, int slen)
errno = ENOTDIR;
return (0);
}
-#else
+#else
rval = stat(path, &sbuf);
*trv = '/';
if (rval != 0) {
@@ -114,7 +114,7 @@ GetTemp(char* path, int* doopen, int domkdir, int slen)
errno = ENOTDIR;
return (0);
}
-#endif
+#endif
break;
}
}
@@ -137,14 +137,14 @@ GetTemp(char* path, int* doopen, int domkdir, int slen)
return (0);
}
} else
-#ifdef _win32_
+#ifdef _win32_
if (::GetFileAttributesA(path) == INVALID_FILE_ATTRIBUTES)
return (errno == ENOENT);
-#else
+#else
if (lstat(path, &sbuf)) {
return (errno == ENOENT);
}
-#endif
+#endif
/* If we have a collision, cycle through the space of filenames */
for (trv = start;;) {
if (*trv == '\0' || trv == suffp) {
diff --git a/util/system/platform.h b/util/system/platform.h
index 5c4abea622..58f310ab34 100644
--- a/util/system/platform.h
+++ b/util/system/platform.h
@@ -138,10 +138,10 @@
#define _sse2_
#endif
-#if defined(__SSE3__) || defined(SSE3_ENABLED)
+#if defined(__SSE3__) || defined(SSE3_ENABLED)
#define _sse3_
-#endif
-
+#endif
+
#if defined(__SSSE3__) || defined(SSSE3_ENABLED)
#define _ssse3_
#endif
diff --git a/util/system/progname.cpp b/util/system/progname.cpp
index 4e3a173a64..2c29119320 100644
--- a/util/system/progname.cpp
+++ b/util/system/progname.cpp
@@ -1,4 +1,4 @@
-#include "execpath.h"
+#include "execpath.h"
#include "progname.h"
#include <util/folder/dirut.h>
diff --git a/util/system/rusage.cpp b/util/system/rusage.cpp
index 800a685cb9..2befeca875 100644
--- a/util/system/rusage.cpp
+++ b/util/system/rusage.cpp
@@ -109,7 +109,7 @@ void TRusage::Fill() {
}
#if defined(_darwin_)
- // see https://lists.apple.com/archives/darwin-kernel/2009/Mar/msg00005.html
+ // see https://lists.apple.com/archives/darwin-kernel/2009/Mar/msg00005.html
MaxRss = ru.ru_maxrss;
#else
MaxRss = ru.ru_maxrss * 1024LL;
diff --git a/util/system/shellcommand_ut.cpp b/util/system/shellcommand_ut.cpp
index 458ecd0025..9d849279d2 100644
--- a/util/system/shellcommand_ut.cpp
+++ b/util/system/shellcommand_ut.cpp
@@ -298,7 +298,7 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) {
// this ut is unix-only, port to win using %TEMP%
Y_UNIT_TEST(TestInterrupt) {
TString tmpfile = TString("shellcommand_ut.interrupt.") + ToString(RandomNumber<ui32>());
-
+
TShellCommandOptions options;
options.SetAsync(true);
options.SetQuoteArguments(false);
diff --git a/util/system/user.cpp b/util/system/user.cpp
index 8c66a8ce95..83e89ea0a8 100644
--- a/util/system/user.cpp
+++ b/util/system/user.cpp
@@ -1,18 +1,18 @@
-#include "user.h"
-#include "platform.h"
-#include "defaults.h"
+#include "user.h"
+#include "platform.h"
+#include "defaults.h"
#include "env.h"
-
-#include <util/generic/yexception.h>
-
-#ifdef _win_
+
+#include <util/generic/yexception.h>
+
+#ifdef _win_
#include "winint.h"
-#else
+#else
#include <errno.h>
#include <pwd.h>
#include <unistd.h>
-#endif
-
+#endif
+
TString GetUsername() {
for (const auto& var : {"LOGNAME", "USER", "LNAME", "USERNAME"}) {
TString val = GetEnv(var);
@@ -21,19 +21,19 @@ TString GetUsername() {
}
}
- TTempBuf nameBuf;
- for (;;) {
-#if defined(_win_)
- DWORD len = (DWORD)Min(nameBuf.Size(), size_t(32767));
+ TTempBuf nameBuf;
+ for (;;) {
+#if defined(_win_)
+ DWORD len = (DWORD)Min(nameBuf.Size(), size_t(32767));
if (!GetUserNameA(nameBuf.Data(), &len)) {
- DWORD err = GetLastError();
- if ((err == ERROR_INSUFFICIENT_BUFFER) && (nameBuf.Size() <= 32767))
- nameBuf = TTempBuf((size_t)len);
- else
- ythrow TSystemError(err) << " GetUserName failed";
- } else {
+ DWORD err = GetLastError();
+ if ((err == ERROR_INSUFFICIENT_BUFFER) && (nameBuf.Size() <= 32767))
+ nameBuf = TTempBuf((size_t)len);
+ else
+ ythrow TSystemError(err) << " GetUserName failed";
+ } else {
return TString(nameBuf.Data(), (size_t)(len - 1));
- }
+ }
#elif defined(_bionic_)
const passwd* pwd = getpwuid(geteuid());
@@ -43,16 +43,16 @@ TString GetUsername() {
ythrow TSystemError() << TStringBuf(" getpwuid failed");
#else
- passwd pwd;
- passwd* tmpPwd;
- int err = getpwuid_r(geteuid(), &pwd, nameBuf.Data(), nameBuf.Size(), &tmpPwd);
+ passwd pwd;
+ passwd* tmpPwd;
+ int err = getpwuid_r(geteuid(), &pwd, nameBuf.Data(), nameBuf.Size(), &tmpPwd);
if (err == 0 && tmpPwd) {
return TString(pwd.pw_name);
} else if (err == ERANGE) {
nameBuf = TTempBuf(nameBuf.Size() * 2);
- } else {
+ } else {
ythrow TSystemError(err) << " getpwuid_r failed";
- }
-#endif
- }
-}
+ }
+#endif
+ }
+}
diff --git a/util/system/user.h b/util/system/user.h
index e426a79a9e..be348d1cee 100644
--- a/util/system/user.h
+++ b/util/system/user.h
@@ -1,5 +1,5 @@
-#pragma once
-
+#pragma once
+
#include <util/generic/fwd.h>
-
+
TString GetUsername();
diff --git a/util/system/ut/ya.make b/util/system/ut/ya.make
index 76e8db9225..127e7c261e 100644
--- a/util/system/ut/ya.make
+++ b/util/system/ut/ya.make
@@ -51,7 +51,7 @@ SRCS(
system/hi_lo_ut.cpp
system/hostname_ut.cpp
system/info_ut.cpp
- system/interrupt_signals_ut.cpp
+ system/interrupt_signals_ut.cpp
system/mem_info_ut.cpp
system/mincore_ut.cpp
system/mutex_ut.cpp