python-dataproperty: bump version to 0.17.0
[buildroot-gz.git] / package / vdr / 0001-getloadavg.patch
blob3937c83dd89efb5edb2ecac1cdb9427eedebb936
1 Fix compilation with uClibc
3 Ported from
4 https://github.com/stschake/buildroot-grasshopper/blob/master/package/torsmo/torsmo-0.18-uclibc-getloadavg.patch
6 Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
8 diff -uwNr vdr-2.3.1.org/skinlcars.c vdr-2.3.1/skinlcars.c
9 --- vdr-2.3.1.org/skinlcars.c 2015-09-01 12:07:07.000000000 +0200
10 +++ vdr-2.3.1/skinlcars.c 2016-07-31 21:00:11.000000000 +0200
11 @@ -1099,6 +1099,44 @@
15 +/* uclibc and dietlibc do not have this junk -ReneR */
16 +#if defined (__UCLIBC__) || defined (__dietlibc__)
17 +static int getloadavg (double loadavg[], int nelem)
19 + int fd;
21 + fd = open ("/proc/loadavg", O_RDONLY);
22 + if (fd < 0)
23 + return -1;
24 + else
25 + {
26 + char buf[65], *p;
27 + ssize_t nread;
28 + int i;
30 + nread = read (fd, buf, sizeof buf - 1);
31 + close (fd);
32 + if (nread <= 0)
33 + return -1;
34 + buf[nread - 1] = '\0';
36 + if (nelem > 3)
37 + nelem = 3;
38 + p = buf;
39 + for (i = 0; i < nelem; ++i)
40 + {
41 + char *endp;
42 + loadavg[i] = strtod (p, &endp);
43 + if (endp == p)
44 + return -1;
45 + p = endp;
46 + }
48 + return i;
49 + }
51 +#endif
53 void cSkinLCARSDisplayMenu::DrawLoad(void)
55 if (yb04) {