cpufreq: freebsd fixes
authorDaniel Kolesa <d.kolesa@samsung.com>
Wed, 18 Feb 2015 11:07:56 +0000 (11:07 +0000)
committerDaniel Kolesa <d.kolesa@samsung.com>
Wed, 18 Feb 2015 11:09:34 +0000 (11:09 +0000)
This fixes a sysctlbyname lookup and adds a stub for the "pstate"
command. Based on a patch contributed by Dmitry Luhtionov.

@fix

src/modules/cpufreq/freqset.c

index 462cc0829215023d346461dec6fc4fe215785af0..5c848be51c191486ac498e29923253080d90e724 100644 (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");