21 #define epicsExportSharedSymbols
35 char *buff = strdup(spec);
36 char *tok, *save = NULL;
40 tok = strtok_r(buff,
",", &save);
44 from = to = atoi(tok);
45 char *sep = strstr(tok,
"-");
49 for (i = from; i <= to; i++) {
52 tok = strtok_r(NULL,
",", &save);
63 void cpusetToStr(
char *set,
size_t len,
const cpu_set_t *cpuset)
69 if (!set || !len)
return;
73 while (!CPU_ISSET(cpu, cpuset) && cpu <
NO_OF_CPUS) {
80 while (CPU_ISSET(cpu, cpuset) && cpu <
NO_OF_CPUS) {
84 sprintf(buf,
"%d,", from);
86 sprintf(buf,
"%d-%d,", from, to);
88 strncat(set, buf, (len - 1 - strlen(set)));
90 if ((l = strlen(set))) {
132 if (
string == strcasestr(
string,
"SCHED_")) {
135 if (0 == strncasecmp(
string,
"OTHER", 1)) {
136 policy = SCHED_OTHER;
137 }
else if (0 == strncasecmp(
string,
"FIFO", 1)) {
139 }
else if (0 == strncasecmp(
string,
"RR", 1)) {
143 else if (0 == strncasecmp(
string,
"BATCH", 1)) {
144 policy = SCHED_BATCH;
148 else if (0 == strncasecmp(
string,
"IDLE", 1)) {
153 errlogPrintf(
"Invalid policy \"%s\"\n",
string);
const char * policyToStr(const int policy)
Convert scheduling policy to string.
void cpusetToStr(char *set, size_t len, const cpu_set_t *cpuset)
Convert a cpuset into its string specification (e.g. "0,2-3").
epicsShareDef int cpuDigits
void strToCpuset(cpu_set_t *cpuset, const char *spec)
Convert a cpuset string specification (e.g. "0,2-3") to a cpuset.
int strToPolicy(const char *string)
Convert string policy specification to policy.