Skip to content

Commit 31fc41a

Browse files
author
Petter Reinholdtsen
committed
Only look for old Linux kernel versions on Linux.
This do not work well on GNU Hurd, where the kernel version is 0.9. This get test_malloc_compliance working on GNU Hurd. This fix is related to #2027.
1 parent 49c45b1 commit 31fc41a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test/common/memory_usage.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ namespace utils {
7474
peakUsage
7575
};
7676

77-
#if __unix__
77+
#if __linux__
78+
7879
inline unsigned LinuxKernelVersion()
7980
{
8081
unsigned digit1, digit2, digit3;
@@ -125,8 +126,11 @@ namespace utils {
125126
break;
126127
}
127128
}
128-
// VmPeak is available in kernels staring 2.6.15
129-
if (stat != peakUsage || LinuxKernelVersion() >= 2006015)
129+
// VmPeak is available in Linux kernels staring 2.6.15
130+
if (stat != peakUsage
131+
#if __linux__
132+
|| LinuxKernelVersion() >= 2006015)
133+
#endif
130134
ASSERT(size, "Invalid /proc/self/status format, pattern not found.");
131135
fclose(fst);
132136
return size * 1024;

0 commit comments

Comments
 (0)