aboutsummaryrefslogtreecommitdiff
path: root/src/getgov.c
diff options
context:
space:
mode:
authorDavid <dbphillipsnz@gmail.com>2014-02-13 21:50:39 +1300
committerDavid <dbphillipsnz@gmail.com>2014-02-13 21:50:39 +1300
commit801455e69461f3e7cdfd546958ed4c10673a5726 (patch)
tree21ca2bfaeeb456580a6387de445c623459af2bc0 /src/getgov.c
parentada817cc90ad8207e38c42604a6823ad8bbf7112 (diff)
downloadparamano-801455e69461f3e7cdfd546958ed4c10673a5726.tar.xz
Fixes
Diffstat (limited to 'src/getgov.c')
-rw-r--r--src/getgov.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/src/getgov.c b/src/getgov.c
index 48b41c4..df723a9 100644
--- a/src/getgov.c
+++ b/src/getgov.c
@@ -56,52 +56,53 @@ void gg_init()
int gg_current(int core, char* out, int size)
{
- FILE* fd;
- char path[80];
- char corestr[4];
+ FILE* fd;
+ char path[80];
+ char corestr[4];
- sprintf(corestr, "%i", core);
+ sprintf(corestr, "%i", core);
- sprintf(path, "/sys/devices/system/cpu/cpu%s/cpufreq/scaling_governor", corestr);
+ sprintf(path, "/sys/devices/system/cpu/cpu%s/cpufreq/scaling_governor", corestr);
- if(!(fd = fopen(path, "r")))
- return -1;
+ if(!(fd = fopen(path, "r")))
+ return -1;
- fgets(out, size, fd);
+ fgets(out, size, fd);
- /* remove newline at the end */
- gchar* newline = g_strrstr(out, "\n");
- *newline = '\0';
+ /* remove newline at the end */
+ gchar* newline = g_strrstr(out, "\n");
+ *newline = '\0';
- fclose(fd);
- return 0;
+ fclose(fd);
+ return 0;
}
int gg_available(int core, char* out, int size)
{
- FILE* fd;
- char path[80];
- char corestr[4];
+ FILE* fd;
+ char path[80];
+ char corestr[4];
- sprintf(corestr, "%i", core);
+ sprintf(corestr, "%i", core);
- sprintf(path, "/sys/devices/system/cpu/cpu%s/cpufreq/scaling_available_governors", corestr);
+ sprintf(path, "/sys/devices/system/cpu/cpu%s/cpufreq/scaling_available_governors", corestr);
- if(!(fd = fopen(path, "r")))
- return -1;
+ if(!(fd = fopen(path, "r")))
+ return -1;
- fgets(out, size, fd);
+ fgets(out, size, fd);
- fclose(fd);
- return 0;
+ fclose(fd);
+ return 0;
}
+/* to do */
char* gg_gov(int core, int index)
{
- return AVAILABLE_GOVERNORS[core][index];
+ return AVAILABLE_GOVERNORS[core][index];
}
int gg_number()
{
- return NUMBER_OF_AVAILABLE_GOVERNORS;
+ return NUMBER_OF_AVAILABLE_GOVERNORS;
}