kern_mib.c revision 180291
115103Sphk/*-
215103Sphk * Copyright (c) 1982, 1986, 1989, 1993
315103Sphk *	The Regents of the University of California.  All rights reserved.
415103Sphk *
515103Sphk * This code is derived from software contributed to Berkeley by
615103Sphk * Mike Karels at Berkeley Software Design, Inc.
715103Sphk *
815103Sphk * Quite extensively rewritten by Poul-Henning Kamp of the FreeBSD
915103Sphk * project, to make these variables more userfriendly.
1015103Sphk *
1115103Sphk * Redistribution and use in source and binary forms, with or without
1215103Sphk * modification, are permitted provided that the following conditions
1315103Sphk * are met:
1415103Sphk * 1. Redistributions of source code must retain the above copyright
1515103Sphk *    notice, this list of conditions and the following disclaimer.
1615103Sphk * 2. Redistributions in binary form must reproduce the above copyright
1715103Sphk *    notice, this list of conditions and the following disclaimer in the
1815103Sphk *    documentation and/or other materials provided with the distribution.
1915103Sphk * 4. Neither the name of the University nor the names of its contributors
2015103Sphk *    may be used to endorse or promote products derived from this software
2115103Sphk *    without specific prior written permission.
2215103Sphk *
2315103Sphk * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2415103Sphk * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2515103Sphk * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2615103Sphk * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2715103Sphk * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2815103Sphk * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2915103Sphk * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3015103Sphk * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3115103Sphk * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3215103Sphk * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3315103Sphk * SUCH DAMAGE.
3415103Sphk *
3515103Sphk *	@(#)kern_sysctl.c	8.4 (Berkeley) 4/14/94
3615103Sphk */
3715103Sphk
38116182Sobrien#include <sys/cdefs.h>
39116182Sobrien__FBSDID("$FreeBSD: head/sys/kern/kern_mib.c 180291 2008-07-05 13:10:10Z rwatson $");
40116182Sobrien
41175417Sjhb#include "opt_compat.h"
4286190Srwatson#include "opt_posix.h"
43169604Swkoszek#include "opt_config.h"
4484611Srwatson
4515103Sphk#include <sys/param.h>
4615103Sphk#include <sys/kernel.h>
47169507Swkoszek#include <sys/sbuf.h>
4815103Sphk#include <sys/systm.h>
4915103Sphk#include <sys/sysctl.h>
5015103Sphk#include <sys/proc.h>
5187275Srwatson#include <sys/lock.h>
5287275Srwatson#include <sys/mutex.h>
5346155Sphk#include <sys/jail.h>
5476078Sjhb#include <sys/smp.h>
55105046Smike#include <sys/unistd.h>
5628918Skato
5715103SphkSYSCTL_NODE(, 0,	  sysctl, CTLFLAG_RW, 0,
5815103Sphk	"Sysctl internal magic");
5915103SphkSYSCTL_NODE(, CTL_KERN,	  kern,   CTLFLAG_RW, 0,
6015103Sphk	"High kernel, proc, limits &c");
6115103SphkSYSCTL_NODE(, CTL_VM,	  vm,     CTLFLAG_RW, 0,
6215103Sphk	"Virtual memory");
6323382SbdeSYSCTL_NODE(, CTL_VFS,	  vfs,     CTLFLAG_RW, 0,
6415103Sphk	"File system");
6515103SphkSYSCTL_NODE(, CTL_NET,	  net,    CTLFLAG_RW, 0,
6615103Sphk	"Network, (see socket.h)");
6715103SphkSYSCTL_NODE(, CTL_DEBUG,  debug,  CTLFLAG_RW, 0,
6815103Sphk	"Debugging");
6948891SphkSYSCTL_NODE(_debug, OID_AUTO,  sizeof,  CTLFLAG_RW, 0,
7048891Sphk	"Sizeof various things");
7115103SphkSYSCTL_NODE(, CTL_HW,	  hw,     CTLFLAG_RW, 0,
7215103Sphk	"hardware");
7315103SphkSYSCTL_NODE(, CTL_MACHDEP, machdep, CTLFLAG_RW, 0,
7415103Sphk	"machine dependent");
7515103SphkSYSCTL_NODE(, CTL_USER,	  user,   CTLFLAG_RW, 0,
7615103Sphk	"user-level");
7734925SdufaultSYSCTL_NODE(, CTL_P1003_1B,  p1003_1b,   CTLFLAG_RW, 0,
7834925Sdufault	"p1003_1b, (see p1003_1b.h)");
7934029Sdufault
8050465SmarcelSYSCTL_NODE(, OID_AUTO,  compat, CTLFLAG_RW, 0,
8150465Smarcel	"Compatibility code");
8289414SarrSYSCTL_NODE(, OID_AUTO, security, CTLFLAG_RW, 0,
8389414Sarr     	"Security");
8486190Srwatson#ifdef REGRESSION
8586190SrwatsonSYSCTL_NODE(, OID_AUTO, regression, CTLFLAG_RW, 0,
8686190Srwatson     "Regression test MIB");
8786190Srwatson#endif
8850465Smarcel
89116090SjmallettSYSCTL_STRING(_kern, OID_AUTO, ident, CTLFLAG_RD,
90116105Sjmallett    kern_ident, 0, "Kernel identifier");
91116090Sjmallett
9286189SrwatsonSYSCTL_STRING(_kern, KERN_OSRELEASE, osrelease, CTLFLAG_RD,
9388019Sluigi    osrelease, 0, "Operating system release");
9415103Sphk
9586189SrwatsonSYSCTL_INT(_kern, KERN_OSREV, osrevision, CTLFLAG_RD,
9646381Sbillf    0, BSD, "Operating system revision");
9715103Sphk
9886189SrwatsonSYSCTL_STRING(_kern, KERN_VERSION, version, CTLFLAG_RD,
9946381Sbillf    version, 0, "Kernel version");
10015103Sphk
10186189SrwatsonSYSCTL_STRING(_kern, KERN_OSTYPE, ostype, CTLFLAG_RD,
10246381Sbillf    ostype, 0, "Operating system type");
10315103Sphk
104119203Seivind/*
105119203Seivind * NOTICE: The *userland* release date is available in
106119203Seivind * /usr/include/osreldate.h
107119203Seivind */
10886189SrwatsonSYSCTL_INT(_kern, KERN_OSRELDATE, osreldate, CTLFLAG_RD,
109119203Seivind    &osreldate, 0, "Kernel release date");
11015103Sphk
111121307SsilbySYSCTL_INT(_kern, KERN_MAXPROC, maxproc, CTLFLAG_RDTUN,
11246381Sbillf    &maxproc, 0, "Maximum number of processes");
11315103Sphk
11486189SrwatsonSYSCTL_INT(_kern, KERN_MAXPROCPERUID, maxprocperuid, CTLFLAG_RW,
11546381Sbillf    &maxprocperuid, 0, "Maximum processes allowed per userid");
11615103Sphk
117121307SsilbySYSCTL_INT(_kern, OID_AUTO, maxusers, CTLFLAG_RDTUN,
11880418Speter    &maxusers, 0, "Hint for kernel tuning");
11980418Speter
12086189SrwatsonSYSCTL_INT(_kern, KERN_ARGMAX, argmax, CTLFLAG_RD,
12146381Sbillf    0, ARG_MAX, "Maximum bytes of argument to execve(2)");
12215103Sphk
12386189SrwatsonSYSCTL_INT(_kern, KERN_POSIX1, posix1version, CTLFLAG_RD,
124105046Smike    0, _POSIX_VERSION, "Version of POSIX attempting to comply to");
12515103Sphk
12686189SrwatsonSYSCTL_INT(_kern, KERN_NGROUPS, ngroups, CTLFLAG_RD,
12746381Sbillf    0, NGROUPS_MAX, "Maximum number of groups a user can belong to");
12815103Sphk
12986189SrwatsonSYSCTL_INT(_kern, KERN_JOB_CONTROL, job_control, CTLFLAG_RD,
13046381Sbillf    0, 1, "Whether job control is available");
13115103Sphk
13215103Sphk#ifdef _POSIX_SAVED_IDS
13386189SrwatsonSYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ids, CTLFLAG_RD,
13446381Sbillf    0, 1, "Whether saved set-group/user ID is available");
13515103Sphk#else
13686189SrwatsonSYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ids, CTLFLAG_RD,
13746381Sbillf    0, 0, "Whether saved set-group/user ID is available");
13815103Sphk#endif
13915103Sphk
14015103Sphkchar kernelname[MAXPATHLEN] = "/kernel";	/* XXX bloat */
14115103Sphk
14286189SrwatsonSYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW,
14346381Sbillf    kernelname, sizeof kernelname, "Name of kernel file booted");
14415103Sphk
14586189SrwatsonSYSCTL_INT(_hw, HW_NCPU, ncpu, CTLFLAG_RD,
14646381Sbillf    &mp_ncpus, 0, "Number of active CPUs");
14715103Sphk
14886189SrwatsonSYSCTL_INT(_hw, HW_BYTEORDER, byteorder, CTLFLAG_RD,
14946381Sbillf    0, BYTE_ORDER, "System byte order");
15015103Sphk
15186189SrwatsonSYSCTL_INT(_hw, HW_PAGESIZE, pagesize, CTLFLAG_RD,
15246381Sbillf    0, PAGE_SIZE, "System memory page size");
15315103Sphk
154106605Stmmstatic int
155169727Skansysctl_kern_arnd(SYSCTL_HANDLER_ARGS)
156169727Skan{
157176367Santoine	char buf[256];
158176367Santoine	size_t len;
159169727Skan
160176367Santoine	len = req->oldlen;
161176367Santoine	if (len > sizeof(buf))
162176367Santoine		len = sizeof(buf);
163176367Santoine	arc4rand(buf, len, 0);
164176367Santoine	return (SYSCTL_OUT(req, buf, len));
165169727Skan}
166169727Skan
167176367SantoineSYSCTL_PROC(_kern, KERN_ARND, arandom, CTLTYPE_OPAQUE | CTLFLAG_RD,
168176367Santoine    NULL, 0, sysctl_kern_arnd, "", "arc4rand");
169169727Skan
170169727Skanstatic int
171106605Stmmsysctl_hw_physmem(SYSCTL_HANDLER_ARGS)
172106605Stmm{
173106605Stmm	u_long val;
174106605Stmm
175106605Stmm	val = ctob(physmem);
176106605Stmm	return (sysctl_handle_long(oidp, &val, 0, req));
177106605Stmm}
178106605Stmm
179106605StmmSYSCTL_PROC(_hw, HW_PHYSMEM, physmem, CTLTYPE_ULONG | CTLFLAG_RD,
180106605Stmm	0, 0, sysctl_hw_physmem, "LU", "");
181106605Stmm
182106605Stmmstatic int
183142834Swessysctl_hw_realmem(SYSCTL_HANDLER_ARGS)
184142834Swes{
185142834Swes	u_long val;
186142834Swes	val = ctob(realmem);
187142834Swes	return (sysctl_handle_long(oidp, &val, 0, req));
188142834Swes}
189142834SwesSYSCTL_PROC(_hw, HW_REALMEM, realmem, CTLTYPE_ULONG | CTLFLAG_RD,
190142834Swes	0, 0, sysctl_hw_realmem, "LU", "");
191142834Swesstatic int
192106605Stmmsysctl_hw_usermem(SYSCTL_HANDLER_ARGS)
193106605Stmm{
194106605Stmm	u_long val;
195106605Stmm
196170170Sattilio	val = ctob(physmem - cnt.v_wire_count);
197106605Stmm	return (sysctl_handle_long(oidp, &val, 0, req));
198106605Stmm}
199106605Stmm
200106605StmmSYSCTL_PROC(_hw, HW_USERMEM, usermem, CTLTYPE_ULONG | CTLFLAG_RD,
201106605Stmm	0, 0, sysctl_hw_usermem, "LU", "");
202106605Stmm
203106605StmmSYSCTL_ULONG(_hw, OID_AUTO, availpages, CTLFLAG_RD, &physmem, 0, "");
204106605Stmm
20528885Skatostatic char	machine_arch[] = MACHINE_ARCH;
20628885SkatoSYSCTL_STRING(_hw, HW_MACHINE_ARCH, machine_arch, CTLFLAG_RD,
20746381Sbillf    machine_arch, 0, "System architecture");
20828885Skato
20915103Sphkchar hostname[MAXHOSTNAMELEN];
21015103Sphk
211180291Srwatson/*
212180291Srwatson * This mutex is used to protect the hostname and domainname variables, and
213180291Srwatson * perhaps in the future should also protect hostid, hostuid, and others.
214180291Srwatson */
215180291Srwatsonstruct mtx hostname_mtx;
216180291SrwatsonMTX_SYSINIT(hostname_mtx, &hostname_mtx, "hostname", MTX_DEF);
217180291Srwatson
21846155Sphkstatic int
21962573Sphksysctl_hostname(SYSCTL_HANDLER_ARGS)
22046155Sphk{
22187072Srwatson	struct prison *pr;
22287275Srwatson	char tmphostname[MAXHOSTNAMELEN];
22346155Sphk	int error;
22415103Sphk
22591406Sjhb	pr = req->td->td_ucred->cr_prison;
22687072Srwatson	if (pr != NULL) {
22757163Srwatson		if (!jail_set_hostname_allowed && req->newptr)
22886190Srwatson			return (EPERM);
22987275Srwatson		/*
23087275Srwatson		 * Process is in jail, so make a local copy of jail
23187275Srwatson		 * hostname to get/set so we don't have to hold the jail
23287275Srwatson		 * mutex during the sysctl copyin/copyout activities.
23387275Srwatson		 */
23487275Srwatson		mtx_lock(&pr->pr_mtx);
23587275Srwatson		bcopy(pr->pr_host, tmphostname, MAXHOSTNAMELEN);
23687275Srwatson		mtx_unlock(&pr->pr_mtx);
23787275Srwatson
23887275Srwatson		error = sysctl_handle_string(oidp, tmphostname,
23987072Srwatson		    sizeof pr->pr_host, req);
24087275Srwatson
24187275Srwatson		if (req->newptr != NULL && error == 0) {
24287275Srwatson			/*
24387275Srwatson			 * Copy the locally set hostname to the jail, if
24487275Srwatson			 * appropriate.
24587275Srwatson			 */
24687275Srwatson			mtx_lock(&pr->pr_mtx);
24787275Srwatson			bcopy(tmphostname, pr->pr_host, MAXHOSTNAMELEN);
24887275Srwatson			mtx_unlock(&pr->pr_mtx);
24987275Srwatson		}
250180291Srwatson	} else {
251180291Srwatson		mtx_lock(&hostname_mtx);
252180291Srwatson		bcopy(hostname, tmphostname, MAXHOSTNAMELEN);
253180291Srwatson		mtx_unlock(&hostname_mtx);
254180291Srwatson		error = sysctl_handle_string(oidp, tmphostname,
255180291Srwatson		    sizeof tmphostname, req);
256180291Srwatson		if (req->newptr != NULL && error == 0) {
257180291Srwatson			mtx_lock(&hostname_mtx);
258180291Srwatson			bcopy(tmphostname, hostname, MAXHOSTNAMELEN);
259180291Srwatson			mtx_unlock(&hostname_mtx);
260180291Srwatson		}
261180291Srwatson	}
26246155Sphk	return (error);
26346155Sphk}
26446155Sphk
26586189SrwatsonSYSCTL_PROC(_kern, KERN_HOSTNAME, hostname,
26646155Sphk       CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_PRISON,
26746381Sbillf       0, 0, sysctl_hostname, "A", "Hostname");
26846155Sphk
26986190Srwatsonstatic int	regression_securelevel_nonmonotonic = 0;
27084611Srwatson
27187072Srwatson#ifdef REGRESSION
27284611SrwatsonSYSCTL_INT(_regression, OID_AUTO, securelevel_nonmonotonic, CTLFLAG_RW,
27384611Srwatson    &regression_securelevel_nonmonotonic, 0, "securelevel may be lowered");
27486190Srwatson#endif
27584611Srwatson
27615103Sphkint securelevel = -1;
277114293Smarkmstatic struct mtx securelevel_mtx;
27815103Sphk
27993686SarrMTX_SYSINIT(securelevel_lock, &securelevel_mtx, "securelevel mutex lock",
28093686Sarr    MTX_DEF);
28193686Sarr
28215103Sphkstatic int
28362573Sphksysctl_kern_securelvl(SYSCTL_HANDLER_ARGS)
28415103Sphk{
28586145Srwatson	struct prison *pr;
28686140Srwatson	int error, level;
28715103Sphk
28891406Sjhb	pr = req->td->td_ucred->cr_prison;
28986145Srwatson
29086140Srwatson	/*
29186140Srwatson	 * If the process is in jail, return the maximum of the global and
292140676Srwatson	 * local levels; otherwise, return the global level.  Perform a
293141013Srwatson	 * lockless read since the securelevel is an integer.
29486140Srwatson	 */
295140676Srwatson	if (pr != NULL)
29686145Srwatson		level = imax(securelevel, pr->pr_securelevel);
297140676Srwatson	else
29886140Srwatson		level = securelevel;
29986140Srwatson	error = sysctl_handle_int(oidp, &level, 0, req);
30086140Srwatson	if (error || !req->newptr)
30186140Srwatson		return (error);
30286140Srwatson	/*
30386140Srwatson	 * Permit update only if the new securelevel exceeds the
30486140Srwatson	 * global level, and local level if any.
30586140Srwatson	 */
30686145Srwatson	if (pr != NULL) {
30787275Srwatson		mtx_lock(&pr->pr_mtx);
30887072Srwatson		if (!regression_securelevel_nonmonotonic &&
30987275Srwatson		    (level < imax(securelevel, pr->pr_securelevel))) {
31087275Srwatson			mtx_unlock(&pr->pr_mtx);
31186140Srwatson			return (EPERM);
31287275Srwatson		}
31386145Srwatson		pr->pr_securelevel = level;
31487275Srwatson		mtx_unlock(&pr->pr_mtx);
31586140Srwatson	} else {
31693686Sarr		mtx_lock(&securelevel_mtx);
31787072Srwatson		if (!regression_securelevel_nonmonotonic &&
31893686Sarr		    (level < securelevel)) {
31993686Sarr			mtx_unlock(&securelevel_mtx);
32086140Srwatson			return (EPERM);
32193686Sarr		}
32286140Srwatson		securelevel = level;
32393686Sarr		mtx_unlock(&securelevel_mtx);
32486140Srwatson	}
32586140Srwatson	return (error);
32615103Sphk}
32715103Sphk
32883990SrwatsonSYSCTL_PROC(_kern, KERN_SECURELVL, securelevel,
32983990Srwatson    CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_PRISON, 0, 0, sysctl_kern_securelvl,
33083990Srwatson    "I", "Current secure level");
33161370Srwatson
332169604Swkoszek#ifdef INCLUDE_CONFIG_FILE
333169507Swkoszek/* Actual kernel configuration options. */
334169507Swkoszekextern char kernconfstring[];
335169507Swkoszek
336169507Swkoszekstatic int
337169507Swkoszeksysctl_kern_config(SYSCTL_HANDLER_ARGS)
338169507Swkoszek{
339170071Simp	return (sysctl_handle_string(oidp, kernconfstring,
340170071Simp	    strlen(kernconfstring), req));
341170071Simp}
342169507Swkoszek
343169507SwkoszekSYSCTL_PROC(_kern, OID_AUTO, conftxt, CTLTYPE_STRING|CTLFLAG_RW,
344169507Swkoszek    0, 0, sysctl_kern_config, "", "Kernel configuration file");
345169650Simp#endif
346169507Swkoszek
347180291Srwatsonchar domainname[MAXHOSTNAMELEN];	/* Protected by hostname_mtx. */
34815103Sphk
349180291Srwatsonstatic int
350180291Srwatsonsysctl_domainname(SYSCTL_HANDLER_ARGS)
351180291Srwatson{
352180291Srwatson	char tmpdomainname[MAXHOSTNAMELEN];
353180291Srwatson	int error;
354180291Srwatson
355180291Srwatson	mtx_lock(&hostname_mtx);
356180291Srwatson	bcopy(domainname, tmpdomainname, MAXHOSTNAMELEN);
357180291Srwatson	mtx_unlock(&hostname_mtx);
358180291Srwatson	error = sysctl_handle_string(oidp, tmpdomainname,
359180291Srwatson	    sizeof tmpdomainname, req);
360180291Srwatson	if (req->newptr != NULL && error == 0) {
361180291Srwatson		mtx_lock(&hostname_mtx);
362180291Srwatson		bcopy(tmpdomainname, domainname, MAXHOSTNAMELEN);
363180291Srwatson		mtx_unlock(&hostname_mtx);
364180291Srwatson	}
365180291Srwatson	return (error);
366180291Srwatson}
367180291Srwatson
368180291SrwatsonSYSCTL_PROC(_kern, KERN_NISDOMAINNAME, domainname, CTLTYPE_STRING|CTLFLAG_RW,
369180291Srwatson       0, 0, sysctl_domainname, "A", "NAme of the current YP/NIS domain");
370180291Srwatson
37186190Srwatsonu_long hostid;
37278609SpirzykSYSCTL_ULONG(_kern, KERN_HOSTID, hostid, CTLFLAG_RW, &hostid, 0, "Host ID");
373168545Spjdchar hostuuid[64] = "00000000-0000-0000-0000-000000000000";
374168545SpjdSYSCTL_STRING(_kern, KERN_HOSTUUID, hostuuid, CTLFLAG_RW, hostuuid,
375168545Spjd    sizeof(hostuuid), "Host UUID");
37615103Sphk
377175021SjhbSYSCTL_NODE(_kern, OID_AUTO, features, CTLFLAG_RD, 0, "Kernel Features");
378175021Sjhb
379175417Sjhb#ifdef COMPAT_FREEBSD4
380175417SjhbFEATURE(compat_freebsd4, "Compatible with FreeBSD 4");
381175417Sjhb#endif
382175417Sjhb
383175417Sjhb#ifdef COMPAT_FREEBSD5
384175417SjhbFEATURE(compat_freebsd5, "Compatible with FreeBSD 5");
385175417Sjhb#endif
386175417Sjhb
387175417Sjhb#ifdef COMPAT_FREEBSD6
388175417SjhbFEATURE(compat_freebsd6, "Compatible with FreeBSD 6");
389175417Sjhb#endif
390175417Sjhb
391175417Sjhb#ifdef COMPAT_FREEBSD7
392175417SjhbFEATURE(compat_freebsd7, "Compatible with FreeBSD 7");
393175417Sjhb#endif
394175417Sjhb
39515103Sphk/*
39615103Sphk * This is really cheating.  These actually live in the libc, something
39786189Srwatson * which I'm not quite sure is a good idea anyway, but in order for
39815103Sphk * getnext and friends to actually work, we define dummies here.
39915103Sphk */
40086189SrwatsonSYSCTL_STRING(_user, USER_CS_PATH, cs_path, CTLFLAG_RD,
40146381Sbillf    "", 0, "PATH that finds all the standard utilities");
40286189SrwatsonSYSCTL_INT(_user, USER_BC_BASE_MAX, bc_base_max, CTLFLAG_RD,
40346381Sbillf    0, 0, "Max ibase/obase values in bc(1)");
40486189SrwatsonSYSCTL_INT(_user, USER_BC_DIM_MAX, bc_dim_max, CTLFLAG_RD,
40546381Sbillf    0, 0, "Max array size in bc(1)");
40686189SrwatsonSYSCTL_INT(_user, USER_BC_SCALE_MAX, bc_scale_max, CTLFLAG_RD,
40746381Sbillf    0, 0, "Max scale value in bc(1)");
40886189SrwatsonSYSCTL_INT(_user, USER_BC_STRING_MAX, bc_string_max, CTLFLAG_RD,
40946381Sbillf    0, 0, "Max string length in bc(1)");
41086189SrwatsonSYSCTL_INT(_user, USER_COLL_WEIGHTS_MAX, coll_weights_max, CTLFLAG_RD,
41146381Sbillf    0, 0, "Maximum number of weights assigned to an LC_COLLATE locale entry");
41218540SbdeSYSCTL_INT(_user, USER_EXPR_NEST_MAX, expr_nest_max, CTLFLAG_RD, 0, 0, "");
41386189SrwatsonSYSCTL_INT(_user, USER_LINE_MAX, line_max, CTLFLAG_RD,
41446381Sbillf    0, 0, "Max length (bytes) of a text-processing utility's input line");
41586189SrwatsonSYSCTL_INT(_user, USER_RE_DUP_MAX, re_dup_max, CTLFLAG_RD,
41646381Sbillf    0, 0, "Maximum number of repeats of a regexp permitted");
41786189SrwatsonSYSCTL_INT(_user, USER_POSIX2_VERSION, posix2_version, CTLFLAG_RD,
41886189Srwatson    0, 0,
41946381Sbillf    "The version of POSIX 1003.2 with which the system attempts to comply");
42086189SrwatsonSYSCTL_INT(_user, USER_POSIX2_C_BIND, posix2_c_bind, CTLFLAG_RD,
42146381Sbillf    0, 0, "Whether C development supports the C bindings option");
42286189SrwatsonSYSCTL_INT(_user, USER_POSIX2_C_DEV, posix2_c_dev, CTLFLAG_RD,
42346381Sbillf    0, 0, "Whether system supports the C development utilities option");
42486189SrwatsonSYSCTL_INT(_user, USER_POSIX2_CHAR_TERM, posix2_char_term, CTLFLAG_RD,
42546381Sbillf    0, 0, "");
42686189SrwatsonSYSCTL_INT(_user, USER_POSIX2_FORT_DEV, posix2_fort_dev, CTLFLAG_RD,
42746381Sbillf    0, 0, "Whether system supports FORTRAN development utilities");
42886189SrwatsonSYSCTL_INT(_user, USER_POSIX2_FORT_RUN, posix2_fort_run, CTLFLAG_RD,
42946381Sbillf    0, 0, "Whether system supports FORTRAN runtime utilities");
43086189SrwatsonSYSCTL_INT(_user, USER_POSIX2_LOCALEDEF, posix2_localedef, CTLFLAG_RD,
43146381Sbillf    0, 0, "Whether system supports creation of locales");
43286189SrwatsonSYSCTL_INT(_user, USER_POSIX2_SW_DEV, posix2_sw_dev, CTLFLAG_RD,
43346381Sbillf    0, 0, "Whether system supports software development utilities");
43486189SrwatsonSYSCTL_INT(_user, USER_POSIX2_UPE, posix2_upe, CTLFLAG_RD,
43546381Sbillf    0, 0, "Whether system supports the user portability utilities");
43686189SrwatsonSYSCTL_INT(_user, USER_STREAM_MAX, stream_max, CTLFLAG_RD,
43746381Sbillf    0, 0, "Min Maximum number of streams a process may have open at one time");
43886189SrwatsonSYSCTL_INT(_user, USER_TZNAME_MAX, tzname_max, CTLFLAG_RD,
43946381Sbillf    0, 0, "Min Maximum number of types supported for timezone names");
44048891Sphk
44148891Sphk#include <sys/vnode.h>
44286189SrwatsonSYSCTL_INT(_debug_sizeof, OID_AUTO, vnode, CTLFLAG_RD,
44348891Sphk    0, sizeof(struct vnode), "sizeof(struct vnode)");
44448891Sphk
44586189SrwatsonSYSCTL_INT(_debug_sizeof, OID_AUTO, proc, CTLFLAG_RD,
44648891Sphk    0, sizeof(struct proc), "sizeof(struct proc)");
44748927Sphk
44860041Sphk#include <sys/bio.h>
44958926Sphk#include <sys/buf.h>
45058926SphkSYSCTL_INT(_debug_sizeof, OID_AUTO, bio, CTLFLAG_RD,
45158926Sphk    0, sizeof(struct bio), "sizeof(struct bio)");
45258926SphkSYSCTL_INT(_debug_sizeof, OID_AUTO, buf, CTLFLAG_RD,
45358926Sphk    0, sizeof(struct buf), "sizeof(struct buf)");
45472376Sjake
45572376Sjake#include <sys/user.h>
45672376SjakeSYSCTL_INT(_debug_sizeof, OID_AUTO, kinfo_proc, CTLFLAG_RD,
45772376Sjake    0, sizeof(struct kinfo_proc), "sizeof(struct kinfo_proc)");
458108685Sjake
459108696Sjake/* XXX compatibility, remove for 6.0 */
460108696Sjake#include <sys/imgact.h>
461108696Sjake#include <sys/imgact_elf.h>
462108696SjakeSYSCTL_INT(_kern, OID_AUTO, fallback_elf_brand, CTLFLAG_RW,
463108696Sjake    &__elfN(fallback_brand), sizeof(__elfN(fallback_brand)),
464108696Sjake    "compatibility for kern.fallback_elf_brand");
465