diff options
| author | YDBot <[email protected]> | 2025-10-07 00:52:12 +0000 |
|---|---|---|
| committer | YDBot <[email protected]> | 2025-10-07 00:52:12 +0000 |
| commit | 0f7e91aa5ae33d20f2ef0d5cb2c80bb66924417f (patch) | |
| tree | 6307f61a54aea3be0afeeaf766a30597fe047e81 /yql/essentials/utils/sys/linux_version.cpp | |
| parent | 86c7a4b4c37e709428ebc61fb8a6e79c7260374c (diff) | |
| parent | 3ab4f52f9654e20e38084313aa6861cb0c17eb1d (diff) | |
Sync branches 251007-0050
Diffstat (limited to 'yql/essentials/utils/sys/linux_version.cpp')
| -rw-r--r-- | yql/essentials/utils/sys/linux_version.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/yql/essentials/utils/sys/linux_version.cpp b/yql/essentials/utils/sys/linux_version.cpp index 5d10af82948..e2be5fcce40 100644 --- a/yql/essentials/utils/sys/linux_version.cpp +++ b/yql/essentials/utils/sys/linux_version.cpp @@ -4,43 +4,43 @@ #include <util/system/platform.h> #ifdef _linux_ -# include <sys/utsname.h> + #include <sys/utsname.h> #endif namespace NYql { - std::tuple<int, int, int> DetectLinuxKernelVersion3() { +std::tuple<int, int, int> DetectLinuxKernelVersion3() { #ifdef _linux_ - // see https://github.com/torvalds/linux/blob/master/Makefile - // version is composed as follows: - // VERSION = 4 - // PATCHLEVEL = 18 - // SUBLEVEL = 0 - // EXTRAVERSION = -rc4 - // KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) + // see https://github.com/torvalds/linux/blob/master/Makefile + // version is composed as follows: + // VERSION = 4 + // PATCHLEVEL = 18 + // SUBLEVEL = 0 + // EXTRAVERSION = -rc4 + // KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) - utsname buf = {}; - if (uname(&buf)) { - ythrow TSystemError() << "uname call failed"; - } + utsname buf = {}; + if (uname(&buf)) { + ythrow TSystemError() << "uname call failed"; + } - int v = 0; - int p = 0; - int s = 0; - if (sscanf(buf.release, "%d.%d.%d", &v, &p, &s) != 3) { - ythrow yexception() << "Failed to parse linux kernel version " << buf.release; - } - return std::make_tuple(v, p, s); + int v = 0; + int p = 0; + int s = 0; + if (sscanf(buf.release, "%d.%d.%d", &v, &p, &s) != 3) { + ythrow yexception() << "Failed to parse linux kernel version " << buf.release; + } + return std::make_tuple(v, p, s); #else - return {}; + return {}; #endif - } +} - std::pair<int, int> DetectLinuxKernelVersion2() { - auto v = DetectLinuxKernelVersion3(); - return std::make_pair(std::get<0>(v), std::get<1>(v)); - } +std::pair<int, int> DetectLinuxKernelVersion2() { + auto v = DetectLinuxKernelVersion3(); + return std::make_pair(std::get<0>(v), std::get<1>(v)); +} - bool IsLinuxKernelBelow4_3() { - return DetectLinuxKernelVersion2() < std::make_pair(4, 3); - } +bool IsLinuxKernelBelow4_3() { + return DetectLinuxKernelVersion2() < std::make_pair(4, 3); } +} // namespace NYql |
