MCPcopy Create free account
hub / github.com/F-Stack/f-stack / kern_cpuset_getdomain

Function kern_cpuset_getdomain

freebsd/kern/kern_cpuset.c:2117–2224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2115}
2116
2117int
2118kern_cpuset_getdomain(struct thread *td, cpulevel_t level, cpuwhich_t which,
2119 id_t id, size_t domainsetsize, domainset_t *maskp, int *policyp)
2120{
2121 struct domainset outset;
2122 struct thread *ttd;
2123 struct cpuset *nset;
2124 struct cpuset *set;
2125 struct domainset *dset;
2126 struct proc *p;
2127 domainset_t *mask;
2128 int error;
2129
2130 if (domainsetsize < sizeof(domainset_t) ||
2131 domainsetsize > DOMAINSET_MAXSIZE / NBBY)
2132 return (ERANGE);
2133 error = cpuset_check_capabilities(td, level, which, id);
2134 if (error != 0)
2135 return (error);
2136 mask = malloc(domainsetsize, M_TEMP, M_WAITOK | M_ZERO);
2137 bzero(&outset, sizeof(outset));
2138 error = cpuset_which(which, id, &p, &ttd, &set);
2139 if (error)
2140 goto out;
2141 switch (level) {
2142 case CPU_LEVEL_ROOT:
2143 case CPU_LEVEL_CPUSET:
2144 switch (which) {
2145 case CPU_WHICH_TID:
2146 case CPU_WHICH_PID:
2147 thread_lock(ttd);
2148 set = cpuset_ref(ttd->td_cpuset);
2149 thread_unlock(ttd);
2150 break;
2151 case CPU_WHICH_CPUSET:
2152 case CPU_WHICH_JAIL:
2153 break;
2154 case CPU_WHICH_IRQ:
2155 case CPU_WHICH_INTRHANDLER:
2156 case CPU_WHICH_ITHREAD:
2157 case CPU_WHICH_DOMAIN:
2158 error = EINVAL;
2159 goto out;
2160 }
2161 if (level == CPU_LEVEL_ROOT)
2162 nset = cpuset_refroot(set);
2163 else
2164 nset = cpuset_refbase(set);
2165 domainset_copy(nset->cs_domain, &outset);
2166 cpuset_rel(nset);
2167 break;
2168 case CPU_LEVEL_WHICH:
2169 switch (which) {
2170 case CPU_WHICH_TID:
2171 thread_lock(ttd);
2172 domainset_copy(ttd->td_cpuset->cs_domain, &outset);
2173 thread_unlock(ttd);
2174 break;

Callers 1

sys_cpuset_getdomainFunction · 0.85

Calls 12

mallocFunction · 0.85
bzeroFunction · 0.85
cpuset_whichFunction · 0.85
cpuset_refFunction · 0.85
cpuset_refrootFunction · 0.85
cpuset_refbaseFunction · 0.85
domainset_copyFunction · 0.85
cpuset_relFunction · 0.85
suword32Function · 0.85
freeFunction · 0.70
copyoutFunction · 0.50

Tested by

no test coverage detected