Skip to content

Commit

Permalink
osd-util: Don't fatal if hw_cpufrequency is not availble
Browse files Browse the repository at this point in the history
On some BSD systems (Panasas OSDs) hw_cpufrequency is
not available. This is not a fatal situation and does
not effects any core operations. Just print a message
and continue.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
  • Loading branch information
Boaz Harrosh committed Apr 29, 2010
1 parent f84e456 commit 33994cb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions osd-util/osd-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,11 +648,12 @@ double get_mhz(void)
#endif

if (!(fp = popen("sysctl -n " hw_cpufrequency, "r")))
osd_error_fatal("Cannot call sysctl");
osd_error("Cannot call sysctl");

if (fgets(s, sizeof(s), fp) == NULL ||
sscanf(s, "%lf", &mhz) != 1) {
osd_error_fatal("got no hw.cpufrequency sysctl value");
osd_error("got no hw.cpufrequency sysctl value");
mhz = 1800.0;
}
mhz /= div_by;
pclose(fp);
Expand Down

0 comments on commit 33994cb

Please sign in to comment.