- Revert r214409.

- Use long word to figure out sizeof kernel cpuset, hope it works.
This commit is contained in:
David Xu 2010-10-27 09:29:03 +00:00
parent f8768d2a1a
commit 4a5478709b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=214412
2 changed files with 6 additions and 9 deletions

View File

@ -574,13 +574,14 @@ _get_kern_cpuset_size(void)
if (kern_cpuset_size == 0) {
size_t len;
int maxcpus;
len = sizeof(kern_cpuset_size);
if (sysctlbyname("kern.smp.maxcpus", &kern_cpuset_size,
&len, NULL, 0))
len = sizeof(maxcpus);
if (sysctlbyname("kern.smp.maxcpus", &maxcpus, &len, NULL, 0))
PANIC("failed to get sysctl kern.smp.maxcpus");
kern_cpuset_size = (kern_cpuset_size + 7) / 8;
int nbits_long = sizeof(long) * NBBY;
int num_long = (maxcpus + nbits_long - 1) / nbits_long;
kern_cpuset_size = num_long * sizeof(long);
}
return (kern_cpuset_size);

View File

@ -889,10 +889,6 @@ cpuset_getaffinity(struct thread *td, struct cpuset_getaffinity_args *uap)
int error;
size_t size;
if (uap->cpusetsize == 0) {
td->td_retval[0] = sizeof(cpuset_t);
return (0);
}
if (uap->cpusetsize < sizeof(cpuset_t) ||
uap->cpusetsize > CPU_MAXSIZE / NBBY)
return (ERANGE);