Lines Matching refs:req
649 error = caps_priv_check_td(req->td, SYSCAP_NODEBUG_UNPRIV); in sysctl_sysctl_debug()
674 if (req->oldidx) in sysctl_sysctl_name()
675 error = SYSCTL_OUT(req, ".", 1); in sysctl_sysctl_name()
677 error = SYSCTL_OUT(req, buf, strlen(buf)); in sysctl_sysctl_name()
689 if (req->oldidx) in sysctl_sysctl_name()
690 error = SYSCTL_OUT(req, ".", 1); in sysctl_sysctl_name()
692 error = SYSCTL_OUT(req, oid->oid_name, in sysctl_sysctl_name()
711 error = SYSCTL_OUT(req, "", 1); in sysctl_sysctl_name()
791 error = SYSCTL_OUT(req, newoid, j * sizeof (int)); in sysctl_sysctl_next()
845 if (!req->newlen) in sysctl_sysctl_name2oid()
847 if (req->newlen >= MAXPATHLEN) /* XXX arbitrary, undocumented */ in sysctl_sysctl_name2oid()
850 p = kmalloc(req->newlen+1, M_SYSCTL, M_WAITOK); in sysctl_sysctl_name2oid()
852 error = SYSCTL_IN(req, p, req->newlen); in sysctl_sysctl_name2oid()
858 p [req->newlen] = '\0'; in sysctl_sysctl_name2oid()
867 error = SYSCTL_OUT(req, oid, len * sizeof *oid); in sysctl_sysctl_name2oid()
881 error = sysctl_find_oid(arg1, arg2, &oid, NULL, req); in sysctl_sysctl_oidfmt()
887 error = SYSCTL_OUT(req, &oid->oid_kind, sizeof(oid->oid_kind)); in sysctl_sysctl_oidfmt()
890 error = SYSCTL_OUT(req, oid->oid_fmt, strlen(oid->oid_fmt) + 1); in sysctl_sysctl_oidfmt()
904 error = sysctl_find_oid(arg1, arg2, &oid, NULL, req); in sysctl_sysctl_oiddescr()
910 error = SYSCTL_OUT(req, oid->oid_descr, strlen(oid->oid_descr) + 1); in sysctl_sysctl_oiddescr()
933 error = SYSCTL_OUT(req, arg1, sizeof(int8_t)); in sysctl_handle_8()
935 if (error || !req->newptr) in sysctl_handle_8()
938 error = SYSCTL_IN(req, arg1, sizeof(int8_t)); in sysctl_handle_8()
953 error = SYSCTL_OUT(req, arg1, sizeof(int16_t)); in sysctl_handle_16()
955 if (error || !req->newptr) in sysctl_handle_16()
958 error = SYSCTL_IN(req, arg1, sizeof(int16_t)); in sysctl_handle_16()
973 error = SYSCTL_OUT(req, arg1, sizeof(int32_t)); in sysctl_handle_32()
975 if (error || !req->newptr) in sysctl_handle_32()
978 error = SYSCTL_IN(req, arg1, sizeof(int32_t)); in sysctl_handle_32()
993 error = SYSCTL_OUT(req, arg1, sizeof(int64_t)); in sysctl_handle_64()
995 if (error || !req->newptr) in sysctl_handle_64()
998 error = SYSCTL_IN(req, arg1, sizeof(int64_t)); in sysctl_handle_64()
1015 error = SYSCTL_OUT(req, arg1, sizeof(int)); in sysctl_handle_int()
1017 error = SYSCTL_OUT(req, &arg2, sizeof(int)); in sysctl_handle_int()
1019 if (error || !req->newptr) in sysctl_handle_int()
1025 error = SYSCTL_IN(req, arg1, sizeof(int)); in sysctl_handle_int()
1040 if (req->oldlen == sizeof(int) && in sysctl_handle_long()
1049 error = SYSCTL_OUT(req, &val, sizeof(int)); in sysctl_handle_long()
1054 error = SYSCTL_OUT(req, arg1, sizeof(long)); in sysctl_handle_long()
1057 if (error || !req->newptr) in sysctl_handle_long()
1060 error = SYSCTL_IN(req, arg1, sizeof(long)); in sysctl_handle_long()
1076 error = SYSCTL_OUT(req, arg1, sizeof(quad_t)); in sysctl_handle_quad()
1078 if (error || !req->newptr) in sysctl_handle_quad()
1081 error = SYSCTL_IN(req, arg1, sizeof(quad_t)); in sysctl_handle_quad()
1103 error = SYSCTL_OUT(req, &v, sizeof(int)); in sysctl_handle_bit32()
1105 if (error || !req->newptr) in sysctl_handle_bit32()
1111 error = SYSCTL_IN(req, &v, sizeof(int)); in sysctl_handle_bit32()
1140 error = SYSCTL_OUT(req, &v, sizeof(int)); in sysctl_handle_bit64()
1142 if (error || !req->newptr) in sysctl_handle_bit64()
1148 error = SYSCTL_IN(req, &v, sizeof(int)); in sysctl_handle_bit64()
1171 error = SYSCTL_OUT(req, arg1, strlen((char *)arg1)+1); in sysctl_handle_string()
1173 if (error || !req->newptr) in sysctl_handle_string()
1176 if ((req->newlen - req->newidx) >= arg2) { in sysctl_handle_string()
1179 arg2 = (req->newlen - req->newidx); in sysctl_handle_string()
1180 error = SYSCTL_IN(req, arg1, arg2); in sysctl_handle_string()
1197 error = SYSCTL_OUT(req, arg1, arg2); in sysctl_handle_opaque()
1199 if (error || !req->newptr) in sysctl_handle_opaque()
1202 error = SYSCTL_IN(req, arg1, arg2); in sysctl_handle_opaque()
1212 sysctl_old_kernel(struct sysctl_req *req, const void *p, size_t l) in sysctl_old_kernel() argument
1216 if (req->oldptr) { in sysctl_old_kernel()
1218 if (i > req->oldlen - req->oldidx) in sysctl_old_kernel()
1219 i = req->oldlen - req->oldidx; in sysctl_old_kernel()
1221 bcopy(p, (char *)req->oldptr + req->oldidx, i); in sysctl_old_kernel()
1223 req->oldidx += l; in sysctl_old_kernel()
1224 if (req->oldptr && i != l) in sysctl_old_kernel()
1230 sysctl_new_kernel(struct sysctl_req *req, void *p, size_t l) in sysctl_new_kernel() argument
1233 if (!req->newptr) in sysctl_new_kernel()
1235 if (req->newlen - req->newidx < l) in sysctl_new_kernel()
1237 bcopy((char *)req->newptr + req->newidx, p, l); in sysctl_new_kernel()
1238 req->newidx += l; in sysctl_new_kernel()
1248 struct sysctl_req req; in kernel_sysctl() local
1250 bzero(&req, sizeof req); in kernel_sysctl()
1252 req.td = curthread; in kernel_sysctl()
1255 req.oldlen = *oldlenp; in kernel_sysctl()
1257 req.validlen = req.oldlen; in kernel_sysctl()
1260 req.oldptr= old; in kernel_sysctl()
1264 req.newlen = newlen; in kernel_sysctl()
1265 req.newptr = new; in kernel_sysctl()
1268 req.oldfunc = sysctl_old_kernel; in kernel_sysctl()
1269 req.newfunc = sysctl_new_kernel; in kernel_sysctl()
1271 req.lock = REQ_UNWIRED; in kernel_sysctl()
1275 error = sysctl_root(0, name, namelen, &req); in kernel_sysctl()
1279 if (req.lock == REQ_WIRED && req.validlen > 0) in kernel_sysctl()
1280 vsunlock(req.oldptr, req.validlen); in kernel_sysctl()
1287 if (req.oldptr && req.oldidx > req.validlen) in kernel_sysctl()
1288 *retval = req.validlen; in kernel_sysctl()
1290 *retval = req.oldidx; in kernel_sysctl()
1321 sysctl_old_user(struct sysctl_req *req, const void *p, size_t l) in sysctl_old_user() argument
1327 if (req->lock == 1 && req->oldptr) { in sysctl_old_user()
1328 vslock(req->oldptr, req->oldlen); in sysctl_old_user()
1329 req->lock = 2; in sysctl_old_user()
1332 if (req->oldptr) { in sysctl_old_user()
1334 if (i > req->oldlen - req->oldidx) in sysctl_old_user()
1335 i = req->oldlen - req->oldidx; in sysctl_old_user()
1337 error = copyout(p, (char *)req->oldptr + req->oldidx, in sysctl_old_user()
1340 req->oldidx += l; in sysctl_old_user()
1343 if (req->oldptr && i < l) in sysctl_old_user()
1349 sysctl_new_user(struct sysctl_req *req, void *p, size_t l) in sysctl_new_user() argument
1353 if (!req->newptr) in sysctl_new_user()
1355 if (req->newlen - req->newidx < l) in sysctl_new_user()
1357 error = copyin((char *)req->newptr + req->newidx, p, l); in sysctl_new_user()
1358 req->newidx += l; in sysctl_new_user()
1364 int *nindx, struct sysctl_req *req) in sysctl_find_oid() argument
1412 struct thread *td = req->td; in sysctl_root()
1418 error = sysctl_find_oid(arg1, arg2, &oid, &indx, req); in sysctl_root()
1439 if (req->newptr && (!(oid->oid_kind & CTLFLAG_WR) || in sysctl_root()
1446 if (!(oid->oid_kind & CTLFLAG_ANYBODY) && req->newptr && p && in sysctl_root()
1460 lktype = (req->newptr != NULL) ? LK_EXCLUSIVE : LK_SHARED; in sysctl_root()
1478 req); in sysctl_root()
1481 req); in sysctl_root()
1526 struct sysctl_req req; in userland_sysctl() local
1528 bzero(&req, sizeof req); in userland_sysctl()
1530 req.td = td; in userland_sysctl()
1531 req.flags = 0; in userland_sysctl()
1535 req.oldlen = *oldlenp; in userland_sysctl()
1537 error = copyin(oldlenp, &req.oldlen, sizeof(*oldlenp)); in userland_sysctl()
1542 req.validlen = req.oldlen; in userland_sysctl()
1549 req.oldptr= old; in userland_sysctl()
1552 req.newlen = newlen; in userland_sysctl()
1553 req.newptr = new; in userland_sysctl()
1556 req.oldfunc = sysctl_old_user; in userland_sysctl()
1557 req.newfunc = sysctl_new_user; in userland_sysctl()
1559 req.lock = REQ_UNWIRED; in userland_sysctl()
1568 req.oldidx = 0; in userland_sysctl()
1569 req.newidx = 0; in userland_sysctl()
1571 error = sysctl_root(0, name, namelen, &req); in userland_sysctl()
1579 if (req.lock == REQ_WIRED && req.validlen > 0) in userland_sysctl()
1580 vsunlock(req.oldptr, req.validlen); in userland_sysctl()
1586 if (req.oldptr && req.oldidx > req.validlen) in userland_sysctl()
1587 *retval = req.validlen; in userland_sysctl()
1589 *retval = req.oldidx; in userland_sysctl()
1600 error = sysctl_handle_int(oidp, &value, 0, req); in sysctl_int_range()
1601 if (error || !req->newptr) in sysctl_int_range()
1616 struct sysctl_req *req = arg; in sbuf_sysctl_drain() local
1619 error = SYSCTL_OUT(req, data, len); in sbuf_sysctl_drain()
1626 struct sysctl_req *req) in sbuf_new_for_sysctl() argument
1630 sbuf_set_drain(s, sbuf_sysctl_drain, req); in sbuf_new_for_sysctl()