summaryrefslogtreecommitdiff
path: root/tune/freq.c
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2003-10-04 02:39:56 +0200
committerKevin Ryde <user42@zip.com.au>2003-10-04 02:39:56 +0200
commit565994e2c5add67bb16e60a527e5a02059368167 (patch)
tree3d192d4f3c51e4ed33b9f5885faf918b416c972f /tune/freq.c
parent804229df2a3f90cab3bede5644d6b69b424d65f9 (diff)
downloadgmp-565994e2c5add67bb16e60a527e5a02059368167.tar.gz
* tune/freq.c (freq_bsd_dmesg): Demand a match of the "-MHz" part, to
avoid using the cpu class when there's no frequency given, as is the case on i486-pc-freebsd4.7.
Diffstat (limited to 'tune/freq.c')
-rw-r--r--tune/freq.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tune/freq.c b/tune/freq.c
index e1784b89c..9834d86fc 100644
--- a/tune/freq.c
+++ b/tune/freq.c
@@ -506,6 +506,7 @@ freq_attr_get_invent (int help)
CPU: AMD Athlon(tm) Processor (755.29-MHz 686-class CPU)
CPU: Pentium 4 (1707.56-MHz 686-class CPU)
+ CPU: i486 DX4 (486-class CPU)
This is useful on FreeBSD 4.x, where there's no sysctl machdep.tsc_freq
or machdep.i586_freq.
@@ -521,6 +522,7 @@ freq_bsd_dmesg (int help)
char buf[256], *p;
double val;
int ret = 0;
+ int end;
HELP ("BSD /var/run/dmesg.boot file");
@@ -532,7 +534,9 @@ freq_bsd_dmesg (int help)
{
for (p = buf; *p != '\0'; p++)
{
- if (sscanf (p, "(%lf-MHz", &val) == 1)
+ end = 0;
+ if (sscanf (p, "(%lf-MHz%n", &val, &end) == 1
+ && end != 0)
{
speed_cycletime = 1e-6 / val;
if (speed_option_verbose)