Lines Matching defs:req

105 	int arg2, struct sysctl_req *req);
107 int arg2, struct sysctl_req *req);
111 STATIC int sysctl_old_kernel(struct sysctl_req *req, const void *p, size_t l);
112 STATIC int sysctl_new_kernel(struct sysctl_req *req, void *p, size_t l);
114 STATIC int sysctl_sysctl_name2oid(struct sysctl_oid *oidp, void *arg1, int arg2, struct sysctl_req *req);
116 struct sysctl_req *req);
117 STATIC int sysctl_sysctl_oidfmt(struct sysctl_oid *oidp, void *arg1, int arg2, struct sysctl_req *req);
119 STATIC int sysctl_old_user(struct sysctl_req *req, const void *p, size_t l);
120 STATIC int sysctl_new_user(struct sysctl_req *req, void *p, size_t l);
393 * value (req->oldptr != NULL), we copy the data (bigValue etc.) out,
394 * if the caller wants to set the value (req->newptr), we copy
399 sysctl_io_number(struct sysctl_req *req, long long bigValue, size_t valueSize, void *pValue, int *changed) {
414 ((req->oldlen == sizeof(int)) && (valueSize == sizeof(long long))))
415 && (req->oldptr)) {
419 error = SYSCTL_OUT(req, &smallValue, sizeof(smallValue));
422 error = SYSCTL_OUT(req, &bigValue, valueSize);
425 if (error || !req->newptr)
433 if ((req->newlen == sizeof(int)) && (valueSize == sizeof(long long))) {
435 error = SYSCTL_IN(req, &smallValue, sizeof(smallValue));
438 } else if ((req->newlen == sizeof(long long)) && (valueSize == sizeof(int))) {
440 error = SYSCTL_IN(req, &bigValue, sizeof(bigValue));
449 error = SYSCTL_IN(req, pValue, valueSize);
457 sysctl_io_string(struct sysctl_req *req, char *pValue, size_t valueSize, int trunc, int *changed)
463 if (trunc && req->oldptr && req->oldlen && (req->oldlen<strlen(pValue) + 1)) {
470 error = SYSCTL_OUT(req, pValue, req->oldlen-1);
473 error = SYSCTL_OUT(req, &c, 1);
477 error = SYSCTL_OUT(req, pValue, strlen(pValue) + 1);
481 if (error || !req->newptr)
489 if (req->newlen >= valueSize)
493 error = SYSCTL_IN(req, pValue, req->newlen);
494 pValue[req->newlen] = '\0';
501 int sysctl_io_opaque(struct sysctl_req *req,void *pValue, size_t valueSize, int *changed)
508 error = SYSCTL_OUT(req, pValue, valueSize);
511 if (error || !req->newptr)
514 error = SYSCTL_IN(req, pValue, valueSize);
622 __unused int arg2, __unused struct sysctl_req *req)
681 struct sysctl_req *req)
694 if (req->oldidx)
695 error = SYSCTL_OUT(req, ".", 1);
697 error = SYSCTL_OUT(req, tempbuf, strlen(tempbuf));
711 if (req->oldidx)
712 error = SYSCTL_OUT(req, ".", 1);
714 error = SYSCTL_OUT(req, oid->oid_name,
736 return (SYSCTL_OUT(req, "", 1));
845 * req Pointer to user request buffer
873 struct sysctl_req *req)
887 error = SYSCTL_OUT(req, newoid, j * sizeof (int));
979 * req Request structure
989 * Implicit: *req Contents of request, modified
1008 __unused int arg2, struct sysctl_req *req)
1014 if (req->newlen < 1)
1016 if (req->newlen >= MAXPATHLEN) /* XXX arbitrary, undocumented */
1019 MALLOC(p, char *,req->newlen+1, M_TEMP, M_WAITOK);
1023 error = SYSCTL_IN(req, p, req->newlen);
1029 p [req->newlen] = '\0';
1044 error = SYSCTL_OUT(req, oid, len * sizeof *oid);
1063 * req Pointer to user request buffer
1090 struct sysctl_req *req)
1130 error = SYSCTL_OUT(req,
1133 error = SYSCTL_OUT(req, oid->oid_fmt,
1156 struct sysctl_req *req)
1158 return sysctl_io_number(req, arg1? *(int*)arg1: arg2, sizeof(int), arg1, NULL);
1167 __unused int arg2, struct sysctl_req *req)
1171 return sysctl_io_number(req, *(long*)arg1, sizeof(long), arg1, NULL);
1180 __unused int arg2, struct sysctl_req *req)
1184 return sysctl_io_number(req, *(long long*)arg1, sizeof(long long), arg1, NULL);
1196 __unused int arg2, struct sysctl_req *req)
1205 error = SYSCTL_OUT(req, &val, sizeof(long long));
1207 if (error || !req->newptr)
1210 error = SYSCTL_IN(req, &val, sizeof(long long));
1235 struct sysctl_req *req)
1237 return sysctl_io_string(req, arg1, arg2, 0, NULL);
1247 struct sysctl_req *req)
1249 return sysctl_io_opaque(req, arg1, arg2, NULL);
1256 sysctl_old_kernel(struct sysctl_req *req, const void *p, size_t l)
1260 if (req->oldptr) {
1262 if (i > req->oldlen - req->oldidx)
1263 i = req->oldlen - req->oldidx;
1265 bcopy((const void*)p, CAST_DOWN(char *, (req->oldptr + req->oldidx)), i);
1267 req->oldidx += l;
1268 if (req->oldptr && i != l)
1274 sysctl_new_kernel(struct sysctl_req *req, void *p, size_t l)
1276 if (!req->newptr)
1278 if (req->newlen - req->newidx < l)
1280 bcopy(CAST_DOWN(char *, (req->newptr + req->newidx)), p, l);
1281 req->newidx += l;
1289 struct sysctl_req req;
1294 bzero(&req, sizeof req);
1295 req.p = p;
1297 req.oldlen = *oldlenp;
1299 req.oldptr = CAST_USER_ADDR_T(old);
1301 req.newlen = newlen;
1302 req.newptr = CAST_USER_ADDR_T(new);
1304 req.oldfunc = sysctl_old_kernel;
1305 req.newfunc = sysctl_new_kernel;
1306 req.lock = 1;
1309 error = sysctl_root(0, name, namelen, &req);
1312 if (req.lock == 2)
1313 vsunlock(req.oldptr, (user_size_t)req.oldlen, B_WRITE);
1319 *oldlenp = req.oldidx;
1328 sysctl_old_user(struct sysctl_req *req, const void *p, size_t l)
1333 if (req->oldptr) {
1334 if (req->oldlen - req->oldidx < l)
1337 if (i > req->oldlen - req->oldidx)
1338 i = req->oldlen - req->oldidx;
1340 error = copyout((const void*)p, (req->oldptr + req->oldidx), i);
1342 req->oldidx += l;
1345 if (req->oldptr && i < l)
1351 sysctl_new_user(struct sysctl_req *req, void *p, size_t l)
1355 if (!req->newptr)
1357 if (req->newlen - req->newidx < l)
1359 error = copyin((req->newptr + req->newidx), p, l);
1360 req->newidx += l;
1371 struct sysctl_req *req)
1403 req->lock = 0;
1443 if (req->newptr && (!(oid->oid_kind & CTLFLAG_WR) ||
1453 if ((req->oldfunc == sysctl_old_kernel) && !(oid->oid_kind & CTLFLAG_KERN))
1468 req->newptr && req->p &&
1469 (error = proc_suser(req->p)))
1500 req);
1504 req);
1584 struct sysctl_req req, req2;
1586 bzero(&req, sizeof req);
1588 req.p = p;
1591 req.oldlen = *oldlenp;
1595 req.oldptr = oldp;
1599 req.newlen = newlen;
1600 req.newptr = newp;
1603 req.oldfunc = sysctl_old_user;
1604 req.newfunc = sysctl_new_user;
1605 req.lock = 1;
1608 req2 = req;
1612 req = req2;
1618 if (req.oldptr && req.oldidx > req.oldlen)
1619 *retval = req.oldlen;
1621 *retval = req.oldidx;