summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_mib.c
Commit message (Collapse)AuthorAgeFilesLines
* 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>.
* Rename struct specinfo to the more appropriate struct cdev.phk2002-09-271-2/+2
| | | | Agreed on: jake, rwatson, jhb
* - Add a mutex to lock the global securelevel value.arr2002-04-021-1/+9
| | | | - Make use of MTX_SYSINIT() as the means to initialize our mutex lock.
* Simple p_ucred -> td_ucred changes to start using the per-thread ucredjhb2002-02-271-2/+2
| | | | reference.
* - Attempt to help declutter kern. sysctl by moving security out fromarr2002-01-161-0/+2
| | | | | | beneath it. Reviewed by: rwatson
* Add/correct description for some sysctl variables where it was missing.luigi2001-12-161-1/+1
| | | | | | | | The description field is unused in -stable, so the MFC there is equivalent to a comment. It can be done at any time, i am just setting a reminder in 45 days when hopefully we are past 4.5-release. MFC after: 45 days
* o Remove unnecessary inclusion of opt_global.h.rwatson2001-12-061-1/+0
| | | | Submitted by: bde
* o Introduce pr_mtx into struct prison, providing protection for therwatson2001-12-031-4/+32
| | | | | | | | | | | | | | | | | | mutable contents of struct prison (hostname, securelevel, refcount, pr_linux, ...) o Generally introduce mtx_lock()/mtx_unlock() calls throughout kern/ so as to enforce these protections, in particular, in kern_mib.c protection sysctl access to the hostname and securelevel, as well as kern_prot.c access to the securelevel for access control purposes. o Rewrite linux emulator abstractions for accessing per-jail linux mib entries (osname, osrelease, osversion) so that they don't return a pointer to the text in the struct linux_prison, rather, a copy to an array passed into the calls. Likewise, update linprocfs to use these primitives. o Update in_pcb.c to always use prison_getip() rather than directly accessing struct prison. Reviewed by: jhb
* o Cache req->td->td_proc->p_ucred->cr_prison in pr to improverwatson2001-11-281-13/+10
| | | | | | | | | | readability. o Conditionalize only the SYSCTL definitions for the regression tree, not the variables itself, decreasing the number of #ifdef REGRESSIONs scattered in kern_mib.c, and making the code more readable. Sponsored by: DARPA, NAI Labs
* o General style improvemnts.rwatson2001-11-081-10/+11
| | | | Submitted by: bde
* o Trim trailing whitespace from kern_mib.c, as suggested by bde. Goodrwatson2001-11-081-45/+45
| | | | grief.
* o Replace reference to 'struct proc' with 'struct thread' in 'structrwatson2001-11-081-4/+4
| | | | | | | | | | | | | | | sysctl_req', which describes in-progress sysctl requests. This permits sysctl handlers to have access to the current thread, permitting work on implementing td->td_ucred, migration of suser() to using struct thread to derive the appropriate ucred, and allowing struct thread to be passed down to other code, such as network code where td is not currently available (and curproc is used). o Note: netncp and netsmb are not updated to reflect this change, as they are not currently KSE-adapted. Reviewed by: julian Obtained from: TrustedBSD Project
* o Cache the process's struct prison so as to create a more visuallyrwatson2001-11-061-7/+8
| | | | | | appealing code structure. In particular, s/req->p->p_ucred->cr_prison/pr/ Requested by: imp, jhb, jake, other hangers on
* o Remove a tab missed in the previous whitespace commit.rwatson2001-11-061-1/+1
|
* o Remove double-indentation of sysctl_kern_securelvl. This change isrwatson2001-11-061-31/+30
| | | | | | consistent with the one other function in the file, and prevents long lines in up-coming changes. This nominally pulls kern_mib.c a little further down the long path to style(9) compliance.
* o Introduce an 'options REGRESSION'-dependant sysctl namespaces,rwatson2001-10-071-0/+19
| | | | | | | | | | | | 'regression.*'. o Add 'regression.securelevel_nonmonotonic', conditional on 'options REGRESSION', which allows the securelevel to be lowered for the purposes of efficient regression testing of securelevel policy decisions. Regression tests for securelevels will be committed shortly. NOTE: 'options REGRESSION' should never be used on production machines, as it permits violation of system invariants so as to improve the ability to effectively test edge cases, and improve testing efficiency.
* o Modify kern.securelevel MIB entry to return a local securelevel, ifrwatson2001-09-261-6/+27
| | | | | | | | | | | | | one is present in the current jail, otherwise, to return the global securelevel. o If the securelevel is being updated, require that it be greater than the maximum of local and global, if a local securelevel exists, otherwise, just maximum of the global. If there is a local securelevel, update the local one instead of the global one. o Note: this does allow local securelevels to lag behind the global one as long as the local one is not updated following a global increase. Obtained from: TrustedBSD Project
* Fix cut/paste blunder. Serves me right for doing a last minute tweakpeter2001-07-271-1/+1
| | | | | | to what I had for some time. Submitted by: bde
* Move param.c out of the conf directory and make it fully dynamic.peter2001-07-261-0/+3
| | | | | | Tunables are now derived at boot time from maxusers. ie: change maxusers via a tunable and all the derivative settings change. You can change the other tunables individually as well. Even hz etc is tunable.
* changed hostid from long to unsigned long to be able to store values > 2GBpirzyk2001-06-221-3/+2
| | | | | | | | on i386 platforms. Also changed SYSCTL type from INT to ULONG and removed comment about it. PR: kern/21132 MFC after: 1 month
* Overhaul of the SMP code. Several portions of the SMP kernel support havejhb2001-04-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | been made machine independent and various other adjustments have been made to support Alpha SMP. - It splits the per-process portions of hardclock() and statclock() off into hardclock_process() and statclock_process() respectively. hardclock() and statclock() call the *_process() functions for the current process so that UP systems will run as before. For SMP systems, it is simply necessary to ensure that all other processors execute the *_process() functions when the main clock functions are triggered on one CPU by an interrupt. For the alpha 4100, clock interrupts are delievered in a staggered broadcast fashion, so we simply call hardclock/statclock on the boot CPU and call the *_process() functions on the secondaries. For x86, we call statclock and hardclock as usual and then call forward_hardclock/statclock in the MD code to send an IPI to cause the AP's to execute forwared_hardclock/statclock which then call the *_process() functions. - forward_signal() and forward_roundrobin() have been reworked to be MI and to involve less hackery. Now the cpu doing the forward sets any flags, etc. and sends a very simple IPI_AST to the other cpu(s). AST IPIs now just basically return so that they can execute ast() and don't bother with setting the astpending or needresched flags themselves. This also removes the loop in forward_signal() as sched_lock closes the race condition that the loop worked around. - need_resched(), resched_wanted() and clear_resched() have been changed to take a process to act on rather than assuming curproc so that they can be used to implement forward_roundrobin() as described above. - Various other SMP variables have been moved to a MI subr_smp.c and a new header sys/smp.h declares MI SMP variables and API's. The IPI API's from machine/ipl.h have moved to machine/smp.h which is included by sys/smp.h. - The globaldata_register() and globaldata_find() functions as well as the SLIST of globaldata structures has become MI and moved into subr_smp.c. Also, the globaldata list is only available if SMP support is compiled in. Reviewed by: jake, peter Looked over by: eivind
* o Move per-process jail pointer (p->pr_prison) to inside of the subjectrwatson2001-02-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | credential structure, ucred (cr->cr_prison). o Allow jail inheritence to be a function of credential inheritence. o Abstract prison structure reference counting behind pr_hold() and pr_free(), invoked by the similarly named credential reference management functions, removing this code from per-ABI fork/exit code. o Modify various jail() functions to use struct ucred arguments instead of struct proc arguments. o Introduce jailed() function to determine if a credential is jailed, rather than directly checking pointers all over the place. o Convert PRISON_CHECK() macro to prison_check() function. o Move jail() function prototypes to jail.h. o Emulate the P_JAILED flag in fill_kinfo_proc() and no longer set the flag in the process flags field itself. o Eliminate that "const" qualifier from suser/p_can/etc to reflect mutex use. Notes: o Some further cleanup of the linux/jail code is still required. o It's now possible to consider resolving some of the process vs credential based permission checking confusion in the socket code. o Mutex protection of struct prison is still not present, and is required to protect the reference count plus some fields in the structure. Reviewed by: freebsd-arch Obtained from: TrustedBSD Project
* Implement a unified run queue and adjust priority levels accordingly.jake2001-02-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - All processes go into the same array of queues, with different scheduling classes using different portions of the array. This allows user processes to have their priorities propogated up into interrupt thread range if need be. - I chose 64 run queues as an arbitrary number that is greater than 32. We used to have 4 separate arrays of 32 queues each, so this may not be optimal. The new run queue code was written with this in mind; changing the number of run queues only requires changing constants in runq.h and adjusting the priority levels. - The new run queue code takes the run queue as a parameter. This is intended to be used to create per-cpu run queues. Implement wrappers for compatibility with the old interface which pass in the global run queue structure. - Group the priority level, user priority, native priority (before propogation) and the scheduling class into a struct priority. - Change any hard coded priority levels that I found to use symbolic constants (TTIPRI and TTOPRI). - Remove the curpriority global variable and use that of curproc. This was used to detect when a process' priority had lowered and it should yield. We now effectively yield on every interrupt. - Activate propogate_priority(). It should now have the desired effect without needing to also propogate the scheduling class. - Temporarily comment out the call to vm_page_zero_idle() in the idle loop. It interfered with propogate_priority() because the idle process needed to do a non-blocking acquire of Giant and then other processes would try to propogate their priority onto it. The idle process should not do anything except idle. vm_page_zero_idle() will return in the form of an idle priority kernel thread which is woken up at apprioriate times by the vm system. - Update struct kinfo_proc to the new priority interface. Deliberately change its size by adjusting the spare fields. It remained the same size, but the layout has changed, so userland processes that use it would parse the data incorrectly. The size constraint should really be changed to an arbitrary version number. Also add a debug.sizeof sysctl node for struct kinfo_proc.
* Previous commit changing SYSCTL_HANDLER_ARGS violated KNF.phk2000-07-041-2/+2
| | | | Pointed out by: bde
* Style police catches up with rev 1.26 of src/sys/sys/sysctl.h:phk2000-07-031-2/+2
| | | | | | | | Sanitize SYSCTL_HANDLER_ARGS so that simplistic tools can grog our sources: -sysctl_vm_zone SYSCTL_HANDLER_ARGS +sysctl_vm_zone (SYSCTL_HANDLER_ARGS)
* Dammit.rwatson2000-06-071-0/+3
| | | | | | | | Trimmed an extra sysctl when I moved kern.suser_permitted from kern_mib.c to kern_prot.c. This commit should restore it, as well as fix the resulting build problems. Submitted by: asmodai
OpenPOWER on IntegriCloud