Skip to content

Commit

Permalink
ARMHF: implement /proc/cpuinfo parsing
Browse files Browse the repository at this point in the history
Minimal CPU "parser" for armhf to avoid compile time warning.

Signed-off-by: Chuck Short <chuck.short@canonical.com>
  • Loading branch information
zulcss authored and ebblake committed Sep 28, 2012
1 parent 7022b09 commit 2d0a777
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ Patches have also been contributed by:
Paul Eggert <eggert@cs.ucla.edu>
Dwight Engen <dwight.engen@oracle.com>
liguang <lig.fnst@cn.fujitsu.com>
Chuck Short <zulcss@gmail.com>

[....send patches to get your name here....]

Expand Down
21 changes: 21 additions & 0 deletions src/nodeinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,27 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
* and parsed in next iteration, because it is not in expected
* format and thus lead to error. */
}
# elif defined(__arm__)
char *buf = line;
if (STRPREFIX(buf, "BogoMIPS")) {
char *p;
unsigned int ui;

buf += 8;
while (*buf && c_isspace(*buf))
buf++;

if (*buf != ':' || !buf[1]) {
nodeReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("parsing cpu MHz from cpuinfo"));
goto cleanup;
}

if (virStrToLong_ui(buf+1, &p, 10, &ui) == 0
/* Accept trailing fractional part. */
&& (*p == '\0' || *p == '.' || c_isspace(*p)))
nodeinfo->mhz = ui;
}
# elif defined(__s390__) || \
defined(__s390x__)
/* s390x has no realistic value for CPU speed,
Expand Down

0 comments on commit 2d0a777

Please sign in to comment.