Deleted Added
full compact
kern_mib.c (87072) kern_mib.c (87275)
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
9 * project, to make these variables more userfriendly.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgement:
21 * This product includes software developed by the University of
22 * California, Berkeley and its contributors.
23 * 4. Neither the name of the University nor the names of its contributors
24 * may be used to endorse or promote products derived from this software
25 * without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
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
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
9 * project, to make these variables more userfriendly.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgement:
21 * This product includes software developed by the University of
22 * California, Berkeley and its contributors.
23 * 4. Neither the name of the University nor the names of its contributors
24 * may be used to endorse or promote products derived from this software
25 * without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
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 * $FreeBSD: head/sys/kern/kern_mib.c 87072 2001-11-28 21:22:05Z rwatson $
40 * $FreeBSD: head/sys/kern/kern_mib.c 87275 2001-12-03 16:12:27Z rwatson $
41 */
42
43#include "opt_global.h"
44#include "opt_posix.h"
45
46#include <sys/param.h>
47#include <sys/kernel.h>
48#include <sys/systm.h>
49#include <sys/sysctl.h>
50#include <sys/proc.h>
41 */
42
43#include "opt_global.h"
44#include "opt_posix.h"
45
46#include <sys/param.h>
47#include <sys/kernel.h>
48#include <sys/systm.h>
49#include <sys/sysctl.h>
50#include <sys/proc.h>
51#include <sys/lock.h>
52#include <sys/mutex.h>
51#include <sys/jail.h>
52#include <sys/smp.h>
53
54SYSCTL_NODE(, 0, sysctl, CTLFLAG_RW, 0,
55 "Sysctl internal magic");
56SYSCTL_NODE(, CTL_KERN, kern, CTLFLAG_RW, 0,
57 "High kernel, proc, limits &c");
58SYSCTL_NODE(, CTL_VM, vm, CTLFLAG_RW, 0,
59 "Virtual memory");
60SYSCTL_NODE(, CTL_VFS, vfs, CTLFLAG_RW, 0,
61 "File system");
62SYSCTL_NODE(, CTL_NET, net, CTLFLAG_RW, 0,
63 "Network, (see socket.h)");
64SYSCTL_NODE(, CTL_DEBUG, debug, CTLFLAG_RW, 0,
65 "Debugging");
66SYSCTL_NODE(_debug, OID_AUTO, sizeof, CTLFLAG_RW, 0,
67 "Sizeof various things");
68SYSCTL_NODE(, CTL_HW, hw, CTLFLAG_RW, 0,
69 "hardware");
70SYSCTL_NODE(, CTL_MACHDEP, machdep, CTLFLAG_RW, 0,
71 "machine dependent");
72SYSCTL_NODE(, CTL_USER, user, CTLFLAG_RW, 0,
73 "user-level");
74SYSCTL_NODE(, CTL_P1003_1B, p1003_1b, CTLFLAG_RW, 0,
75 "p1003_1b, (see p1003_1b.h)");
76
77SYSCTL_NODE(, OID_AUTO, compat, CTLFLAG_RW, 0,
78 "Compatibility code");
79#ifdef REGRESSION
80SYSCTL_NODE(, OID_AUTO, regression, CTLFLAG_RW, 0,
81 "Regression test MIB");
82#endif
83
84SYSCTL_STRING(_kern, KERN_OSRELEASE, osrelease, CTLFLAG_RD,
85 osrelease, 0, "Operating system type");
86
87SYSCTL_INT(_kern, KERN_OSREV, osrevision, CTLFLAG_RD,
88 0, BSD, "Operating system revision");
89
90SYSCTL_STRING(_kern, KERN_VERSION, version, CTLFLAG_RD,
91 version, 0, "Kernel version");
92
93SYSCTL_STRING(_kern, KERN_OSTYPE, ostype, CTLFLAG_RD,
94 ostype, 0, "Operating system type");
95
96extern int osreldate;
97SYSCTL_INT(_kern, KERN_OSRELDATE, osreldate, CTLFLAG_RD,
98 &osreldate, 0, "Operating system release date");
99
100SYSCTL_INT(_kern, KERN_MAXPROC, maxproc, CTLFLAG_RD,
101 &maxproc, 0, "Maximum number of processes");
102
103SYSCTL_INT(_kern, KERN_MAXPROCPERUID, maxprocperuid, CTLFLAG_RW,
104 &maxprocperuid, 0, "Maximum processes allowed per userid");
105
106SYSCTL_INT(_kern, OID_AUTO, maxusers, CTLFLAG_RD,
107 &maxusers, 0, "Hint for kernel tuning");
108
109SYSCTL_INT(_kern, KERN_ARGMAX, argmax, CTLFLAG_RD,
110 0, ARG_MAX, "Maximum bytes of argument to execve(2)");
111
112SYSCTL_INT(_kern, KERN_POSIX1, posix1version, CTLFLAG_RD,
113 0, _KPOSIX_VERSION, "Version of POSIX attempting to comply to");
114
115SYSCTL_INT(_kern, KERN_NGROUPS, ngroups, CTLFLAG_RD,
116 0, NGROUPS_MAX, "Maximum number of groups a user can belong to");
117
118SYSCTL_INT(_kern, KERN_JOB_CONTROL, job_control, CTLFLAG_RD,
119 0, 1, "Whether job control is available");
120
121#ifdef _POSIX_SAVED_IDS
122SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ids, CTLFLAG_RD,
123 0, 1, "Whether saved set-group/user ID is available");
124#else
125SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ids, CTLFLAG_RD,
126 0, 0, "Whether saved set-group/user ID is available");
127#endif
128
129char kernelname[MAXPATHLEN] = "/kernel"; /* XXX bloat */
130
131SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW,
132 kernelname, sizeof kernelname, "Name of kernel file booted");
133
134#ifdef SMP
135SYSCTL_INT(_hw, HW_NCPU, ncpu, CTLFLAG_RD,
136 &mp_ncpus, 0, "Number of active CPUs");
137#else
138SYSCTL_INT(_hw, HW_NCPU, ncpu, CTLFLAG_RD,
139 0, 1, "Number of active CPUs");
140#endif
141
142SYSCTL_INT(_hw, HW_BYTEORDER, byteorder, CTLFLAG_RD,
143 0, BYTE_ORDER, "System byte order");
144
145SYSCTL_INT(_hw, HW_PAGESIZE, pagesize, CTLFLAG_RD,
146 0, PAGE_SIZE, "System memory page size");
147
148static char machine_arch[] = MACHINE_ARCH;
149SYSCTL_STRING(_hw, HW_MACHINE_ARCH, machine_arch, CTLFLAG_RD,
150 machine_arch, 0, "System architecture");
151
152char hostname[MAXHOSTNAMELEN];
153
154static int
155sysctl_hostname(SYSCTL_HANDLER_ARGS)
156{
157 struct prison *pr;
53#include <sys/jail.h>
54#include <sys/smp.h>
55
56SYSCTL_NODE(, 0, sysctl, CTLFLAG_RW, 0,
57 "Sysctl internal magic");
58SYSCTL_NODE(, CTL_KERN, kern, CTLFLAG_RW, 0,
59 "High kernel, proc, limits &c");
60SYSCTL_NODE(, CTL_VM, vm, CTLFLAG_RW, 0,
61 "Virtual memory");
62SYSCTL_NODE(, CTL_VFS, vfs, CTLFLAG_RW, 0,
63 "File system");
64SYSCTL_NODE(, CTL_NET, net, CTLFLAG_RW, 0,
65 "Network, (see socket.h)");
66SYSCTL_NODE(, CTL_DEBUG, debug, CTLFLAG_RW, 0,
67 "Debugging");
68SYSCTL_NODE(_debug, OID_AUTO, sizeof, CTLFLAG_RW, 0,
69 "Sizeof various things");
70SYSCTL_NODE(, CTL_HW, hw, CTLFLAG_RW, 0,
71 "hardware");
72SYSCTL_NODE(, CTL_MACHDEP, machdep, CTLFLAG_RW, 0,
73 "machine dependent");
74SYSCTL_NODE(, CTL_USER, user, CTLFLAG_RW, 0,
75 "user-level");
76SYSCTL_NODE(, CTL_P1003_1B, p1003_1b, CTLFLAG_RW, 0,
77 "p1003_1b, (see p1003_1b.h)");
78
79SYSCTL_NODE(, OID_AUTO, compat, CTLFLAG_RW, 0,
80 "Compatibility code");
81#ifdef REGRESSION
82SYSCTL_NODE(, OID_AUTO, regression, CTLFLAG_RW, 0,
83 "Regression test MIB");
84#endif
85
86SYSCTL_STRING(_kern, KERN_OSRELEASE, osrelease, CTLFLAG_RD,
87 osrelease, 0, "Operating system type");
88
89SYSCTL_INT(_kern, KERN_OSREV, osrevision, CTLFLAG_RD,
90 0, BSD, "Operating system revision");
91
92SYSCTL_STRING(_kern, KERN_VERSION, version, CTLFLAG_RD,
93 version, 0, "Kernel version");
94
95SYSCTL_STRING(_kern, KERN_OSTYPE, ostype, CTLFLAG_RD,
96 ostype, 0, "Operating system type");
97
98extern int osreldate;
99SYSCTL_INT(_kern, KERN_OSRELDATE, osreldate, CTLFLAG_RD,
100 &osreldate, 0, "Operating system release date");
101
102SYSCTL_INT(_kern, KERN_MAXPROC, maxproc, CTLFLAG_RD,
103 &maxproc, 0, "Maximum number of processes");
104
105SYSCTL_INT(_kern, KERN_MAXPROCPERUID, maxprocperuid, CTLFLAG_RW,
106 &maxprocperuid, 0, "Maximum processes allowed per userid");
107
108SYSCTL_INT(_kern, OID_AUTO, maxusers, CTLFLAG_RD,
109 &maxusers, 0, "Hint for kernel tuning");
110
111SYSCTL_INT(_kern, KERN_ARGMAX, argmax, CTLFLAG_RD,
112 0, ARG_MAX, "Maximum bytes of argument to execve(2)");
113
114SYSCTL_INT(_kern, KERN_POSIX1, posix1version, CTLFLAG_RD,
115 0, _KPOSIX_VERSION, "Version of POSIX attempting to comply to");
116
117SYSCTL_INT(_kern, KERN_NGROUPS, ngroups, CTLFLAG_RD,
118 0, NGROUPS_MAX, "Maximum number of groups a user can belong to");
119
120SYSCTL_INT(_kern, KERN_JOB_CONTROL, job_control, CTLFLAG_RD,
121 0, 1, "Whether job control is available");
122
123#ifdef _POSIX_SAVED_IDS
124SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ids, CTLFLAG_RD,
125 0, 1, "Whether saved set-group/user ID is available");
126#else
127SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ids, CTLFLAG_RD,
128 0, 0, "Whether saved set-group/user ID is available");
129#endif
130
131char kernelname[MAXPATHLEN] = "/kernel"; /* XXX bloat */
132
133SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW,
134 kernelname, sizeof kernelname, "Name of kernel file booted");
135
136#ifdef SMP
137SYSCTL_INT(_hw, HW_NCPU, ncpu, CTLFLAG_RD,
138 &mp_ncpus, 0, "Number of active CPUs");
139#else
140SYSCTL_INT(_hw, HW_NCPU, ncpu, CTLFLAG_RD,
141 0, 1, "Number of active CPUs");
142#endif
143
144SYSCTL_INT(_hw, HW_BYTEORDER, byteorder, CTLFLAG_RD,
145 0, BYTE_ORDER, "System byte order");
146
147SYSCTL_INT(_hw, HW_PAGESIZE, pagesize, CTLFLAG_RD,
148 0, PAGE_SIZE, "System memory page size");
149
150static char machine_arch[] = MACHINE_ARCH;
151SYSCTL_STRING(_hw, HW_MACHINE_ARCH, machine_arch, CTLFLAG_RD,
152 machine_arch, 0, "System architecture");
153
154char hostname[MAXHOSTNAMELEN];
155
156static int
157sysctl_hostname(SYSCTL_HANDLER_ARGS)
158{
159 struct prison *pr;
160 char tmphostname[MAXHOSTNAMELEN];
158 int error;
159
160 pr = req->td->td_proc->p_ucred->cr_prison;
161 if (pr != NULL) {
162 if (!jail_set_hostname_allowed && req->newptr)
163 return (EPERM);
161 int error;
162
163 pr = req->td->td_proc->p_ucred->cr_prison;
164 if (pr != NULL) {
165 if (!jail_set_hostname_allowed && req->newptr)
166 return (EPERM);
164 error = sysctl_handle_string(oidp, pr->pr_host,
167 /*
168 * Process is in jail, so make a local copy of jail
169 * hostname to get/set so we don't have to hold the jail
170 * mutex during the sysctl copyin/copyout activities.
171 */
172 mtx_lock(&pr->pr_mtx);
173 bcopy(pr->pr_host, tmphostname, MAXHOSTNAMELEN);
174 mtx_unlock(&pr->pr_mtx);
175
176 error = sysctl_handle_string(oidp, tmphostname,
165 sizeof pr->pr_host, req);
177 sizeof pr->pr_host, req);
178
179 if (req->newptr != NULL && error == 0) {
180 /*
181 * Copy the locally set hostname to the jail, if
182 * appropriate.
183 */
184 mtx_lock(&pr->pr_mtx);
185 bcopy(tmphostname, pr->pr_host, MAXHOSTNAMELEN);
186 mtx_unlock(&pr->pr_mtx);
187 }
166 } else
167 error = sysctl_handle_string(oidp,
168 hostname, sizeof hostname, req);
169 return (error);
170}
171
172SYSCTL_PROC(_kern, KERN_HOSTNAME, hostname,
173 CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_PRISON,
174 0, 0, sysctl_hostname, "A", "Hostname");
175
176static int regression_securelevel_nonmonotonic = 0;
177
178#ifdef REGRESSION
179SYSCTL_INT(_regression, OID_AUTO, securelevel_nonmonotonic, CTLFLAG_RW,
180 &regression_securelevel_nonmonotonic, 0, "securelevel may be lowered");
181#endif
182
183int securelevel = -1;
184
185static int
186sysctl_kern_securelvl(SYSCTL_HANDLER_ARGS)
187{
188 struct prison *pr;
189 int error, level;
190
191 pr = req->td->td_proc->p_ucred->cr_prison;
192
193 /*
194 * If the process is in jail, return the maximum of the global and
195 * local levels; otherwise, return the global level.
196 */
188 } else
189 error = sysctl_handle_string(oidp,
190 hostname, sizeof hostname, req);
191 return (error);
192}
193
194SYSCTL_PROC(_kern, KERN_HOSTNAME, hostname,
195 CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_PRISON,
196 0, 0, sysctl_hostname, "A", "Hostname");
197
198static int regression_securelevel_nonmonotonic = 0;
199
200#ifdef REGRESSION
201SYSCTL_INT(_regression, OID_AUTO, securelevel_nonmonotonic, CTLFLAG_RW,
202 &regression_securelevel_nonmonotonic, 0, "securelevel may be lowered");
203#endif
204
205int securelevel = -1;
206
207static int
208sysctl_kern_securelvl(SYSCTL_HANDLER_ARGS)
209{
210 struct prison *pr;
211 int error, level;
212
213 pr = req->td->td_proc->p_ucred->cr_prison;
214
215 /*
216 * If the process is in jail, return the maximum of the global and
217 * local levels; otherwise, return the global level.
218 */
197 if (pr != NULL)
219 if (pr != NULL) {
220 mtx_lock(&pr->pr_mtx);
198 level = imax(securelevel, pr->pr_securelevel);
221 level = imax(securelevel, pr->pr_securelevel);
199 else
222 mtx_unlock(&pr->pr_mtx);
223 } else
200 level = securelevel;
201 error = sysctl_handle_int(oidp, &level, 0, req);
202 if (error || !req->newptr)
203 return (error);
204 /*
205 * Permit update only if the new securelevel exceeds the
206 * global level, and local level if any.
207 */
208 if (pr != NULL) {
224 level = securelevel;
225 error = sysctl_handle_int(oidp, &level, 0, req);
226 if (error || !req->newptr)
227 return (error);
228 /*
229 * Permit update only if the new securelevel exceeds the
230 * global level, and local level if any.
231 */
232 if (pr != NULL) {
233 mtx_lock(&pr->pr_mtx);
209 if (!regression_securelevel_nonmonotonic &&
234 if (!regression_securelevel_nonmonotonic &&
210 (level < imax(securelevel, pr->pr_securelevel)))
235 (level < imax(securelevel, pr->pr_securelevel))) {
236 mtx_unlock(&pr->pr_mtx);
211 return (EPERM);
237 return (EPERM);
238 }
212 pr->pr_securelevel = level;
239 pr->pr_securelevel = level;
240 mtx_unlock(&pr->pr_mtx);
213 } else {
214 if (!regression_securelevel_nonmonotonic &&
215 (level < securelevel))
216 return (EPERM);
217 securelevel = level;
218 }
219 return (error);
220}
221
222SYSCTL_PROC(_kern, KERN_SECURELVL, securelevel,
223 CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_PRISON, 0, 0, sysctl_kern_securelvl,
224 "I", "Current secure level");
225
226char domainname[MAXHOSTNAMELEN];
227SYSCTL_STRING(_kern, KERN_NISDOMAINNAME, domainname, CTLFLAG_RW,
228 &domainname, sizeof(domainname), "Name of the current YP/NIS domain");
229
230u_long hostid;
231SYSCTL_ULONG(_kern, KERN_HOSTID, hostid, CTLFLAG_RW, &hostid, 0, "Host ID");
232
233/*
234 * This is really cheating. These actually live in the libc, something
235 * which I'm not quite sure is a good idea anyway, but in order for
236 * getnext and friends to actually work, we define dummies here.
237 */
238SYSCTL_STRING(_user, USER_CS_PATH, cs_path, CTLFLAG_RD,
239 "", 0, "PATH that finds all the standard utilities");
240SYSCTL_INT(_user, USER_BC_BASE_MAX, bc_base_max, CTLFLAG_RD,
241 0, 0, "Max ibase/obase values in bc(1)");
242SYSCTL_INT(_user, USER_BC_DIM_MAX, bc_dim_max, CTLFLAG_RD,
243 0, 0, "Max array size in bc(1)");
244SYSCTL_INT(_user, USER_BC_SCALE_MAX, bc_scale_max, CTLFLAG_RD,
245 0, 0, "Max scale value in bc(1)");
246SYSCTL_INT(_user, USER_BC_STRING_MAX, bc_string_max, CTLFLAG_RD,
247 0, 0, "Max string length in bc(1)");
248SYSCTL_INT(_user, USER_COLL_WEIGHTS_MAX, coll_weights_max, CTLFLAG_RD,
249 0, 0, "Maximum number of weights assigned to an LC_COLLATE locale entry");
250SYSCTL_INT(_user, USER_EXPR_NEST_MAX, expr_nest_max, CTLFLAG_RD, 0, 0, "");
251SYSCTL_INT(_user, USER_LINE_MAX, line_max, CTLFLAG_RD,
252 0, 0, "Max length (bytes) of a text-processing utility's input line");
253SYSCTL_INT(_user, USER_RE_DUP_MAX, re_dup_max, CTLFLAG_RD,
254 0, 0, "Maximum number of repeats of a regexp permitted");
255SYSCTL_INT(_user, USER_POSIX2_VERSION, posix2_version, CTLFLAG_RD,
256 0, 0,
257 "The version of POSIX 1003.2 with which the system attempts to comply");
258SYSCTL_INT(_user, USER_POSIX2_C_BIND, posix2_c_bind, CTLFLAG_RD,
259 0, 0, "Whether C development supports the C bindings option");
260SYSCTL_INT(_user, USER_POSIX2_C_DEV, posix2_c_dev, CTLFLAG_RD,
261 0, 0, "Whether system supports the C development utilities option");
262SYSCTL_INT(_user, USER_POSIX2_CHAR_TERM, posix2_char_term, CTLFLAG_RD,
263 0, 0, "");
264SYSCTL_INT(_user, USER_POSIX2_FORT_DEV, posix2_fort_dev, CTLFLAG_RD,
265 0, 0, "Whether system supports FORTRAN development utilities");
266SYSCTL_INT(_user, USER_POSIX2_FORT_RUN, posix2_fort_run, CTLFLAG_RD,
267 0, 0, "Whether system supports FORTRAN runtime utilities");
268SYSCTL_INT(_user, USER_POSIX2_LOCALEDEF, posix2_localedef, CTLFLAG_RD,
269 0, 0, "Whether system supports creation of locales");
270SYSCTL_INT(_user, USER_POSIX2_SW_DEV, posix2_sw_dev, CTLFLAG_RD,
271 0, 0, "Whether system supports software development utilities");
272SYSCTL_INT(_user, USER_POSIX2_UPE, posix2_upe, CTLFLAG_RD,
273 0, 0, "Whether system supports the user portability utilities");
274SYSCTL_INT(_user, USER_STREAM_MAX, stream_max, CTLFLAG_RD,
275 0, 0, "Min Maximum number of streams a process may have open at one time");
276SYSCTL_INT(_user, USER_TZNAME_MAX, tzname_max, CTLFLAG_RD,
277 0, 0, "Min Maximum number of types supported for timezone names");
278
279#include <sys/vnode.h>
280SYSCTL_INT(_debug_sizeof, OID_AUTO, vnode, CTLFLAG_RD,
281 0, sizeof(struct vnode), "sizeof(struct vnode)");
282
283SYSCTL_INT(_debug_sizeof, OID_AUTO, proc, CTLFLAG_RD,
284 0, sizeof(struct proc), "sizeof(struct proc)");
285
286#include <sys/conf.h>
287SYSCTL_INT(_debug_sizeof, OID_AUTO, specinfo, CTLFLAG_RD,
288 0, sizeof(struct specinfo), "sizeof(struct specinfo)");
289
290#include <sys/bio.h>
291#include <sys/buf.h>
292SYSCTL_INT(_debug_sizeof, OID_AUTO, bio, CTLFLAG_RD,
293 0, sizeof(struct bio), "sizeof(struct bio)");
294SYSCTL_INT(_debug_sizeof, OID_AUTO, buf, CTLFLAG_RD,
295 0, sizeof(struct buf), "sizeof(struct buf)");
296
297#include <sys/user.h>
298SYSCTL_INT(_debug_sizeof, OID_AUTO, kinfo_proc, CTLFLAG_RD,
299 0, sizeof(struct kinfo_proc), "sizeof(struct kinfo_proc)");
241 } else {
242 if (!regression_securelevel_nonmonotonic &&
243 (level < securelevel))
244 return (EPERM);
245 securelevel = level;
246 }
247 return (error);
248}
249
250SYSCTL_PROC(_kern, KERN_SECURELVL, securelevel,
251 CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_PRISON, 0, 0, sysctl_kern_securelvl,
252 "I", "Current secure level");
253
254char domainname[MAXHOSTNAMELEN];
255SYSCTL_STRING(_kern, KERN_NISDOMAINNAME, domainname, CTLFLAG_RW,
256 &domainname, sizeof(domainname), "Name of the current YP/NIS domain");
257
258u_long hostid;
259SYSCTL_ULONG(_kern, KERN_HOSTID, hostid, CTLFLAG_RW, &hostid, 0, "Host ID");
260
261/*
262 * This is really cheating. These actually live in the libc, something
263 * which I'm not quite sure is a good idea anyway, but in order for
264 * getnext and friends to actually work, we define dummies here.
265 */
266SYSCTL_STRING(_user, USER_CS_PATH, cs_path, CTLFLAG_RD,
267 "", 0, "PATH that finds all the standard utilities");
268SYSCTL_INT(_user, USER_BC_BASE_MAX, bc_base_max, CTLFLAG_RD,
269 0, 0, "Max ibase/obase values in bc(1)");
270SYSCTL_INT(_user, USER_BC_DIM_MAX, bc_dim_max, CTLFLAG_RD,
271 0, 0, "Max array size in bc(1)");
272SYSCTL_INT(_user, USER_BC_SCALE_MAX, bc_scale_max, CTLFLAG_RD,
273 0, 0, "Max scale value in bc(1)");
274SYSCTL_INT(_user, USER_BC_STRING_MAX, bc_string_max, CTLFLAG_RD,
275 0, 0, "Max string length in bc(1)");
276SYSCTL_INT(_user, USER_COLL_WEIGHTS_MAX, coll_weights_max, CTLFLAG_RD,
277 0, 0, "Maximum number of weights assigned to an LC_COLLATE locale entry");
278SYSCTL_INT(_user, USER_EXPR_NEST_MAX, expr_nest_max, CTLFLAG_RD, 0, 0, "");
279SYSCTL_INT(_user, USER_LINE_MAX, line_max, CTLFLAG_RD,
280 0, 0, "Max length (bytes) of a text-processing utility's input line");
281SYSCTL_INT(_user, USER_RE_DUP_MAX, re_dup_max, CTLFLAG_RD,
282 0, 0, "Maximum number of repeats of a regexp permitted");
283SYSCTL_INT(_user, USER_POSIX2_VERSION, posix2_version, CTLFLAG_RD,
284 0, 0,
285 "The version of POSIX 1003.2 with which the system attempts to comply");
286SYSCTL_INT(_user, USER_POSIX2_C_BIND, posix2_c_bind, CTLFLAG_RD,
287 0, 0, "Whether C development supports the C bindings option");
288SYSCTL_INT(_user, USER_POSIX2_C_DEV, posix2_c_dev, CTLFLAG_RD,
289 0, 0, "Whether system supports the C development utilities option");
290SYSCTL_INT(_user, USER_POSIX2_CHAR_TERM, posix2_char_term, CTLFLAG_RD,
291 0, 0, "");
292SYSCTL_INT(_user, USER_POSIX2_FORT_DEV, posix2_fort_dev, CTLFLAG_RD,
293 0, 0, "Whether system supports FORTRAN development utilities");
294SYSCTL_INT(_user, USER_POSIX2_FORT_RUN, posix2_fort_run, CTLFLAG_RD,
295 0, 0, "Whether system supports FORTRAN runtime utilities");
296SYSCTL_INT(_user, USER_POSIX2_LOCALEDEF, posix2_localedef, CTLFLAG_RD,
297 0, 0, "Whether system supports creation of locales");
298SYSCTL_INT(_user, USER_POSIX2_SW_DEV, posix2_sw_dev, CTLFLAG_RD,
299 0, 0, "Whether system supports software development utilities");
300SYSCTL_INT(_user, USER_POSIX2_UPE, posix2_upe, CTLFLAG_RD,
301 0, 0, "Whether system supports the user portability utilities");
302SYSCTL_INT(_user, USER_STREAM_MAX, stream_max, CTLFLAG_RD,
303 0, 0, "Min Maximum number of streams a process may have open at one time");
304SYSCTL_INT(_user, USER_TZNAME_MAX, tzname_max, CTLFLAG_RD,
305 0, 0, "Min Maximum number of types supported for timezone names");
306
307#include <sys/vnode.h>
308SYSCTL_INT(_debug_sizeof, OID_AUTO, vnode, CTLFLAG_RD,
309 0, sizeof(struct vnode), "sizeof(struct vnode)");
310
311SYSCTL_INT(_debug_sizeof, OID_AUTO, proc, CTLFLAG_RD,
312 0, sizeof(struct proc), "sizeof(struct proc)");
313
314#include <sys/conf.h>
315SYSCTL_INT(_debug_sizeof, OID_AUTO, specinfo, CTLFLAG_RD,
316 0, sizeof(struct specinfo), "sizeof(struct specinfo)");
317
318#include <sys/bio.h>
319#include <sys/buf.h>
320SYSCTL_INT(_debug_sizeof, OID_AUTO, bio, CTLFLAG_RD,
321 0, sizeof(struct bio), "sizeof(struct bio)");
322SYSCTL_INT(_debug_sizeof, OID_AUTO, buf, CTLFLAG_RD,
323 0, sizeof(struct buf), "sizeof(struct buf)");
324
325#include <sys/user.h>
326SYSCTL_INT(_debug_sizeof, OID_AUTO, kinfo_proc, CTLFLAG_RD,
327 0, sizeof(struct kinfo_proc), "sizeof(struct kinfo_proc)");