aboutsummaryrefslogtreecommitdiffstats
path: root/testing/open-vm-tools/getloadavg-uclibc.patch
blob: 247bd7037431f5bb3692c5a4db634d0a0de394be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
diff --git a/lib/misc/hostinfoPosix.c b/lib/misc/hostinfoPosix.c
index eeeb620..67387be 100644
--- a/lib/misc/hostinfoPosix.c
+++ b/lib/misc/hostinfoPosix.c
@@ -1355,8 +1355,16 @@ HostinfoGetLoadAverage(float *avg0,  // IN/OUT:
                        float *avg1,  // IN/OUT:
                        float *avg2)  // IN/OUT:
 {
+#if defined(__UCLIBC__)
+   FILE *f;
+   if ((f = fopen("/proc/loadavg", "r")) == NULL)
+      return FALSE;
+   fscanf(f, "%f %f %f", avg0, avg1, avg2);
+   fclose(f);
+   return TRUE;
+
    /* getloadavg(3) was introduced with glibc 2.2 */
-#if defined(GLIBC_VERSION_22) || defined(__APPLE__)
+#elif defined(GLIBC_VERSION_22) || defined(__APPLE__)
    double avg[3];
    int res;