summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-12-24 17:28:14 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-12-24 17:28:14 +0000
commit3313f98620cd834b80a7ac8c30829b7c50747781 (patch)
tree17a5efe8bfca5b7b42c9706b2454069a5b4a9880
parent355dfa3d218da373a67e763aa14f8ac66870421f (diff)
Do not provide the KERN_EMUL, KERN_EVCOUNT, KERN_INTRCNT, KERN_PROC* and
HW_SENSORS sysctl trees if option SMALL_KERNEL. ok deraadt@
-rw-r--r--sys/kern/kern_sysctl.c24
-rw-r--r--sys/kern/subr_evcount.c5
2 files changed, 25 insertions, 4 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index c3215ed5d7f..5eb3744711f 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.122 2004/11/26 21:23:06 miod Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.123 2004/12/24 17:28:13 miod Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -354,12 +354,14 @@ kern_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
sizeof(struct timeval)));
case KERN_VNODE:
return (sysctl_vnode(oldp, oldlenp, p));
+#ifndef SMALL_KERNEL
case KERN_PROC:
case KERN_PROC2:
return (sysctl_doproc(name, namelen, oldp, oldlenp));
case KERN_PROC_ARGS:
return (sysctl_proc_args(name + 1, namelen - 1, oldp, oldlenp,
p));
+#endif
case KERN_FILE:
return (sysctl_file(oldp, oldlenp));
case KERN_MBSTAT:
@@ -510,24 +512,26 @@ kern_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
return (sysctl_sysvshm(name + 1, namelen - 1, oldp, oldlenp,
newp, newlen));
#endif
+#ifndef SMALL_KERNEL
case KERN_INTRCNT:
return (sysctl_intrcnt(name + 1, namelen - 1, oldp, oldlenp));
-#ifndef SMALL_KERNEL
case KERN_WATCHDOG:
return (sysctl_wdog(name + 1, namelen - 1, oldp, oldlenp,
newp, newlen));
-#endif
case KERN_EMUL:
return (sysctl_emul(name + 1, namelen - 1, oldp, oldlenp,
newp, newlen));
+#endif
case KERN_MAXCLUSTERS:
error = sysctl_int(oldp, oldlenp, newp, newlen, &nmbclust);
if (!error)
nmbclust_update();
return (error);
+#ifndef SMALL_KERNEL
case KERN_EVCOUNT:
return (evcount_sysctl(name + 1, namelen - 1, oldp, oldlenp,
newp, newlen));
+#endif
#ifdef __HAVE_TIMECOUNTER
case KERN_TIMECOUNTER:
return (sysctl_tc(name + 1, namelen - 1, oldp, oldlenp,
@@ -593,9 +597,11 @@ hw_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
disk_count * sizeof(struct diskstats)));
case HW_DISKCOUNT:
return (sysctl_rdint(oldp, oldlenp, newp, disk_count));
+#ifndef SMALL_KERNEL
case HW_SENSORS:
return (sysctl_sensors(name + 1, namelen - 1, oldp, oldlenp,
newp, newlen));
+#endif
case HW_CPUSPEED:
if (!cpu_cpuspeed)
return (EOPNOTSUPP);
@@ -978,6 +984,8 @@ sysctl_file(where, sizep)
return (0);
}
+#ifndef SMALL_KERNEL
+
/*
* try over estimating by 5 procs
*/
@@ -1127,6 +1135,8 @@ again:
return (0);
}
+#endif /* SMALL_KERNEL */
+
/*
* Fill in an eproc structure for the specified process.
*/
@@ -1185,6 +1195,8 @@ fill_eproc(struct proc *p, struct eproc *ep)
ep->e_maxrss = p->p_rlimit ? p->p_rlimit[RLIMIT_RSS].rlim_cur : 0;
}
+#ifndef SMALL_KERNEL
+
/*
* Fill in a kproc2 structure for the specified process.
*/
@@ -1558,6 +1570,8 @@ out:
return (error);
}
+#endif
+
/*
* Initialize disknames/diskstats for export by sysctl. If update is set,
* then we simply update the disk statistics information.
@@ -1775,6 +1789,8 @@ sysctl_sysvipc(name, namelen, where, sizep)
}
#endif /* SYSVMSG || SYSVSEM || SYSVSHM */
+#ifndef SMALL_KERNEL
+
int
sysctl_intrcnt(int *name, u_int namelen, void *oldp, size_t *oldlenp)
{
@@ -1839,3 +1855,5 @@ sysctl_emul(int *name, u_int namelen, void *oldp, size_t *oldlenp,
return (EINVAL);
}
}
+
+#endif /* SMALL_KERNEL */
diff --git a/sys/kern/subr_evcount.c b/sys/kern/subr_evcount.c
index 76fe02019aa..4657251db9c 100644
--- a/sys/kern/subr_evcount.c
+++ b/sys/kern/subr_evcount.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_evcount.c,v 1.5 2004/11/26 21:23:06 miod Exp $ */
+/* $OpenBSD: subr_evcount.c,v 1.6 2004/12/24 17:28:13 miod Exp $ */
/*
* Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
* Copyright (c) 2004 Aaron Campbell <aaron@openbsd.org>
@@ -84,6 +84,8 @@ evcount_detach(ec)
TAILQ_REMOVE(&evcount_list, ec, next);
}
+#ifndef SMALL_KERNEL
+
int
evcount_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
int *name;
@@ -147,3 +149,4 @@ evcount_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
return (error);
}
+#endif /* SMALL_KERNEL */