| 68 | } |
| 69 | |
| 70 | static int |
| 71 | protect_setchildren(struct thread *td, struct proc *top, int flags) |
| 72 | { |
| 73 | struct proc *p; |
| 74 | int ret; |
| 75 | |
| 76 | p = top; |
| 77 | ret = 0; |
| 78 | sx_assert(&proctree_lock, SX_LOCKED); |
| 79 | for (;;) { |
| 80 | ret |= protect_setchild(td, p, flags); |
| 81 | PROC_UNLOCK(p); |
| 82 | /* |
| 83 | * If this process has children, descend to them next, |
| 84 | * otherwise do any siblings, and if done with this level, |
| 85 | * follow back up the tree (but not past top). |
| 86 | */ |
| 87 | if (!LIST_EMPTY(&p->p_children)) |
| 88 | p = LIST_FIRST(&p->p_children); |
| 89 | else for (;;) { |
| 90 | if (p == top) { |
| 91 | PROC_LOCK(p); |
| 92 | return (ret); |
| 93 | } |
| 94 | if (LIST_NEXT(p, p_sibling)) { |
| 95 | p = LIST_NEXT(p, p_sibling); |
| 96 | break; |
| 97 | } |
| 98 | p = p->p_pptr; |
| 99 | } |
| 100 | PROC_LOCK(p); |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | static int |
| 105 | protect_set(struct thread *td, struct proc *p, int flags) |
no test coverage detected