short die_id;
};
+static int read_only;
+
+static void check_privilege(void)
+{
+ if (!read_only)
+ return;
+
+ isst_display_error_info_message(1, "Insufficient privileges", 0, 0);
+ isst_ctdp_display_information_end(outf);
+ exit(1);
+}
+
FILE *get_output_file(void)
{
return outf;
static void set_tdp_level(int arg)
{
+ check_privilege();
+
if (cmd_help) {
fprintf(stderr, "Set Config TDP level\n");
fprintf(stderr,
{
int enable = arg;
+ check_privilege();
+
if (cmd_help) {
if (enable) {
fprintf(stderr,
int i, ret, enable = arg;
struct isst_id id;
+ check_privilege();
+
if (cmd_help) {
if (enable) {
fprintf(stderr,
{
int enable = arg;
+ check_privilege();
+
if (cmd_help) {
if (enable) {
fprintf(stderr,
static void set_clos_config(int arg)
{
+ check_privilege();
+
if (cmd_help) {
fprintf(stderr,
"Set core-power configuration for one of the four clos ids\n");
static void set_clos_assoc(int arg)
{
+ check_privilege();
+
if (cmd_help) {
fprintf(stderr, "Associate a clos id to a CPU\n");
fprintf(stderr,
int i, disable = arg;
struct isst_id id;
+ check_privilege();
+
if (cmd_help) {
if (disable)
fprintf(stderr, "Set turbo mode disable\n");
}
if (set) {
+ check_privilege();
ret = isst_set_trl(id, fact_trl);
isst_display_result(id, outf, "turbo-mode", "set-trl", ret);
return;
};
if (geteuid() != 0) {
- fprintf(stderr, "Must run as root\n");
- exit(0);
+ int fd;
+
+ fd = open(pathname, O_RDWR);
+ if (fd < 0) {
+ fprintf(stderr, "Must run as root\n");
+ exit(0);
+ }
+ fprintf(stderr, "\nNot running as root, Only read only operations are supported\n");
+ close(fd);
+ read_only = 1;
}
ret = update_cpu_model();