31 char *buff = strdup(spec);
32 char *tok, *save = NULL;
36 tok = strtok_r(buff,
",", &save);
40 from = to = atoi(tok);
41 char *sep = strstr(tok,
"-");
45 for (i = from; i <= to; i++) {
48 tok = strtok_r(NULL,
",", &save);
59 void cpusetToStr(
char *
set,
size_t len,
const cpu_set_t *cpuset)
65 if (!
set || !len)
return;
68 while (!CPU_ISSET(cpu, cpuset) && cpu <
NO_OF_CPUS) {
75 while (CPU_ISSET(cpu, cpuset) && cpu <
NO_OF_CPUS) {
79 sprintf(buf,
"%d,", from);
81 sprintf(buf,
"%d-%d,", from, to);
83 strncat(
set, buf, (len - 1 - strlen(
set)));
85 if ((l = strlen(
set))) {
127 if (
string == strcasestr(
string,
"SCHED_")) {
130 if (0 == strncasecmp(
string,
"OTHER", 1)) {
131 policy = SCHED_OTHER;
132 }
else if (0 == strncasecmp(
string,
"FIFO", 1)) {
134 }
else if (0 == strncasecmp(
string,
"RR", 1)) {
138 else if (0 == strncasecmp(
string,
"BATCH", 1)) {
139 policy = SCHED_BATCH;
143 else if (0 == strncasecmp(
string,
"IDLE", 1)) {
148 errlogPrintf(
"Invalid policy \"%s\"\n",
string);