Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame^] | 1 | From 3eed8388b49d5d3cbc2db74fee1b017eb4b40d0a Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sat, 2 Sep 2017 10:06:24 -0700 |
| 4 | Subject: [PATCH] Use __GLIBC__ to control use of gnu_get_libc_version |
| 5 | |
| 6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 7 | --- |
| 8 | Upstream-Status: Pending |
| 9 | src/mongo/util/processinfo_linux.cpp | 6 ++++-- |
| 10 | 1 file changed, 4 insertions(+), 2 deletions(-) |
| 11 | |
| 12 | diff --git a/src/mongo/util/processinfo_linux.cpp b/src/mongo/util/processinfo_linux.cpp |
| 13 | index 910015215e..bf8c1ffd15 100644 |
| 14 | --- a/src/mongo/util/processinfo_linux.cpp |
| 15 | +++ b/src/mongo/util/processinfo_linux.cpp |
| 16 | @@ -40,7 +40,7 @@ |
| 17 | #include <sys/mman.h> |
| 18 | #include <sys/utsname.h> |
| 19 | #include <unistd.h> |
| 20 | -#ifdef __UCLIBC__ |
| 21 | +#ifndef __GLIBC__ |
| 22 | #include <features.h> |
| 23 | #else |
| 24 | #include <gnu/libc-version.h> |
| 25 | @@ -451,11 +451,13 @@ double ProcessInfo::getSystemMemoryPressurePercentage() { |
| 26 | } |
| 27 | |
| 28 | void ProcessInfo::getExtraInfo(BSONObjBuilder& info) { |
| 29 | +#if defined(__GLIBC__) |
| 30 | LinuxProc p(_pid); |
| 31 | if (p._maj_flt <= std::numeric_limits<long long>::max()) |
| 32 | info.appendNumber("page_faults", static_cast<long long>(p._maj_flt)); |
| 33 | else |
| 34 | info.appendNumber("page_faults", static_cast<double>(p._maj_flt)); |
| 35 | +#endif |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | @@ -491,7 +493,7 @@ void ProcessInfo::SystemInfo::collectSystemInfo() { |
| 40 | stringstream ss; |
| 41 | ss << "uClibc-" << __UCLIBC_MAJOR__ << "." << __UCLIBC_MINOR__ << "." << __UCLIBC_SUBLEVEL__; |
| 42 | bExtra.append("libcVersion", ss.str()); |
| 43 | -#else |
| 44 | +#elif defined(__GLIBC__) |
| 45 | bExtra.append("libcVersion", gnu_get_libc_version()); |
| 46 | #endif |
| 47 | if (!verSig.empty()) |
| 48 | -- |
| 49 | 2.14.1 |
| 50 | |