| 102 | } |
| 103 | |
| 104 | static int |
| 105 | protect_set(struct thread *td, struct proc *p, int flags) |
| 106 | { |
| 107 | int error, ret; |
| 108 | |
| 109 | switch (PPROT_OP(flags)) { |
| 110 | case PPROT_SET: |
| 111 | case PPROT_CLEAR: |
| 112 | break; |
| 113 | default: |
| 114 | return (EINVAL); |
| 115 | } |
| 116 | |
| 117 | if ((PPROT_FLAGS(flags) & ~(PPROT_DESCEND | PPROT_INHERIT)) != 0) |
| 118 | return (EINVAL); |
| 119 | |
| 120 | error = priv_check(td, PRIV_VM_MADV_PROTECT); |
| 121 | if (error) |
| 122 | return (error); |
| 123 | |
| 124 | if (flags & PPROT_DESCEND) |
| 125 | ret = protect_setchildren(td, p, flags); |
| 126 | else |
| 127 | ret = protect_setchild(td, p, flags); |
| 128 | if (ret == 0) |
| 129 | return (EPERM); |
| 130 | return (0); |
| 131 | } |
| 132 | |
| 133 | static int |
| 134 | reap_acquire(struct thread *td, struct proc *p) |
no test coverage detected