* Recursively check for errors that would occur from applying mask to * the tree of sets starting at 'set'. Checks for sets that would become * empty as well as RDONLY flags. */
| 633 | * empty as well as RDONLY flags. |
| 634 | */ |
| 635 | static int |
| 636 | cpuset_testupdate(struct cpuset *set, cpuset_t *mask, int augment_mask) |
| 637 | { |
| 638 | struct cpuset *nset; |
| 639 | cpuset_t newmask; |
| 640 | int error; |
| 641 | |
| 642 | mtx_assert(&cpuset_lock, MA_OWNED); |
| 643 | if (set->cs_flags & CPU_SET_RDONLY) |
| 644 | return (EPERM); |
| 645 | if (augment_mask) { |
| 646 | CPU_COPY(&set->cs_mask, &newmask); |
| 647 | CPU_AND(&newmask, mask); |
| 648 | } else |
| 649 | CPU_COPY(mask, &newmask); |
| 650 | |
| 651 | if (CPU_EMPTY(&newmask)) |
| 652 | return (EDEADLK); |
| 653 | error = 0; |
| 654 | LIST_FOREACH(nset, &set->cs_children, cs_siblings) |
| 655 | if ((error = cpuset_testupdate(nset, &newmask, 1)) != 0) |
| 656 | break; |
| 657 | return (error); |
| 658 | } |
| 659 | |
| 660 | /* |
| 661 | * Applies the mask 'mask' without checking for empty sets or permissions. |
no test coverage detected