mirror of
https://git.busybox.net/buildroot.git
synced 2024-12-11 22:33:29 +08:00
f3b46aa2aa
uClibc-ng 1.0.42 added support for getloadavg: https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/commit/?id=ad3a130dad88ad7a59dcd965b0cf9bd0d713595e leading to build errors of the vdr package: skinlcars.c:1105:12: error: 'int getloadavg(double*, int)' was declared 'extern' and later 'static' [-fpermissive] since its version bump in buildroot: https://git.busybox.net/buildroot/commit/?id=61ae6add9e5d4761536fa4ff24150d5f8f82a61d Fixes: http://autobuild.buildroot.net/results/d3a/d3a65044fabdafa1b6d75a508eae006a2cfebdc0/ Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de> Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
56 lines
1.2 KiB
Diff
56 lines
1.2 KiB
Diff
Fix compilation with uClibc
|
|
|
|
Ported from
|
|
https://github.com/stschake/buildroot-grasshopper/blob/master/package/torsmo/torsmo-0.18-uclibc-getloadavg.patch
|
|
|
|
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
|
|
|
|
diff -uwNr vdr-2.3.1.org/skinlcars.c vdr-2.3.1/skinlcars.c
|
|
--- vdr-2.3.1.org/skinlcars.c 2015-09-01 12:07:07.000000000 +0200
|
|
+++ vdr-2.3.1/skinlcars.c 2016-07-31 21:00:11.000000000 +0200
|
|
@@ -1100,6 +1100,44 @@
|
|
}
|
|
}
|
|
|
|
+/* uclibc and dietlibc do not have this junk -ReneR */
|
|
+#if defined (__UCLIBC__) || defined (__dietlibc__)
|
|
+int getloadavg (double loadavg[], int nelem)
|
|
+{
|
|
+ int fd;
|
|
+
|
|
+ fd = open ("/proc/loadavg", O_RDONLY);
|
|
+ if (fd < 0)
|
|
+ return -1;
|
|
+ else
|
|
+ {
|
|
+ char buf[65], *p;
|
|
+ ssize_t nread;
|
|
+ int i;
|
|
+
|
|
+ nread = read (fd, buf, sizeof buf - 1);
|
|
+ close (fd);
|
|
+ if (nread <= 0)
|
|
+ return -1;
|
|
+ buf[nread - 1] = '\0';
|
|
+
|
|
+ if (nelem > 3)
|
|
+ nelem = 3;
|
|
+ p = buf;
|
|
+ for (i = 0; i < nelem; ++i)
|
|
+ {
|
|
+ char *endp;
|
|
+ loadavg[i] = strtod (p, &endp);
|
|
+ if (endp == p)
|
|
+ return -1;
|
|
+ p = endp;
|
|
+ }
|
|
+
|
|
+ return i;
|
|
+ }
|
|
+}
|
|
+#endif
|
|
+
|
|
void cSkinLCARSDisplayMenu::DrawLoad(void)
|
|
{
|
|
if (yb04) {
|