* Apply an anonymous mask or a domain to a single thread. */
| 1465 | * Apply an anonymous mask or a domain to a single thread. |
| 1466 | */ |
| 1467 | static int |
| 1468 | _cpuset_setthread(lwpid_t id, cpuset_t *mask, struct domainset *domain) |
| 1469 | { |
| 1470 | struct setlist cpusets; |
| 1471 | struct domainlist domainlist; |
| 1472 | struct cpuset *nset; |
| 1473 | struct cpuset *set; |
| 1474 | struct thread *td; |
| 1475 | struct proc *p; |
| 1476 | int error; |
| 1477 | |
| 1478 | cpuset_freelist_init(&cpusets, 1); |
| 1479 | domainset_freelist_init(&domainlist, domain != NULL); |
| 1480 | error = cpuset_which(CPU_WHICH_TID, id, &p, &td, &set); |
| 1481 | if (error) |
| 1482 | goto out; |
| 1483 | set = NULL; |
| 1484 | thread_lock(td); |
| 1485 | error = cpuset_shadow(td->td_cpuset, &nset, mask, domain, |
| 1486 | &cpusets, &domainlist); |
| 1487 | if (error == 0) |
| 1488 | set = cpuset_update_thread(td, nset); |
| 1489 | thread_unlock(td); |
| 1490 | PROC_UNLOCK(p); |
| 1491 | if (set) |
| 1492 | cpuset_rel(set); |
| 1493 | out: |
| 1494 | cpuset_freelist_free(&cpusets); |
| 1495 | domainset_freelist_free(&domainlist); |
| 1496 | return (error); |
| 1497 | } |
| 1498 | |
| 1499 | /* |
| 1500 | * Apply an anonymous mask to a single thread. |
no test coverage detected