* Wire the user space destination buffer. If set to a value greater than * zero, the len parameter limits the maximum amount of wired memory. */
| 2080 | * zero, the len parameter limits the maximum amount of wired memory. |
| 2081 | */ |
| 2082 | int |
| 2083 | sysctl_wire_old_buffer(struct sysctl_req *req, size_t len) |
| 2084 | { |
| 2085 | int ret; |
| 2086 | size_t wiredlen; |
| 2087 | |
| 2088 | wiredlen = (len > 0 && len < req->oldlen) ? len : req->oldlen; |
| 2089 | ret = 0; |
| 2090 | if (req->lock != REQ_WIRED && req->oldptr && |
| 2091 | req->oldfunc == sysctl_old_user) { |
| 2092 | if (wiredlen != 0) { |
| 2093 | ret = vslock(req->oldptr, wiredlen); |
| 2094 | if (ret != 0) { |
| 2095 | if (ret != ENOMEM) |
| 2096 | return (ret); |
| 2097 | wiredlen = 0; |
| 2098 | } |
| 2099 | } |
| 2100 | req->lock = REQ_WIRED; |
| 2101 | req->validlen = wiredlen; |
| 2102 | } |
| 2103 | return (0); |
| 2104 | } |
| 2105 | |
| 2106 | int |
| 2107 | sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid, |
no test coverage detected