···1616 int arg;1717};18181919-static const char *version_str = "v1.24";1919+static const char *version_str = "v1.25";20202121static const int supported_api_ver = 3;2222static struct isst_if_platform_info isst_platform_info;···7979 short pkg_id;8080 short die_id;8181};8282+8383+static int read_only;8484+8585+static void check_privilege(void)8686+{8787+ if (!read_only)8888+ return;8989+9090+ isst_display_error_info_message(1, "Insufficient privileges", 0, 0);9191+ isst_ctdp_display_information_end(outf);9292+ exit(1);9393+}82948395FILE *get_output_file(void)8496{···962950 ret = write(fd, "member", strlen("member"));963951 if (ret == -1) {964952 printf("Can't update to member\n");953953+ close(fd);965954 return ret;966955 }967956957957+ close(fd);968958 return 0;969959 }970960···1592157815931579static void set_tdp_level(int arg)15941580{15811581+ check_privilege();15821582+15951583 if (cmd_help) {15961584 fprintf(stderr, "Set Config TDP level\n");15971585 fprintf(stderr,···20622046{20632047 int enable = arg;2064204820492049+ check_privilege();20502050+20652051 if (cmd_help) {20662052 if (enable) {20672053 fprintf(stderr,···22302212 int i, ret, enable = arg;22312213 struct isst_id id;2232221422152215+ check_privilege();22162216+22332217 if (cmd_help) {22342218 if (enable) {22352219 fprintf(stderr,···23812361{23822362 int enable = arg;2383236323642364+ check_privilege();23652365+23842366 if (cmd_help) {23852367 if (enable) {23862368 fprintf(stderr,···2513249125142492static void set_clos_config(int arg)25152493{24942494+ check_privilege();24952495+25162496 if (cmd_help) {25172497 fprintf(stderr,25182498 "Set core-power configuration for one of the four clos ids\n");···2580255625812557static void set_clos_assoc(int arg)25822558{25592559+ check_privilege();25602560+25832561 if (cmd_help) {25842562 fprintf(stderr, "Associate a clos id to a CPU\n");25852563 fprintf(stderr,···26632637 int i, disable = arg;26642638 struct isst_id id;2665263926402640+ check_privilege();26412641+26662642 if (cmd_help) {26672643 if (disable)26682644 fprintf(stderr, "Set turbo mode disable\n");···27102682 }2711268327122684 if (set) {26852685+ check_privilege();27132686 ret = isst_set_trl(id, fact_trl);27142687 isst_display_result(id, outf, "turbo-mode", "set-trl", ret);27152688 return;···32333204 };3234320532353206 if (geteuid() != 0) {32363236- fprintf(stderr, "Must run as root\n");32373237- exit(0);32073207+ int fd;32083208+32093209+ fd = open(pathname, O_RDWR);32103210+ if (fd < 0) {32113211+ fprintf(stderr, "Must run as root\n");32123212+ exit(0);32133213+ }32143214+ fprintf(stderr, "\nNot running as root, Only read only operations are supported\n");32153215+ close(fd);32163216+ read_only = 1;32383217 }3239321832403219 ret = update_cpu_model();