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) {
|