From b0c8e5a6f90bbe6641ff72b8ed7c2b49a1976f75 Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Tue, 23 Feb 2010 11:25:09 +0100 Subject: cpufrequtils 006: add patch from upstream to fix /proc/stat reading * This brings 006 up to 007 functionally, without all the buildsystem changes in between --- .../cpufrequtils/fix-proc-stat-reading.patch | 59 ++++++++++++++++++++++ recipes/cpufreqd/cpufrequtils_006.bb | 6 ++- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 recipes/cpufreqd/cpufrequtils/fix-proc-stat-reading.patch (limited to 'recipes/cpufreqd') diff --git a/recipes/cpufreqd/cpufrequtils/fix-proc-stat-reading.patch b/recipes/cpufreqd/cpufrequtils/fix-proc-stat-reading.patch new file mode 100644 index 0000000000..a9e3407b35 --- /dev/null +++ b/recipes/cpufreqd/cpufrequtils/fix-proc-stat-reading.patch @@ -0,0 +1,59 @@ +From 6657831200419d7509edcc04434d03b994c86adb Mon Sep 17 00:00:00 2001 +From: Anton Arapov +Date: Wed, 11 Nov 2009 21:33:09 +0100 +Subject: [PATCH] cpufreq/aperf : fix the /proc/stat read routine, always fails otherwise. + + the statement: + if (!fgets(value, LINE_LEN, fp)) { + always fails(==0) at the end of proc file, so we will have err_out: + firing all the time. + + I've aligned the code to the one that other utils of cpufreq has. + +Signed-off-by: Anton Arapov +Signed-off-by: Dominik Brodowski +--- + utils/aperf.c | 18 +++++++----------- + 1 files changed, 7 insertions(+), 11 deletions(-) + +diff --git a/utils/aperf.c b/utils/aperf.c +index a37f8b1..8ecff2c 100644 +--- a/utils/aperf.c ++++ b/utils/aperf.c +@@ -76,14 +76,15 @@ static unsigned int count_cpus(void) + unsigned int cpunr = 0; + + fp = fopen("/proc/stat", "r"); +- if(!fp) +- goto err_out; ++ if(!fp) { ++ printf("Couldn't count the number of CPUs (%s: %s), " ++ "assuming 1\n", "/proc/stat", strerror(errno)); ++ return 1; ++ } + + while (!feof(fp)) { +- if (!fgets(value, LINE_LEN, fp)) { +- fclose(fp); +- goto err_out; +- } ++ if (!fgets(value, LINE_LEN, fp)) ++ continue; + value[LINE_LEN - 1] = '\0'; + if (strlen(value) < (LINE_LEN - 2)) + continue; +@@ -98,11 +99,6 @@ static unsigned int count_cpus(void) + + /* cpu count starts from 0, on error return 1 (UP) */ + return (ret+1); +- +-err_out: +- printf("Couldn't count the number of CPUs (%s: %s), " +- "assuming 1\n", "/proc/stat", strerror(errno)); +- return 1; + } + + static int has_mperf_aperf_support(int cpu) +-- +1.7.0 + diff --git a/recipes/cpufreqd/cpufrequtils_006.bb b/recipes/cpufreqd/cpufrequtils_006.bb index 98556a63bc..2b4e959898 100644 --- a/recipes/cpufreqd/cpufrequtils_006.bb +++ b/recipes/cpufreqd/cpufrequtils_006.bb @@ -1,7 +1,11 @@ LICENSE = "GPLv2" DESCRIPTION = "To make access to the Linux kernel cpufreq subsystem easier for users and cpufreq userspace tools, a cpufrequtils package was created" -SRC_URI = "http://www.kernel.org/pub/linux/utils/kernel/cpufreq/cpufrequtils-${PV}.tar.bz2" +PR = "r1" + +SRC_URI = "http://www.kernel.org/pub/linux/utils/kernel/cpufreq/cpufrequtils-${PV}.tar.bz2 \ + file://fix-proc-stat-reading.patch;patch=1 \ +" export CROSS = "${TARGET_PREFIX}" export LIBTOOL = "${TARGET_PREFIX}libtool --tag cc" -- cgit 1.2.3-korg