aboutsummaryrefslogtreecommitdiff
path: root/paramano_set_interface.c
blob: 0af13b40ee84bc53d094490b50c781a908175bb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "paramano_set_interface.h"
#include "common.h"

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

void si_gov(char* gov, int core)
{
	char cmd[1024];
	if (getuid() != ROOT_UID)
	{
		sprintf(cmd, SUDO" -n "PARAMANO_SET" -g %s -c %i &",gov,core);
	} else {
		sprintf(cmd, PARAMANO_SET" -g %s -c %i",gov,core);
	}
	info("Running '%s'\n",cmd);
	system(cmd);
}

void si_freq(int freq, int core)
{
	char cmd[1024];
	if (getuid() != ROOT_UID)
	{
		sprintf(cmd, SUDO" -n "PARAMANO_SET" -f %i -c %i &",freq,core);
	} else {
		sprintf(cmd, PARAMANO_SET" -f %i -c %i",freq,core);
	}
	info("Running '%s'\n",cmd);
	system(cmd);
}