summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_mib.c
Commit message (Collapse)AuthorAgeFilesLines
* back out half of 244098.alfred2012-12-111-1/+1
| | | | | | kern.bootfile needs to be rw for installkernel. Pointed out by: kib, flo
* make sysctls kern.{bootfile,conftxt} read-onlyalfred2012-12-101-10/+3
| | | | MFC after: 1 month
* As a safety measure, disable lowering pid_max too much.kib2012-08-161-2/+6
| | | | | Requested by: Peter Jeremy <peter@rulingia.com> MFC after: 1 week
* Add a sysctl kern.pid_max, which limits the maximum pid the system iskib2012-08-151-0/+24
| | | | | | | allowed to allocate, and corresponding tunable with the same name. Note that existing processes with higher pids are left intact. MFC after: 1 week
* Define two new sysctl node flags: CTLFLAG_CAPRD and CTLFLAG_CAPRW, whichrwatson2011-07-171-17/+19
| | | | | | | | | | | | | | | | | | | may be jointly referenced via the mask CTLFLAG_CAPRW. Sysctls with these flags are available in Capsicum's capability mode; other sysctl nodes are not. Flag several useful sysctls as available in capability mode, such as memory layout sysctls required by the run-time linker and malloc(3). Also expose access to randomness and available kernel features. A few sysctls are enabled to support name->MIB conversion; these may leak information to capability mode by virtue of providing resolution on names not flagged for access in capability mode. This is, generally, not a huge problem, but might be something to resolve in the future. Flag these cases with XXX comments. Submitted by: jonathan Sponsored by: Google, Inc.
* sysctl(9) cleanup checkpoint: amd64 GENERIC builds cleanly.mdf2011-01-121-1/+1
| | | | Commit the kernel changes.
* When compat32 binary asks for the value of hw.machine_arch, report thekib2010-07-221-3/+25
| | | | | | | | | | | name of 32bit sibling architecture instead of the host one. Do the same for hw.machine on amd64. Add a safety belt debug.adaptive_machine_arch sysctl, to turn the substitution off. Reviewed by: jhb, nwhitehorn MFC after: 2 weeks
* Declare the kern.ngroups sysctl to be read-only, but tunable at boot forbrooks2010-01-121-1/+1
| | | | | | | better error reporting. Submitted by: Matthew Fleming <matthew dot fleming at isilon dot com> MFC After: 1 month
* Replace the static NGROUPS=NGROUPS_MAX+1=1024 with a dynamicbrooks2010-01-121-1/+1
| | | | | | | | kern.ngroups+1. kern.ngroups can range from NGROUPS_MAX=1023 to INT_MAX-1. Given that the Windows group limit is 1024, this range should be sufficient for most applications. MFC after: 1 month
* Correct the explination text for the kern.ngroups. It reflects thebrooks2010-01-091-1/+2
| | | | | | number of supplemental groups, not the total number of groups. MFC after: 3 days
* Add a new sysctl for reporting all of the supported page sizes.alc2009-09-181-0/+27
| | | | | Reviewed by: jhb MFC after: 3 weeks
* Rename the host-related prison fields to be the same as the host.*jamie2009-06-131-3/+3
| | | | | | | parameters they represent, and the variables they replaced, instead of abbreviated versions of them. Approved by: bz (mentor)
* Place hostnames and similar information fully under the prison system.jamie2009-05-291-77/+79
| | | | | | | | | | | | | | | | | The system hostname is now stored in prison0, and the global variable "hostname" has been removed, as has the hostname_mtx mutex. Jails may have their own host information, or they may inherit it from the parent/system. The proper way to read the hostname is via getcredhostname(), which will copy either the hostname associated with the passed cred, or the system hostname if you pass NULL. The system hostname can still be accessed directly (and without locking) at prison0.pr_host, but that should be avoided where possible. The "similar information" referred to is domainname, hostid, and hostuuid, which have also become prison parameters and had their associated global variables removed. Approved by: bz (mentor)
* Add hierarchical jails. A jail may further virtualize its environmentjamie2009-05-271-37/+29
| | | | | | | | | | | | | | | | | | | | | | by creating a child jail, which is visible to that jail and to any parent jails. Child jails may be restricted more than their parents, but never less. Jail names reflect this hierarchy, being MIB-style dot-separated strings. Every thread now points to a jail, the default being prison0, which contains information about the physical system. Prison0's root directory is the same as rootvnode; its hostname is the same as the global hostname, and its securelevel replaces the global securelevel. Note that the variable "securelevel" has actually gone away, which should not cause any problems for code that properly uses securelevel_gt() and securelevel_ge(). Some jail-related permissions that were kept in global variables and set via sysctls are now per-jail settings. The sysctls still exist for backward compatibility, used only by the now-deprecated jail(2) system call. Approved by: bz (mentor)
* Introduce a new virtualization container, provisionally named vprocg, to holdzec2009-05-081-2/+5
| | | | | | | | | | | | | | | | | | | | | | virtualized instances of hostname and domainname, as well as a new top-level virtualization struct vimage, which holds pointers to struct vnet and struct vprocg. Struct vprocg is likely to become replaced in the near future with a new jail management API import. As a consequence of this change, change struct ucred to point to a struct vimage, instead of directly pointing to a vnet. Merge vnet / vimage / ucred refcounting infrastructure from p4 / vimage branch. Permit kldload / kldunload operations to be executed only from the default vimage context. This change should have no functional impact on nooptions VIMAGE kernel builds. Reviewed by: bz Approved by: julian (mentor)
* Permit buiding kernels with options VIMAGE, restricted to only a singlezec2009-04-301-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | active network stack instance. Turning on options VIMAGE at compile time yields the following changes relative to default kernel build: 1) V_ accessor macros for virtualized variables resolve to structure fields via base pointers, instead of being resolved as fields in global structs or plain global variables. As an example, V_ifnet becomes: options VIMAGE: ((struct vnet_net *) vnet_net)->_ifnet default build: vnet_net_0._ifnet options VIMAGE_GLOBALS: ifnet 2) INIT_VNET_* macros will declare and set up base pointers to be used by V_ accessor macros, instead of resolving to whitespace: INIT_VNET_NET(ifp->if_vnet); becomes struct vnet_net *vnet_net = (ifp->if_vnet)->mod_data[VNET_MOD_NET]; 3) Memory for vnet modules registered via vnet_mod_register() is now allocated at run time in sys/kern/kern_vimage.c, instead of per vnet module structs being declared as globals. If required, vnet modules can now request the framework to provide them with allocated bzeroed memory by filling in the vmi_size field in their vmi_modinfo structures. 4) structs socket, ifnet, inpcbinfo, tcpcb and syncache_head are extended to hold a pointer to the parent vnet. options VIMAGE builds will fill in those fields as required. 5) curvnet is introduced as a new global variable in options VIMAGE builds, always pointing to the default and only struct vnet. 6) struct sysctl_oid has been extended with additional two fields to store major and minor virtualization module identifiers, oid_v_subs and oid_v_mod. SYSCTL_V_* family of macros will fill in those fields accordingly, and store the offset in the appropriate vnet container struct in oid_arg1. In sysctl handlers dealing with virtualized sysctls, the SYSCTL_RESOLVE_V_ARG1() macro will compute the address of the target variable and make it available in arg1 variable for further processing. Unused fields in structs vnet_inet, vnet_inet6 and vnet_ipfw have been deleted. Reviewed by: bz, rwatson Approved by: julian (mentor)
* Mark most often used sysctl's as MPSAFE.ed2009-01-281-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | After running a `make buildkernel', I noticed most of the Giant locks in sysctl are only caused by a very small amount of sysctl's: - sysctl.name2oid. This one is locked by SYSCTL_LOCK, just like sysctl.oidfmt. - kern.ident, kern.osrelease, kern.version, etc. These are just constant strings. - kern.arandom, used by the stack protector. It is already protected by arc4_mtx. I also saw the following sysctl's show up. Not as often as the ones above, but still quite often: - security.jail.jailed. Also mark security.jail.list as MPSAFE. They don't need locking or already use allprison_lock. - kern.devname, used by devname(3), ttyname(3), etc. This seems to reduce Giant locking inside sysctl by ~75% in my primitive test setup.
* Step 1.5 of importing the network stack virtualization infrastructurezec2008-10-021-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | from the vimage project, as per plan established at devsummit 08/08: http://wiki.freebsd.org/Image/Notes200808DevSummit Introduce INIT_VNET_*() initializer macros, VNET_FOREACH() iterator macros, and CURVNET_SET() context setting macros, all currently resolving to NOPs. Prepare for virtualization of selected SYSCTL objects by introducing a family of SYSCTL_V_*() macros, currently resolving to their global counterparts, i.e. SYSCTL_V_INT() == SYSCTL_INT(). Move selected #defines from sys/sys/vimage.h to newly introduced header files specific to virtualized subsystems (sys/net/vnet.h, sys/netinet/vinet.h etc.). All the changes are verified to have zero functional impact at this point in time by doing MD5 comparision between pre- and post-change object files(*). (*) netipsec/keysock.c did not validate depending on compile time options. Implemented by: julian, bz, brooks, zec Reviewed by: julian, bz, brooks, kris, rwatson, ... Approved by: julian (mentor) Obtained from: //depot/projects/vimage-commit2/... X-MFC after: never Sponsored by: NLnet Foundation, The FreeBSD Foundation
* Fix a typo in r180291trhodes2008-08-281-1/+1
| | | | "NAme of the current YP/NIS domain" -> "Name of the current YP/NIS domain"
* Commit step 1 of the vimage project, (network stack)bz2008-08-171-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | virtualization work done by Marko Zec (zec@). This is the first in a series of commits over the course of the next few weeks. Mark all uses of global variables to be virtualized with a V_ prefix. Use macros to map them back to their global names for now, so this is a NOP change only. We hope to have caught at least 85-90% of what is needed so we do not invalidate a lot of outstanding patches again. Obtained from: //depot/projects/vimage-commit2/... Reviewed by: brooks, des, ed, mav, julian, jamie, kris, rwatson, zec, ... (various people I forgot, different versions) md5 (with a bit of help) Sponsored by: NLnet Foundation, The FreeBSD Foundation X-MFC after: never V_Commit_Message_Reviewed_By: more people than the patch
* Introduce a new lock, hostname_mtx, and use it to synchronize accessrwatson2008-07-051-6/+42
| | | | | | | | | | | | to global hostname and domainname variables. Where necessary, copy to or from a stack-local buffer before performing copyin() or copyout(). A few uses, such as in cd9660 and daemon_saver, remain under-synchronized and will require further updates. Correct a bug in which a failed copyin() of domainname would leave domainname potentially corrupted. MFC after: 3 weeks
* Make sysctl_kern_arnd return a random buffer instead of a random long,antoine2008-02-171-6/+10
| | | | | | | | as it is expected by userland (stack protector guard setup for example). PR: 119129 Approved by: rwatson (mentor) MFC after: 1 month
* Add 'compat_freebsd[4567]' features corresponding to the kernel optionsjhb2008-01-171-0/+17
| | | | | | | COMPAT_FREEBSD[4567]. MFC after: 1 week Requested by: kris
* Actually declare the kern.features sysctl node.jhb2007-12-311-0/+2
| | | | Pointy hat to: jhb
* Implement fetching of the __FreeBSD_version from the ELF ABI-tag note.kib2007-12-041-1/+0
| | | | | | | The value is read into the p_osrel member of the struct proc. p_osrel is set to 0 for the binaries without the note. MFC after: 3 days
* Revert VMCNT_* operations introduction.attilio2007-05-311-1/+1
| | | | | | | | Probabilly, a general approach is not the better solution here, so we should solve the sched_lock protection problems separately. Requested by: alc Approved by: jeff (mentor)
* Simplify the kernel configuration file return code.imp2007-05-281-22/+3
| | | | Reviewed by: wkoszek
* Add kern.arnd sysctl. SSP code uses it to initialize the stack guardkan2007-05-191-0/+12
| | | | | | magic value. Submitted by: Jeremie Le Hen <jeremie@le-hen.org>
* - define and use VMCNT_{GET,SET,ADD,SUB,PTR} macros for manipulatingjeff2007-05-181-1/+1
| | | | | | | | vmcnts. This can be used to abstract away pcpu details but also changes to use atomics for all counters now. This means sched lock is no longer responsible for protecting counts in the switch routines. Contributed by: Attilio Rao <attilio@FreeBSD.org>
* Don't export a kern.conftxt sysctl, except when INCLUDE_CONF_FILE isimp2007-05-171-3/+1
| | | | | | | | | | | | | | defined. This restores the old behavior, and eliminates the dependency on the kernconf.tmpl when INCLUDE_CONFIG_FILE isn't included in the kernel config. There were many people in the terminal room that had almost, but not quite, up-to-date config files that this helps. I don't know if this is the result of skew among the cvsup servers, or some other more subtle problem. However, this fix should work for any config of recent vintage (I tested with the latest, and one before the recent changes, and eye-balled the intermediate versions). Reviewed by: the terminal room crew
* Handle !INCLUDE_CONFIG_FILE entirely in the kernel. This should make somewkoszek2007-05-161-0/+5
| | | | | | | | developers happy, since it will let them to use old config(8) with newer kernels. Reviewed by: imp Approved by: imp
* Improve INCLUDE_CONFIG_FILE support.wkoszek2007-05-121-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change will let us to have full configuration of a running kernel available in sysctl: sysctl -b kern.conftxt The same configuration is also contained within the kernel image. It can be obtained with: config -x <kernelfile> Current functionality lets you to quickly recover kernel configuration, by simply redirecting output from commands presented above and starting kernel build procedure. "include" statements are also honored, which means options and devices from included files are also included. Please note that comments from configuration files are not preserved by default. In order to preserve them, you can use -C flag for config(8). This will bring configuration file and included files literally; however, redirection to a file no longer works directly. This commit was followed by discussion, that took place on freebsd-current@. For more details, look here: http://lists.freebsd.org/pipermail/freebsd-current/2007-March/069994.html http://lists.freebsd.org/pipermail/freebsd-current/2007-May/071844.html Development of this patch took place in Perforce, hierarchy: //depot/user/wkoszek/wkoszek_kconftxt/ Support from: freebsd-current@ (links above) Reviewed by: imp@ Approved by: imp@
* Add kern.hostuuid sysctl, which will be used to keep host's UUID.pjd2007-04-091-0/+3
| | | | Reviewed by: mlaier, rink, brooks, rwatson
* mp_ncpus is always (properly) initialized, even on UP kernels, so just use it.pjd2005-08-211-5/+0
|
* Collect the devfs related sysctls in one placephk2005-08-161-4/+0
|
* Add a sysctl that records the amount of physical memory in the machine.wes2005-02-281-0/+9
| | | | | Submitted by: Nicko Dehaine <nicko@stbernard.com> MFC after: 1 day
* Fix spelling of integer in a comment.rwatson2005-01-301-1/+1
| | | | Beady eyes: ceri
* When retrieving the current per-jails securelevel for a sysctl read,rwatson2005-01-231-5/+4
| | | | | | | don't acquire the prison mutex, as it's an integer read and races here don't make a difference. MFC after: 1 week
* Remove advertising clause from University of California Regent's license,imp2004-04-051-4/+0
| | | | | | per letter dated July 22, 1999. Approved by: core
* Change all SYSCTLS which are readonly and have a related TUNABLEsilby2003-10-211-2/+2
| | | | | from CTLFLAG_RD to CTLFLAG_RDTUN so that sysctl(8) can provide more useful error messages.
* Change description of kern.osreldate from "Operating system release date" toeivind2003-08-211-1/+5
| | | | "Kernel release date" - userland version is in /usr/include/osreldate.h
* Use __FBSDID().obrien2003-06-111-1/+3
|
* Attempt to fix Alpha build by renaming ident[] to kern_ident[].jmallett2003-06-091-1/+1
|
* Expose kern.ident by way of OID_AUTO.jmallett2003-06-091-0/+3
| | | | Requested by: phk
* Fix some easy, global, lint warnings. In most cases, this meansmarkm2003-04-301-1/+1
| | | | | making some local variables static. In a couple of cases, this means removing an unused variable.
* - Provide backwards compatibility for kern.fallback_elf_brand.jake2003-01-051-3/+6
| | | | | - Use the generic elf type macros in imgact_elf.h instead of ifdefing the entire contents of the header.
* Improve the way that an elf image activator for an alternate word size isjake2003-01-041-0/+4
| | | | | | | | | | | included in the kernel. Include imgact_elf.c in conf/files, instead of both imgact_elf32.c and imgact_elf64.c, which will use the default word size for an architecture as defined in machine/elf.h. Architectures that wish to build an additional image activator for an alternate word size can include either imgact_elf32.c or imgact_elf64.c in files.${ARCH}, which allows it to be dependent on MD options instead of solely on architecture. Glanced at by: peter
* Move the definitions of the hw.physmem, hw.usermem and hw.availpagestmm2002-11-071-0/+26
| | | | | | | | | | | sysctls to MI code; this reduces code duplication and makes all of them available on sparc64, and the latter two on powerpc. The semantics by the i386 and pc98 hw.availpages is slightly changed: previously, holes between ranges of available pages would be included, while they are excluded now. The new behaviour should be more correct and brings i386 in line with the other architectures. Move physmem to vm/vm_init.c, where this variable is used in MI code.
* Update a sysctl to use _POSIX_VERSION from <sys/unistd.h>, instead ofmike2002-10-131-2/+2
| | | | the kernel option _KPOSIX_VERSION.
* Include <sys/_posix.h> directly instead of depending on <sys/proc.h>mike2002-10-131-0/+1
| | | | to include <sys/signal.h> to include <sys/_posix.h>.
OpenPOWER on IntegriCloud