Deleted Added
full compact
kern_sysctl.c (120813) kern_sysctl.c (126121)
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Mike Karels at Berkeley Software Design, Inc.
7 *
8 * Quite extensively rewritten by Poul-Henning Kamp of the FreeBSD

--- 26 unchanged lines hidden (view full) ---

35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 *
39 * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
40 */
41
42#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Mike Karels at Berkeley Software Design, Inc.
7 *
8 * Quite extensively rewritten by Poul-Henning Kamp of the FreeBSD

--- 26 unchanged lines hidden (view full) ---

35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 *
39 * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
40 */
41
42#include <sys/cdefs.h>
43__FBSDID("$FreeBSD: head/sys/kern/kern_sysctl.c 120813 2003-10-05 13:31:33Z bms $");
43__FBSDID("$FreeBSD: head/sys/kern/kern_sysctl.c 126121 2004-02-22 12:31:44Z pjd $");
44
45#include "opt_compat.h"
46#include "opt_mac.h"
47
48#include <sys/param.h>
49#include <sys/systm.h>
50#include <sys/kernel.h>
51#include <sys/sysctl.h>

--- 1118 unchanged lines hidden (view full) ---

1170 error = suser_cred(req->td->td_ucred, flags);
1171 if (error)
1172 return (error);
1173 }
1174
1175 if (!oid->oid_handler)
1176 return EINVAL;
1177
44
45#include "opt_compat.h"
46#include "opt_mac.h"
47
48#include <sys/param.h>
49#include <sys/systm.h>
50#include <sys/kernel.h>
51#include <sys/sysctl.h>

--- 1118 unchanged lines hidden (view full) ---

1170 error = suser_cred(req->td->td_ucred, flags);
1171 if (error)
1172 return (error);
1173 }
1174
1175 if (!oid->oid_handler)
1176 return EINVAL;
1177
1178 if ((oid->oid_kind & CTLTYPE) == CTLTYPE_NODE)
1179 error = oid->oid_handler(oid, (int *)arg1 + indx, arg2 - indx,
1180 req);
1181 else
1182 error = oid->oid_handler(oid, oid->oid_arg1, oid->oid_arg2,
1183 req);
1178 if ((oid->oid_kind & CTLTYPE) == CTLTYPE_NODE) {
1179 (int *)arg1 += indx;
1180 arg2 -= indx;
1181 } else {
1182 arg1 = oid->oid_arg1;
1183 arg2 = oid->oid_arg2;
1184 }
1185#ifdef MAC
1186 error = mac_check_system_sysctl(req->td->td_ucred, oid, arg1, arg2,
1187 req);
1188 if (error != 0)
1189 return (error);
1190#endif
1191 error = oid->oid_handler(oid, arg1, arg2, req);
1192
1184 return (error);
1185}
1186
1187#ifndef _SYS_SYSPROTO_H_
1188struct sysctl_args {
1189 int *name;
1190 u_int namelen;
1191 void *old;

--- 75 unchanged lines hidden (view full) ---

1267 }
1268
1269 req.oldfunc = sysctl_old_user;
1270 req.newfunc = sysctl_new_user;
1271 req.lock = REQ_LOCKED;
1272
1273 SYSCTL_LOCK();
1274
1193 return (error);
1194}
1195
1196#ifndef _SYS_SYSPROTO_H_
1197struct sysctl_args {
1198 int *name;
1199 u_int namelen;
1200 void *old;

--- 75 unchanged lines hidden (view full) ---

1276 }
1277
1278 req.oldfunc = sysctl_old_user;
1279 req.newfunc = sysctl_new_user;
1280 req.lock = REQ_LOCKED;
1281
1282 SYSCTL_LOCK();
1283
1275#ifdef MAC
1276 error = mac_check_system_sysctl(td->td_ucred, name, namelen, old,
1277 oldlenp, inkernel, new, newlen);
1278 if (error) {
1279 SYSCTL_UNLOCK();
1280 return (error);
1281 }
1282#endif
1283
1284 do {
1285 req2 = req;
1286 error = sysctl_root(0, name, namelen, &req2);
1287 } while (error == EAGAIN);
1288
1289 req = req2;
1290 if (req.lock == REQ_WIRED)
1291 vsunlock(req.oldptr, req.oldlen);

--- 231 unchanged lines hidden ---
1284 do {
1285 req2 = req;
1286 error = sysctl_root(0, name, namelen, &req2);
1287 } while (error == EAGAIN);
1288
1289 req = req2;
1290 if (req.lock == REQ_WIRED)
1291 vsunlock(req.oldptr, req.oldlen);

--- 231 unchanged lines hidden ---