cpufreq: freebsd fixes

This fixes a sysctlbyname lookup and adds a stub for the "pstate"
command. Based on a patch contributed by Dmitry Luhtionov.

@fix
This commit is contained in:
Daniel Kolesa 2015-02-18 11:07:56 +00:00
parent fbad4c7fd8
commit bc41e68f80
1 changed files with 7 additions and 3 deletions

View File

@ -57,9 +57,8 @@ main(int argc, char *argv[])
#elif defined __FreeBSD__
if (!strcmp(argv[1], "frequency"))
{
int new_frequency = atoi(argv[2]);
size_t len = sizeof(new_frequency);
if (sysctlbyname("dev.cpu.0.freq", NULL, 0, &new_frequency, &len) == -1)
int newfreq = atoi(argv[2]);
if (sysctlbyname("dev.cpu.0.freq", NULL, NULL, &newfreq, sizeof(newfreq)) == -1)
{
fprintf(stderr, "Unable to open frequency interface for writing.\n");
return 1;
@ -72,6 +71,11 @@ main(int argc, char *argv[])
fprintf(stderr, "Governors not (yet) implemented on FreeBSD.\n");
return 0;
}
else if (!strcmp(argv[1], "pstate"))
{
fprintf(stderr, "Pstates not (yet) implemented on FreeBSD.\n");
return 0;
}
else
{
fprintf(stderr, "Unknown command.\n");