kern_mib.c revision 202143
112510Sdg/*- 274259Sjlemon * Copyright (c) 1982, 1986, 1989, 1993 374178Sjlemon * The Regents of the University of California. All rights reserved. 412510Sdg * 512510Sdg * This code is derived from software contributed to Berkeley by 612510Sdg * Mike Karels at Berkeley Software Design, Inc. 712510Sdg * 812510Sdg * Quite extensively rewritten by Poul-Henning Kamp of the FreeBSD 912510Sdg * project, to make these variables more userfriendly. 1012510Sdg * 1112510Sdg * Redistribution and use in source and binary forms, with or without 1212510Sdg * modification, are permitted provided that the following conditions 1312510Sdg * are met: 1412510Sdg * 1. Redistributions of source code must retain the above copyright 1512510Sdg * notice, this list of conditions and the following disclaimer. 1612510Sdg * 2. Redistributions in binary form must reproduce the above copyright 1712510Sdg * notice, this list of conditions and the following disclaimer in the 1812510Sdg * documentation and/or other materials provided with the distribution. 1912510Sdg * 4. Neither the name of the University nor the names of its contributors 2012510Sdg * may be used to endorse or promote products derived from this software 2112510Sdg * without specific prior written permission. 2212510Sdg * 2312510Sdg * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2412510Sdg * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2512510Sdg * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2612510Sdg * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2712510Sdg * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2850477Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2912510Sdg * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3012510Sdg * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3112510Sdg * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3212510Sdg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3312510Sdg * SUCH DAMAGE. 3412510Sdg * 3512510Sdg * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94 3629138Sdg */ 3729138Sdg 3829138Sdg#include <sys/cdefs.h> 3929138Sdg__FBSDID("$FreeBSD: head/sys/kern/kern_mib.c 202143 2010-01-12 07:49:34Z brooks $"); 4029138Sdg 4129138Sdg#include "opt_compat.h" 4229138Sdg#include "opt_posix.h" 4329138Sdg#include "opt_config.h" 4429138Sdg 4529138Sdg#include <sys/param.h> 4629138Sdg#include <sys/kernel.h> 4729138Sdg#include <sys/sbuf.h> 4876526Sjlemon#include <sys/systm.h> 4982425Sjlemon#include <sys/sysctl.h> 5012510Sdg#include <sys/proc.h> 5129138Sdg#include <sys/lock.h> 5229138Sdg#include <sys/mutex.h> 5329138Sdg#include <sys/jail.h> 5429138Sdg#include <sys/smp.h> 5529138Sdg#include <sys/sx.h> 5629138Sdg#include <sys/unistd.h> 5729138Sdg 5829138SdgSYSCTL_NODE(, 0, sysctl, CTLFLAG_RW, 0, 5922255Sdg "Sysctl internal magic"); 6022255SdgSYSCTL_NODE(, CTL_KERN, kern, CTLFLAG_RW, 0, 6122255Sdg "High kernel, proc, limits &c"); 6222255SdgSYSCTL_NODE(, CTL_VM, vm, CTLFLAG_RW, 0, 6322255Sdg "Virtual memory"); 6412510SdgSYSCTL_NODE(, CTL_VFS, vfs, CTLFLAG_RW, 0, 6512510Sdg "File system"); 6612510SdgSYSCTL_NODE(, CTL_NET, net, CTLFLAG_RW, 0, 6712510Sdg "Network, (see socket.h)"); 6812510SdgSYSCTL_NODE(, CTL_DEBUG, debug, CTLFLAG_RW, 0, 6912510Sdg "Debugging"); 7012510SdgSYSCTL_NODE(_debug, OID_AUTO, sizeof, CTLFLAG_RW, 0, 7112510Sdg "Sizeof various things"); 7212510SdgSYSCTL_NODE(, CTL_HW, hw, CTLFLAG_RW, 0, 7312510Sdg "hardware"); 7412510SdgSYSCTL_NODE(, CTL_MACHDEP, machdep, CTLFLAG_RW, 0, 7512510Sdg "machine dependent"); 7676526SjlemonSYSCTL_NODE(, CTL_USER, user, CTLFLAG_RW, 0, 7776526Sjlemon "user-level"); 7876526SjlemonSYSCTL_NODE(, CTL_P1003_1B, p1003_1b, CTLFLAG_RW, 0, 7976526Sjlemon "p1003_1b, (see p1003_1b.h)"); 8076526Sjlemon 8176526SjlemonSYSCTL_NODE(, OID_AUTO, compat, CTLFLAG_RW, 0, 8276526Sjlemon "Compatibility code"); 8376526SjlemonSYSCTL_NODE(, OID_AUTO, security, CTLFLAG_RW, 0, 8476526Sjlemon "Security"); 8576526Sjlemon#ifdef REGRESSION 8676526SjlemonSYSCTL_NODE(, OID_AUTO, regression, CTLFLAG_RW, 0, 8712510Sdg "Regression test MIB"); 8812510Sdg#endif 8912510Sdg 9012510SdgSYSCTL_STRING(_kern, OID_AUTO, ident, CTLFLAG_RD|CTLFLAG_MPSAFE, 9112510Sdg kern_ident, 0, "Kernel identifier"); 9212510Sdg 9312510SdgSYSCTL_STRING(_kern, KERN_OSRELEASE, osrelease, CTLFLAG_RD|CTLFLAG_MPSAFE, 9412510Sdg osrelease, 0, "Operating system release"); 9512510Sdg 9612510SdgSYSCTL_INT(_kern, KERN_OSREV, osrevision, CTLFLAG_RD, 9712510Sdg 0, BSD, "Operating system revision"); 9812510Sdg 9912510SdgSYSCTL_STRING(_kern, KERN_VERSION, version, CTLFLAG_RD|CTLFLAG_MPSAFE, 10012510Sdg version, 0, "Kernel version"); 10112510Sdg 10212510SdgSYSCTL_STRING(_kern, KERN_OSTYPE, ostype, CTLFLAG_RD|CTLFLAG_MPSAFE, 10312510Sdg ostype, 0, "Operating system type"); 10412510Sdg 10512510Sdg/* 10612510Sdg * NOTICE: The *userland* release date is available in 10712510Sdg * /usr/include/osreldate.h 10812510Sdg */ 10912510SdgSYSCTL_INT(_kern, KERN_OSRELDATE, osreldate, CTLFLAG_RD, 11012510Sdg &osreldate, 0, "Kernel release date"); 11112510Sdg 11212510SdgSYSCTL_INT(_kern, KERN_MAXPROC, maxproc, CTLFLAG_RDTUN, 11312510Sdg &maxproc, 0, "Maximum number of processes"); 114113017Smux 115113017SmuxSYSCTL_INT(_kern, KERN_MAXPROCPERUID, maxprocperuid, CTLFLAG_RW, 116113017Smux &maxprocperuid, 0, "Maximum processes allowed per userid"); 11712510Sdg 11812510SdgSYSCTL_INT(_kern, OID_AUTO, maxusers, CTLFLAG_RDTUN, 119113017Smux &maxusers, 0, "Hint for kernel tuning"); 120113017Smux 121113017SmuxSYSCTL_INT(_kern, KERN_ARGMAX, argmax, CTLFLAG_RD, 122113017Smux 0, ARG_MAX, "Maximum bytes of argument to execve(2)"); 12312510Sdg 124113151SmuxSYSCTL_INT(_kern, KERN_POSIX1, posix1version, CTLFLAG_RD, 12512510Sdg 0, _POSIX_VERSION, "Version of POSIX attempting to comply to"); 126113151Smux 127113151SmuxSYSCTL_INT(_kern, KERN_NGROUPS, ngroups, CTLFLAG_RD, 128113151Smux &ngroups_max, 0, 129113151Smux "Maximum number of supplemental groups a user can belong to"); 130113151Smux 131113151SmuxSYSCTL_INT(_kern, KERN_JOB_CONTROL, job_control, CTLFLAG_RD, 132113151Smux 0, 1, "Whether job control is available"); 133113151Smux 134113151Smux#ifdef _POSIX_SAVED_IDS 135113151SmuxSYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ids, CTLFLAG_RD, 136113151Smux 0, 1, "Whether saved set-group/user ID is available"); 137113151Smux#else 138113151SmuxSYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ids, CTLFLAG_RD, 139113151Smux 0, 0, "Whether saved set-group/user ID is available"); 140113151Smux#endif 141113151Smux 142113151Smuxchar kernelname[MAXPATHLEN] = "/kernel"; /* XXX bloat */ 143113151Smux 14412510SdgSYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW, 145113017Smux kernelname, sizeof kernelname, "Name of kernel file booted"); 146113017Smux 147113017SmuxSYSCTL_INT(_hw, HW_NCPU, ncpu, CTLFLAG_RD, 148113151Smux &mp_ncpus, 0, "Number of active CPUs"); 149113151Smux 150113151SmuxSYSCTL_INT(_hw, HW_BYTEORDER, byteorder, CTLFLAG_RD, 151113151Smux 0, BYTE_ORDER, "System byte order"); 152113017Smux 153113151SmuxSYSCTL_INT(_hw, HW_PAGESIZE, pagesize, CTLFLAG_RD, 154113151Smux 0, PAGE_SIZE, "System memory page size"); 155113151Smux 156113151Smuxstatic int 157113151Smuxsysctl_kern_arnd(SYSCTL_HANDLER_ARGS) 158113151Smux{ 159113151Smux char buf[256]; 160113151Smux size_t len; 161113151Smux 162113151Smux len = req->oldlen; 163113151Smux if (len > sizeof(buf)) 164113151Smux len = sizeof(buf); 165113151Smux arc4rand(buf, len, 0); 166113151Smux return (SYSCTL_OUT(req, buf, len)); 167113151Smux} 168113151Smux 169113151SmuxSYSCTL_PROC(_kern, KERN_ARND, arandom, 170113151Smux CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, 171113151Smux sysctl_kern_arnd, "", "arc4rand"); 172113151Smux 173113151Smuxstatic int 174113151Smuxsysctl_hw_physmem(SYSCTL_HANDLER_ARGS) 175113151Smux{ 176113151Smux u_long val; 177113151Smux 178113151Smux val = ctob(physmem); 179113151Smux return (sysctl_handle_long(oidp, &val, 0, req)); 180113151Smux} 181113151Smux 182113151SmuxSYSCTL_PROC(_hw, HW_PHYSMEM, physmem, CTLTYPE_ULONG | CTLFLAG_RD, 183113151Smux 0, 0, sysctl_hw_physmem, "LU", ""); 184113151Smux 185113151Smuxstatic int 186113151Smuxsysctl_hw_realmem(SYSCTL_HANDLER_ARGS) 187113151Smux{ 188113151Smux u_long val; 189113151Smux val = ctob(realmem); 190113151Smux return (sysctl_handle_long(oidp, &val, 0, req)); 191113151Smux} 192113151SmuxSYSCTL_PROC(_hw, HW_REALMEM, realmem, CTLTYPE_ULONG | CTLFLAG_RD, 193113151Smux 0, 0, sysctl_hw_realmem, "LU", ""); 194113151Smuxstatic int 195113151Smuxsysctl_hw_usermem(SYSCTL_HANDLER_ARGS) 196113151Smux{ 197113151Smux u_long val; 198113151Smux 199113151Smux val = ctob(physmem - cnt.v_wire_count); 200113151Smux return (sysctl_handle_long(oidp, &val, 0, req)); 201113151Smux} 202113151Smux 203113151SmuxSYSCTL_PROC(_hw, HW_USERMEM, usermem, CTLTYPE_ULONG | CTLFLAG_RD, 204113151Smux 0, 0, sysctl_hw_usermem, "LU", ""); 205113151Smux 206113151SmuxSYSCTL_ULONG(_hw, OID_AUTO, availpages, CTLFLAG_RD, &physmem, 0, ""); 207113151Smux 208113151Smuxu_long pagesizes[MAXPAGESIZES] = { PAGE_SIZE }; 209113151Smux 210113151Smuxstatic int 211113151Smuxsysctl_hw_pagesizes(SYSCTL_HANDLER_ARGS) 212113151Smux{ 213113151Smux int error; 214113151Smux#ifdef SCTL_MASK32 215113151Smux int i; 216113151Smux uint32_t pagesizes32[MAXPAGESIZES]; 217113151Smux 218113151Smux if (req->flags & SCTL_MASK32) { 219113151Smux /* 220113151Smux * Recreate the "pagesizes" array with 32-bit elements. Truncate 221113151Smux * any page size greater than UINT32_MAX to zero. 222113151Smux */ 223113151Smux for (i = 0; i < MAXPAGESIZES; i++) 224113151Smux pagesizes32[i] = (uint32_t)pagesizes[i]; 225113151Smux 226113151Smux error = SYSCTL_OUT(req, pagesizes32, sizeof(pagesizes32)); 227113151Smux } else 228113151Smux#endif 22912510Sdg error = SYSCTL_OUT(req, pagesizes, sizeof(pagesizes)); 23029974Sdg return (error); 23129974Sdg} 23229974SdgSYSCTL_PROC(_hw, OID_AUTO, pagesizes, CTLTYPE_ULONG | CTLFLAG_RD, 233113017Smux NULL, 0, sysctl_hw_pagesizes, "LU", "Supported page sizes"); 234113017Smux 235113017Smuxstatic char machine_arch[] = MACHINE_ARCH; 236113017SmuxSYSCTL_STRING(_hw, HW_MACHINE_ARCH, machine_arch, CTLFLAG_RD, 237113017Smux machine_arch, 0, "System architecture"); 23829974Sdg 23929974Sdgstatic int 24085460Sjlemonsysctl_hostname(SYSCTL_HANDLER_ARGS) 24185460Sjlemon{ 24285460Sjlemon struct prison *pr, *cpr; 24385460Sjlemon size_t pr_offset; 24485460Sjlemon char tmpname[MAXHOSTNAMELEN]; 24585460Sjlemon int descend, error, len; 24685460Sjlemon 24785460Sjlemon /* 24829974Sdg * This function can set: hostname domainname hostuuid. 249112982Smux * Keep that in mind when comments say "hostname". 25029974Sdg */ 251112982Smux pr_offset = (size_t)arg1; 25229974Sdg len = arg2; 25312510Sdg KASSERT(len <= sizeof(tmpname), 254113017Smux ("length %d too long for %s", len, __func__)); 255113017Smux 25612510Sdg pr = req->td->td_ucred->cr_prison; 257111578Swpaul if (!(pr->pr_allow & PR_ALLOW_SET_HOSTNAME) && req->newptr) 258111578Swpaul return (EPERM); 259111578Swpaul /* 260111578Swpaul * Make a local copy of hostname to get/set so we don't have to hold 261111578Swpaul * the jail mutex during the sysctl copyin/copyout activities. 262111578Swpaul */ 263111578Swpaul mtx_lock(&pr->pr_mtx); 264111578Swpaul bcopy((char *)pr + pr_offset, tmpname, len); 265111578Swpaul mtx_unlock(&pr->pr_mtx); 266111578Swpaul 267111578Swpaul error = sysctl_handle_string(oidp, tmpname, len, req); 268111578Swpaul 269111578Swpaul if (req->newptr != NULL && error == 0) { 270113017Smux /* 271113017Smux * Copy the locally set hostname to all jails that share 272113017Smux * this host info. 273113017Smux */ 274113017Smux sx_slock(&allprison_lock); 275113017Smux while (!(pr->pr_flags & PR_HOST)) 276111578Swpaul pr = pr->pr_parent; 277111578Swpaul mtx_lock(&pr->pr_mtx); 27812510Sdg bcopy(tmpname, (char *)pr + pr_offset, len); 279113017Smux FOREACH_PRISON_DESCENDANT_LOCKED(pr, cpr, descend) 280113017Smux if (cpr->pr_flags & PR_HOST) 281113017Smux descend = 0; 282113017Smux else 283113017Smux bcopy(tmpname, (char *)cpr + pr_offset, len); 284113017Smux mtx_unlock(&pr->pr_mtx); 285113017Smux sx_sunlock(&allprison_lock); 286111578Swpaul } 28712510Sdg return (error); 28874259Sjlemon} 28974259Sjlemon 29074259SjlemonSYSCTL_PROC(_kern, KERN_HOSTNAME, hostname, 29174259Sjlemon CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_PRISON | CTLFLAG_MPSAFE, 29212510Sdg (void *)(offsetof(struct prison, pr_hostname)), MAXHOSTNAMELEN, 293111578Swpaul sysctl_hostname, "A", "Hostname"); 294113017SmuxSYSCTL_PROC(_kern, KERN_NISDOMAINNAME, domainname, 295113017Smux CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_PRISON | CTLFLAG_MPSAFE, 296111578Swpaul (void *)(offsetof(struct prison, pr_domainname)), MAXHOSTNAMELEN, 29712510Sdg sysctl_hostname, "A", "Name of the current YP/NIS domain"); 29812510SdgSYSCTL_PROC(_kern, KERN_HOSTUUID, hostuuid, 299111578Swpaul CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_PRISON | CTLFLAG_MPSAFE, 300111578Swpaul (void *)(offsetof(struct prison, pr_hostuuid)), HOSTUUIDLEN, 301111578Swpaul sysctl_hostname, "A", "Host UUID"); 302111578Swpaul 303111578Swpaulstatic int regression_securelevel_nonmonotonic = 0; 304111578Swpaul 305111578Swpaul#ifdef REGRESSION 306111578SwpaulSYSCTL_INT(_regression, OID_AUTO, securelevel_nonmonotonic, CTLFLAG_RW, 30712510Sdg ®ression_securelevel_nonmonotonic, 0, "securelevel may be lowered"); 308111578Swpaul#endif 309111578Swpaul 310111578Swpaulstatic int 311111578Swpaulsysctl_kern_securelvl(SYSCTL_HANDLER_ARGS) 312111578Swpaul{ 313111578Swpaul struct prison *pr, *cpr; 314111578Swpaul int descend, error, level; 315111578Swpaul 316111578Swpaul pr = req->td->td_ucred->cr_prison; 317111578Swpaul 31812510Sdg /* 31912510Sdg * Reading the securelevel is easy, since the current jail's level 32012510Sdg * is known to be at least as secure as any higher levels. Perform 32112510Sdg * a lockless read since the securelevel is an integer. 32212510Sdg */ 32312510Sdg level = pr->pr_securelevel; 32412510Sdg error = sysctl_handle_int(oidp, &level, 0, req); 32512510Sdg if (error || !req->newptr) 32612510Sdg return (error); 32712510Sdg /* Permit update only if the new securelevel exceeds the old. */ 32829974Sdg sx_slock(&allprison_lock); 32912510Sdg mtx_lock(&pr->pr_mtx); 33085460Sjlemon if (!regression_securelevel_nonmonotonic && 33112510Sdg level < pr->pr_securelevel) { 33212510Sdg mtx_unlock(&pr->pr_mtx); 333111578Swpaul sx_sunlock(&allprison_lock); 334111578Swpaul return (EPERM); 335111578Swpaul } 33612510Sdg pr->pr_securelevel = level; 33712510Sdg /* 33812510Sdg * Set all child jails to be at least this level, but do not lower 33912510Sdg * them (even if regression_securelevel_nonmonotonic). 34012510Sdg */ 34112510Sdg FOREACH_PRISON_DESCENDANT_LOCKED(pr, cpr, descend) { 34212510Sdg if (cpr->pr_securelevel < level) 34312510Sdg cpr->pr_securelevel = level; 34412510Sdg } 34512510Sdg mtx_unlock(&pr->pr_mtx); 34612510Sdg sx_sunlock(&allprison_lock); 347113017Smux return (error); 348113017Smux} 349113154Smux 350113154SmuxSYSCTL_PROC(_kern, KERN_SECURELVL, securelevel, 351113017Smux CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_PRISON, 0, 0, sysctl_kern_securelvl, 352113017Smux "I", "Current secure level"); 353111578Swpaul 354111578Swpaul#ifdef INCLUDE_CONFIG_FILE 355111578Swpaul/* Actual kernel configuration options. */ 356111578Swpaulextern char kernconfstring[]; 357111578Swpaul 358113017Smuxstatic int 359113017Smuxsysctl_kern_config(SYSCTL_HANDLER_ARGS) 360113017Smux{ 361113017Smux return (sysctl_handle_string(oidp, kernconfstring, 362113017Smux strlen(kernconfstring), req)); 363113017Smux} 364113017Smux 36512510SdgSYSCTL_PROC(_kern, OID_AUTO, conftxt, CTLTYPE_STRING|CTLFLAG_RW, 366111578Swpaul 0, 0, sysctl_kern_config, "", "Kernel configuration file"); 367111578Swpaul#endif 36812510Sdg 36912510Sdgstatic int 370111578Swpaulsysctl_hostid(SYSCTL_HANDLER_ARGS) 371111578Swpaul{ 37212510Sdg struct prison *pr, *cpr; 37312510Sdg u_long tmpid; 37412510Sdg int descend, error; 37512510Sdg 37612510Sdg /* 37712510Sdg * Like sysctl_hostname, except it operates on a u_long 37812510Sdg * instead of a string, and is used only for hostid. 37912510Sdg */ 38012510Sdg pr = req->td->td_ucred->cr_prison; 38112510Sdg if (!(pr->pr_allow & PR_ALLOW_SET_HOSTNAME) && req->newptr) 38212510Sdg return (EPERM); 38312510Sdg tmpid = pr->pr_hostid; 38412510Sdg error = sysctl_handle_long(oidp, &tmpid, 0, req); 38512510Sdg 386111578Swpaul if (req->newptr != NULL && error == 0) { 387111578Swpaul sx_slock(&allprison_lock); 388111578Swpaul while (!(pr->pr_flags & PR_HOST)) 389111578Swpaul pr = pr->pr_parent; 390111578Swpaul mtx_lock(&pr->pr_mtx); 391111578Swpaul pr->pr_hostid = tmpid; 392111578Swpaul FOREACH_PRISON_DESCENDANT_LOCKED(pr, cpr, descend) 393111578Swpaul if (cpr->pr_flags & PR_HOST) 394111578Swpaul descend = 0; 395111578Swpaul else 396111578Swpaul cpr->pr_hostid = tmpid; 397111578Swpaul mtx_unlock(&pr->pr_mtx); 398111578Swpaul sx_sunlock(&allprison_lock); 39912510Sdg } 40012510Sdg return (error); 40112510Sdg} 40212510Sdg 403113017SmuxSYSCTL_PROC(_kern, KERN_HOSTID, hostid, 404113017Smux CTLTYPE_ULONG | CTLFLAG_RW | CTLFLAG_PRISON | CTLFLAG_MPSAFE, 405113017Smux NULL, 0, sysctl_hostid, "LU", "Host ID"); 406113017Smux 407113017SmuxSYSCTL_NODE(_kern, OID_AUTO, features, CTLFLAG_RD, 0, "Kernel Features"); 408113017Smux 409113017Smux#ifdef COMPAT_FREEBSD4 410113017SmuxFEATURE(compat_freebsd4, "Compatible with FreeBSD 4"); 411113017Smux#endif 412113017Smux 413113017Smux#ifdef COMPAT_FREEBSD5 414113017SmuxFEATURE(compat_freebsd5, "Compatible with FreeBSD 5"); 415113017Smux#endif 416113017Smux 417113017Smux#ifdef COMPAT_FREEBSD6 418113017SmuxFEATURE(compat_freebsd6, "Compatible with FreeBSD 6"); 419113017Smux#endif 42012510Sdg 42112510Sdg#ifdef COMPAT_FREEBSD7 42212510SdgFEATURE(compat_freebsd7, "Compatible with FreeBSD 7"); 42312510Sdg#endif 42412510Sdg 42512510Sdg/* 42612510Sdg * This is really cheating. These actually live in the libc, something 42774178Sjlemon * which I'm not quite sure is a good idea anyway, but in order for 42874178Sjlemon * getnext and friends to actually work, we define dummies here. 42974178Sjlemon */ 43074178SjlemonSYSCTL_STRING(_user, USER_CS_PATH, cs_path, CTLFLAG_RD, 43112510Sdg "", 0, "PATH that finds all the standard utilities"); 43212510SdgSYSCTL_INT(_user, USER_BC_BASE_MAX, bc_base_max, CTLFLAG_RD, 43312510Sdg 0, 0, "Max ibase/obase values in bc(1)"); 43412510SdgSYSCTL_INT(_user, USER_BC_DIM_MAX, bc_dim_max, CTLFLAG_RD, 43512510Sdg 0, 0, "Max array size in bc(1)"); 43612510SdgSYSCTL_INT(_user, USER_BC_SCALE_MAX, bc_scale_max, CTLFLAG_RD, 43712510Sdg 0, 0, "Max scale value in bc(1)"); 43823964SdgSYSCTL_INT(_user, USER_BC_STRING_MAX, bc_string_max, CTLFLAG_RD, 43923964Sdg 0, 0, "Max string length in bc(1)"); 44023964SdgSYSCTL_INT(_user, USER_COLL_WEIGHTS_MAX, coll_weights_max, CTLFLAG_RD, 44123964Sdg 0, 0, "Maximum number of weights assigned to an LC_COLLATE locale entry"); 44223964SdgSYSCTL_INT(_user, USER_EXPR_NEST_MAX, expr_nest_max, CTLFLAG_RD, 0, 0, ""); 44323964SdgSYSCTL_INT(_user, USER_LINE_MAX, line_max, CTLFLAG_RD, 44423964Sdg 0, 0, "Max length (bytes) of a text-processing utility's input line"); 44523964SdgSYSCTL_INT(_user, USER_RE_DUP_MAX, re_dup_max, CTLFLAG_RD, 44623964Sdg 0, 0, "Maximum number of repeats of a regexp permitted"); 44723964SdgSYSCTL_INT(_user, USER_POSIX2_VERSION, posix2_version, CTLFLAG_RD, 44876630Sjlemon 0, 0, 44974178Sjlemon "The version of POSIX 1003.2 with which the system attempts to comply"); 45023964SdgSYSCTL_INT(_user, USER_POSIX2_C_BIND, posix2_c_bind, CTLFLAG_RD, 45123964Sdg 0, 0, "Whether C development supports the C bindings option"); 45223964SdgSYSCTL_INT(_user, USER_POSIX2_C_DEV, posix2_c_dev, CTLFLAG_RD, 45323964Sdg 0, 0, "Whether system supports the C development utilities option"); 45423964SdgSYSCTL_INT(_user, USER_POSIX2_CHAR_TERM, posix2_char_term, CTLFLAG_RD, 45523964Sdg 0, 0, ""); 45623964SdgSYSCTL_INT(_user, USER_POSIX2_FORT_DEV, posix2_fort_dev, CTLFLAG_RD, 45726623Sdg 0, 0, "Whether system supports FORTRAN development utilities"); 45824079SdgSYSCTL_INT(_user, USER_POSIX2_FORT_RUN, posix2_fort_run, CTLFLAG_RD, 45934014Sdg 0, 0, "Whether system supports FORTRAN runtime utilities"); 46085460SjlemonSYSCTL_INT(_user, USER_POSIX2_LOCALEDEF, posix2_localedef, CTLFLAG_RD, 46185460Sjlemon 0, 0, "Whether system supports creation of locales"); 46285460SjlemonSYSCTL_INT(_user, USER_POSIX2_SW_DEV, posix2_sw_dev, CTLFLAG_RD, 46385460Sjlemon 0, 0, "Whether system supports software development utilities"); 46485460SjlemonSYSCTL_INT(_user, USER_POSIX2_UPE, posix2_upe, CTLFLAG_RD, 46585460Sjlemon 0, 0, "Whether system supports the user portability utilities"); 46685460SjlemonSYSCTL_INT(_user, USER_STREAM_MAX, stream_max, CTLFLAG_RD, 46785460Sjlemon 0, 0, "Min Maximum number of streams a process may have open at one time"); 46885460SjlemonSYSCTL_INT(_user, USER_TZNAME_MAX, tzname_max, CTLFLAG_RD, 46985460Sjlemon 0, 0, "Min Maximum number of types supported for timezone names"); 47085460Sjlemon 471#include <sys/vnode.h> 472SYSCTL_INT(_debug_sizeof, OID_AUTO, vnode, CTLFLAG_RD, 473 0, sizeof(struct vnode), "sizeof(struct vnode)"); 474 475SYSCTL_INT(_debug_sizeof, OID_AUTO, proc, CTLFLAG_RD, 476 0, sizeof(struct proc), "sizeof(struct proc)"); 477 478#include <sys/bio.h> 479#include <sys/buf.h> 480SYSCTL_INT(_debug_sizeof, OID_AUTO, bio, CTLFLAG_RD, 481 0, sizeof(struct bio), "sizeof(struct bio)"); 482SYSCTL_INT(_debug_sizeof, OID_AUTO, buf, CTLFLAG_RD, 483 0, sizeof(struct buf), "sizeof(struct buf)"); 484 485#include <sys/user.h> 486SYSCTL_INT(_debug_sizeof, OID_AUTO, kinfo_proc, CTLFLAG_RD, 487 0, sizeof(struct kinfo_proc), "sizeof(struct kinfo_proc)"); 488 489/* XXX compatibility, remove for 6.0 */ 490#include <sys/imgact.h> 491#include <sys/imgact_elf.h> 492SYSCTL_INT(_kern, OID_AUTO, fallback_elf_brand, CTLFLAG_RW, 493 &__elfN(fallback_brand), sizeof(__elfN(fallback_brand)), 494 "compatibility for kern.fallback_elf_brand"); 495