summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_mib.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
* o bde suggested moving the SYSCTL from kern_mib to the more appropriaterwatson2000-06-051-27/+0
| | | | | | | | kern_prot, which cleans up some namespace issues o Don't need a special handler to limit un-setting, as suser is used to protect suser_permitted, making it one-way by definition. Suggested by: bde
* o Introduce kern.suser_permitted, a sysctl that disables the suser_xxx()rwatson2000-06-051-0/+24
| | | | | | | | | | | | | | | returning anything but EPERM. o suser is enabled by default; once disabled, cannot be reenabled o To be used in alternative security models where uid0 does not connote additional privileges o Should be noted that uid0 still has some additional powers as it owns many important files and executables, so suffers from the same fundamental security flaws as securelevels. This is fixed with MAC integrity protection code (in progress) o Not safe for consumption unless you are *really* sure you don't want things like shutdown to work, et al :-) Obtained from: TrustedBSD Project
* Separate the struct bio related stuff out of <sys/buf.h> intophk2000-05-051-0/+1
| | | | | | | | | | | | | | | <sys/bio.h>. <sys/bio.h> is now a prerequisite for <sys/buf.h> but it shall not be made a nested include according to bdes teachings on the subject of nested includes. Diskdrivers and similar stuff below specfs::strategy() should no longer need to include <sys/buf.> unless they need caching of data. Still a few bogus uses of struct buf to track down. Repocopy by: peter
* Draw the outline of "struct bio".phk2000-04-021-0/+6
| | | | Struct bio is the future carrier of I/O requests for "struct buf".
* The SMP cleanup commit broke UP compiles. Make UP compiles work again.dillon2000-03-281-3/+0
|
* Yet-another-update: rename ``kern.prison'' to a new sysctl root entry,rwatson2000-02-121-9/+1
| | | | | | | | | | ``jail'', and move the set_hostname_allowed sysctl there, as well as fixing a bug in the sysctl that resulted in jails being over-limited (preventing them from reading as well as writing the hostname). Also, correct some formatting issues, courtesy bde :-). Reviewed by: phk Approved by: jkh
* Fix sysctl namespace for jail: move the kern.jailcansethostname torwatson2000-02-101-5/+5
| | | | | kern.prison.set_hostname_allowed, off of the kern.prison node. Future jail twiddles should be placed in this namespace.
* Introduce a new sysctl, kern.jailcansethostname, which determines whetherrwatson2000-02-101-2/+9
| | | | | | | | | | | | or not a process in a jail, with privilege, may set the jail's hostname. Defaults to 1, which permits this. May be set to 0 by a process with appropriate privilege outside of jail. Preventing hostname renaming from within a jail is currently required to make jails manageable, as they a currently identifiable only by hostname using /proc, which may be modified without this sysctl being set to 0. This will be documented in upcoming man commits. Authorized by: jkh, the ever-patient
OpenPOWER on IntegriCloud