Changeset View
Changeset View
Standalone View
Standalone View
head/lib/libthr/thread/thr_attr.c
Show First 20 Lines • Show All 601 Lines • ▼ Show 20 Lines | else { | ||||
size_t kern_size = _get_kern_cpuset_size(); | size_t kern_size = _get_kern_cpuset_size(); | ||||
/* Kernel rejects small set, we check it here too. */ | /* Kernel rejects small set, we check it here too. */ | ||||
if (cpusetsize < kern_size) | if (cpusetsize < kern_size) | ||||
return (ERANGE); | return (ERANGE); | ||||
if (cpusetsize > kern_size) { | if (cpusetsize > kern_size) { | ||||
/* Kernel checks invalid bits, we check it here too. */ | /* Kernel checks invalid bits, we check it here too. */ | ||||
size_t i; | size_t i; | ||||
for (i = kern_size; i < cpusetsize; ++i) { | for (i = kern_size; i < cpusetsize; ++i) { | ||||
if (((char *)cpusetp)[i]) | if (((const char *)cpusetp)[i]) | ||||
return (EINVAL); | return (EINVAL); | ||||
} | } | ||||
} | } | ||||
if (attr->cpuset == NULL) { | if (attr->cpuset == NULL) { | ||||
attr->cpuset = calloc(1, kern_size); | attr->cpuset = calloc(1, kern_size); | ||||
if (attr->cpuset == NULL) | if (attr->cpuset == NULL) | ||||
return (errno); | return (errno); | ||||
attr->cpusetsize = kern_size; | attr->cpusetsize = kern_size; | ||||
Show All 33 Lines |