| 155 | MALLOC_DECLARE(M_FILECAPS); |
| 156 | |
| 157 | static inline int |
| 158 | _cap_check(const cap_rights_t *havep, const cap_rights_t *needp, |
| 159 | enum ktr_cap_fail_type type) |
| 160 | { |
| 161 | |
| 162 | if (!cap_rights_contains(havep, needp)) { |
| 163 | #ifdef KTRACE |
| 164 | if (KTRPOINT(curthread, KTR_CAPFAIL)) |
| 165 | ktrcapfail(type, needp, havep); |
| 166 | #endif |
| 167 | return (ENOTCAPABLE); |
| 168 | } |
| 169 | return (0); |
| 170 | } |
| 171 | |
| 172 | /* |
| 173 | * Test whether a capability grants the requested rights. |
no test coverage detected