summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_mib.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Trim unused options (or #ifdef for undoc options).peter1999-10-111-1/+0
| | | | Submitted by: phk
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Add sysctl variables for the Linuxulator. These reside under `compat.linux' asmarcel1999-08-271-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | discussed on current. The following variables are defined (for now): osname (defaults to "Linux") Allow users to change the name of the OS as returned by uname(2), specially added for all those Linux Netscape users and statistics maniacs :-) We now have what we all wanted! osrelease (defaults to "2.2.5") Allow users to change the version of the OS as returned by uname(2). Since -current supports glibc2.1 now, change the default to 2.2.5 (was 2.0.36). oss_version (defaults to 198144 [0x030600]) This one will be used by the OSS_GETVERSION ioctl (PR 12917) which I can commit now that we have the MIB. The default version number is the lowest version possible with the current 'encoding'. A note about imprisoned processes (see jail(2)): These variables are copy-on-write (as suggested by phk). This means that imprisoned processes will use the system wide value unless it is written/set by the process. From that moment on, a copy local to the prison will be used. A note about the implementation: I choose to add a single pointer to struct prison, because I didn't like the idea of changing struct prison every time I come up with a new variable. As a side effect, the extra storage is only needed when a variable is set from within the prison. This also minimizes kernel bloat when the Linuxulator is not used; both compiled in or as a module. Reviewed by: bde (first version only) and phk
* Decommision miscfs/specfs/specdev.h. Most of it goes into <sys/conf.h>,phk1999-08-081-2/+2
| | | | | | a few lines into <sys/vnode.h>. Add a few fields to struct specinfo, paving the way for the fun part.
* add debug.sizeof.specinfophk1999-07-201-1/+5
|
* Add sysctl tree debug.sizeof to tell us how big things are. First twophk1999-07-191-1/+10
| | | | entries are struct proc and struct vnode.
* Add sysctl descriptions to many SYSCTL_XXXsbillf1999-05-031-45/+81
| | | | | | | PR: kern/11197 Submitted by: Adrian Chadd <adrian@FreeBSD.org> Reviewed by: billf(spelling/style/minor nits) Looked at by: bde(style)
* This Implements the mumbled about "Jail" feature.phk1999-04-281-3/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a seriously beefed up chroot kind of thing. The process is jailed along the same lines as a chroot does it, but with additional tough restrictions imposed on what the superuser can do. For all I know, it is safe to hand over the root bit inside a prison to the customer living in that prison, this is what it was developed for in fact: "real virtual servers". Each prison has an ip number associated with it, which all IP communications will be coerced to use and each prison has its own hostname. Needless to say, you need more RAM this way, but the advantage is that each customer can run their own particular version of apache and not stomp on the toes of their neighbors. It generally does what one would expect, but setting up a jail still takes a little knowledge. A few notes: I have no scripts for setting up a jail, don't ask me for them. The IP number should be an alias on one of the interfaces. mount a /proc in each jail, it will make ps more useable. /proc/<pid>/status tells the hostname of the prison for jailed processes. Quotas are only sensible if you have a mountpoint per prison. There are no privisions for stopping resource-hogging. Some "#ifdef INET" and similar may be missing (send patches!) If somebody wants to take it from here and develop it into more of a "virtual machine" they should be most welcome! Tools, comments, patches & documentation most welcome. Have fun... Sponsored by: http://www.rndassociates.com/ Run for almost a year by: http://www.servetheweb.com/
* Ok, people didn't like kern.conf_dir. Poof, backed out.dillon1999-01-261-6/+1
|
* Add kern.conf_dir sysctl. This is a R+W string used to specify thedillon1999-01-251-1/+6
| | | | | | | | directory containing rc.conf.local and rc.local, and possibly other things in the future. This sysctl is used by the diskless startup code and new rc.conf. If it cannot be found or is empty, the system should revert to using /etc.
* - hw.machine_arch returns cpu architecture type.kato1998-08-311-2/+1
| | | | | | | | | - moved definition of MACHINE_ARCH from cpu.h to parm.h as alpha. - Added definitions of _MACHINE and _MACHINE_ARCH. - Added hw.ispc98. The hw.ispc98 is 1 in PC98 kernel and is 0 in IBM-PC kernel. Discussed with: John Birrell <jb@FreeBSD.ORG>
* Finish _POSIX_PRIORITY_SCHEDULING. Needs P1003_1B anddufault1998-03-281-8/+4
| | | | | | | | | | | | | | | | _KPOSIX_PRIORITY_SCHEDULING options to work. Changes: Change all "posix4" to "p1003_1b". Misnamed files are left as "posix4" until I'm told if I can simply delete them and add new ones; Add _POSIX_PRIORITY_SCHEDULING system calls for FreeBSD and Linux; Add man pages for _POSIX_PRIORITY_SCHEDULING system calls; Add options to LINT; Minor fixes to P1003_1B code during testing.
* Reviewed by: msmith, bde long agodufault1998-03-041-1/+8
| | | | | | | Fix for RTPRIO scheduler to eliminate invalid context switches. POSIX.4 headers and sysctl variables. Nothing should change unless POSIX4 is defined or _POSIX_VERSION is set to 199309.
* Make kern.ncpu reports the number of detected processors when runninggpalmer1997-12-251-1/+8
| | | | with a SMP kernel.
* kern.maxproc is not writable since there are tables that are staticallydg1997-10-191-2/+2
| | | | | sized at startup. PR: 4675
* Move MACHINE_ARCH definition from <machine/param.h> to <machine/cpu.h>.kato1997-08-301-1/+3
| | | | Submitted by: Bruce Evans <bde@zeta.org.au>
* Added a sysctl arg, hw.machine_arch. The hw.machine_arch is "ibm-pc"kato1997-08-291-1/+5
| | | | | on IBM-PC box and is "pc-98" on NEC PC-98 box. Userland program can distinguish architecture on which the program runs.
* Don't ever allow lowering the securelevel at all. Allowing it doesjoerg1997-06-251-2/+2
| | | | | | | | | nothing good except of opening a can of (potential or real) security holes. People maintaining a machine with higher security requirements need to be on the console anyway, so there's no point in not forcing them to reboot before starting maintenance. Agreed by: hackers, guido
* Attach vfs_sysctl() one level lower so that only the levels belowbde1997-03-041-3/+2
| | | | | VFS_GENERIC aren't done in the FreeBSD way. The previous commit broke the nfs sysctls.
* Merged Lite2's vfs_sysctl(). It doesn't fit very well into FreeBSD'sbde1997-03-031-2/+3
| | | | | | | | (phk's) sysctl framework, and I needed special code to disambiguate the VFS_GENERIC node from the VFS_VFSCONF leaf, so I only converted the leaves to the FreeBSD framework. The error handling isn't quite right. CSRGS's sysctls seem to return ENOTDIR too much and FreeBSD's sysctls don't agree with the man page.
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notpeter1997-02-221-1/+1
| | | | ready for it yet.
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Oops, read-only is spelled RD here.bde1996-09-281-21/+21
|
* Fixed bitrot in the read-only attribute:bde1996-09-281-26/+23
| | | | | | | | | - kern.maxproc and kern.maxprocperuid were read-only (and thus essentially useless. Apparently no one uses them). - all the user sysctls were read-write (and thus it was possible for them to be inconsistent with the authoritative fixed values in the library). Removed unused #include.
* Rename KERN_DOMAINNAME to KERN_NISDOMAINNAME so that it can't be confusedwollman1996-07-251-2/+2
| | | | | | with a real Domain Name. Suggested by: Keith Bostic
* Move the "mib" variables out to their own file.phk1996-04-071-0/+170
OpenPOWER on IntegriCloud