summaryrefslogtreecommitdiffstats
path: root/yql/essentials/utils/sys/linux_version.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'yql/essentials/utils/sys/linux_version.cpp')
-rw-r--r--yql/essentials/utils/sys/linux_version.cpp58
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