void set_max_cstate_func(int argc, char *argv[]) { int value, rc; if ( argc != 1 || sscanf(argv[0], "%d", &value) != 1 || value < 0 ) { show_help(); exit(-1); } rc = xc_set_cpuidle_max_cstate(xc_handle, (uint32_t)value); printf("set max_cstate to C%d %s\n", value, rc? "failed":"succeeded" ); return; }
void set_max_cstate_func(int argc, char *argv[]) { int value; if ( argc != 1 || sscanf(argv[0], "%d", &value) != 1 || value < 0 ) { fprintf(stderr, "Missing or invalid argument(s)\n"); exit(EINVAL); } if ( !xc_set_cpuidle_max_cstate(xc_handle, (uint32_t)value) ) printf("set max_cstate to C%d succeeded\n", value); else fprintf(stderr, "set max_cstate to C%d failed (%d - %s)\n", value, errno, strerror(errno)); }