aboutsummaryrefslogtreecommitdiffstats
path: root/testing/kbuild/getloadavg.patch
diff options
context:
space:
mode:
Diffstat (limited to 'testing/kbuild/getloadavg.patch')
-rw-r--r--testing/kbuild/getloadavg.patch32
1 files changed, 32 insertions, 0 deletions
diff --git a/testing/kbuild/getloadavg.patch b/testing/kbuild/getloadavg.patch
new file mode 100644
index 0000000000..e145ed0e5a
--- /dev/null
+++ b/testing/kbuild/getloadavg.patch
@@ -0,0 +1,32 @@
+diff --git a/src/kmk/job.c b/src/kmk/job.c
+index 6d14300..16731fc 100644
+--- a/src/kmk/job.c
++++ b/src/kmk/job.c
+@@ -240,6 +240,27 @@ unsigned long job_counter = 0;
+
+ unsigned int jobserver_tokens = 0;
+
++#ifdef __UCLIBC__
++int getloadavg(double list[], int nelem)
++{
++ FILE *LOADAVG;
++ double avg[3] = { 0.0, 0.0, 0.0 };
++ int i, res = -1;
++
++ if ((LOADAVG = fopen("/proc/loadavg", "r"))) {
++ fscanf(LOADAVG, "%lf %lf %lf", &avg[0], &avg[1], &avg[2]);
++ res = 0;
++ fclose(LOADAVG);
++ }
++
++ for (i = 0; (i < nelem) && (i < 3); i++) {
++ list[i] = avg[i];
++ }
++
++ return res;
++}
++#endif
++
+ #ifdef WINDOWS32
+ /*
+ * The macro which references this function is defined in make.h.