summaryrefslogtreecommitdiff
path: root/sys/kern/kern_sysctl.c
AgeCommit message (Collapse)Author
2010-03-24Add a rwlock around the filehead and allproc lists, mainly to protectTed Unangst
list walkers in sysctl that can block. As a reward, no more vslock. With some feedback from art, guenther, phessler. ok guenther.
2010-01-10Reimplement kvm_getproc2()'s support for reading crash dumps andPhilip Guenthe
/dev/mem to be direct instead of going through kvm_getprocs(), as that function is going to get more an more broken as we move stuff from struct proc to struct process for rthreads. To minimize the code copying, put the common logic of filling in a kinfo_proc2 structure into a macro FILL_KPROC2() in <sys/sysctl.h> for use from both the kernel and user-space. This also hides the KERN_PROC #define behind "#if defined(_KERNEL)||defined(_LIBKVM)", as it's deprecated. Positive feedback from millert and blambert; so committing to unblock further rthreads work.
2009-08-09Rototill system V message queues.Bret Lambert
No longer allocate a static amount of memory for messages in MD boot path; message queues, message metadata, and message data now all use dynamic memory, which means that runtime sysctls should now be trivial to implement. Since I'm going to be around all week to fix any breakage, this should probably just go in now.
2009-08-02Dynamic buffer cache support - a re-commit of what was backed outBob Beck
after c2k9 allows buffer cache to be extended and grow/shrink dynamically tested by many, ok oga@, "why not just commit it" deraadt@
2009-07-21Handle the case where so_pcb is NULL.Todd C. Miller
2009-07-19Hook up "text" (executable) output and implement for fuser too.Todd C. Miller
Man page bits adapted from FreeBSD. OK miod@
2009-06-15No you cannot remove a sysctl mib once you add it. It becomes ABI. ThatTheo de Raadt
is how sysctl finds them, so it can *never* be renumbered again, and must stay
2009-06-15Back out all the buffer cache changes I committed during c2k9. This reverts ↵Bob Beck
three commits: 1) The sysctl allowing bufcachepercent to be changed at boot time. 2) The change moving the buffer cache hash chains to a red-black tree 3) The dynamic buffer cache (Which depended on the earlier too). ok on the backout from marco and todd
2009-06-08some vnodes have a NULL mountpoint, so strlcpy of the f_mntonname if not advisedTheo de Raadt
2009-06-07Add KERN_FILE2 sysctl analogous to KERN_PROC2 but for file structures,Todd C. Miller
along with vnode type-specific info to make it more useful for fstat(1). OK deraadt@
2009-06-05Dynamic buffer cache sizing.Bob Beck
This commit won't change the default behaviour of the system unless the buffer cache size is increased with sysctl kern.bufcachepercent. By default our buffer cache is 10% of memory, which with this commit is now treated as a low water mark. If the buffer cache size is increased, the new size is treated as a high water mark and the buffer cache is permitted to grow to that percentage of memory. If the page daemon is invoked, the page daemon will ask the buffer cache to relenquish pages. if the buffer cache has more than the low water mark it will relenquish pages allowing them to be consumed by uvm. after a short period the buffer cache will attempt to re-grow back to the high water mark. This permits the use of a large buffer cache without penalizing the available memory for other purposes. Above the low water mark the buffer cache remains entirely subservient to the page daemon, so if uvm requires pages, the buffer cache will abandon them. ok art@ thib@ oga@
2009-06-03add kern.bufcachepercent sysctl to allow adjusting the buffer cacheBob Beck
size on a running system. ok art@, oga@
2009-04-19Count number of cpus found (potentially not attached) and store thatTheo de Raadt
in sysctl hw.ncpufound; ok miod kettenis
2009-01-21Pass the new pointer to sysctl_clockrate(), so that trying to change theMiod Vallat
value of kern.clockrate with sysctl(3) correctly sets errno on failure. PR #6040, ok tedu@
2008-10-31Do not assume that a pointer to another process will live over a set ofTheo de Raadt
sleeping calls. Since we are simply operating on another process' vmspace, grab a (refcounted) copy of that pointer and use that instead. originally spotted by kurt, discussed with art
2008-10-31accidental commit ... backoutTheo de Raadt
2008-10-31accidental commit ... backoutTheo de Raadt
2008-10-31kern_sysctl.cTheo de Raadt
2008-10-09pass NULL rather than 0 for interrupt time usage to calcru()Kevin Lo
ok art@
2008-10-07Do not display file offsets and a few other pieces of information, exceptTheo de Raadt
to the user or the superuser. Display * for those fields instead. From PR 5113, but modified to use copyout correctly. comments from tedu, ok from others
2008-06-09rename arc4random_bytes => arc4random_buf to match libc's nicer name;Damien Miller
ok deraadt@
2008-02-09Introduce HW_PHYSMEM64 and HW_USERMEM64 sysctls, which don't overflow onMark Kettenis
machines with more than 4GB of memory. Make sysctl(8) print values obtained using these sysctls for hw.physmem and hw.usermem. ok krw@, miod@
2007-12-23protect the disk statistics with a mutex.David Gwynne
ok tedu@ kettenis@
2007-10-10Make context switching much more MI:Artur Grabowski
- Move the functionality of choosing a process from cpu_switch into a much simpler function: cpu_switchto. Instead of having the locore code walk the run queues, let the MI code choose the process we want to run and only implement the context switching itself in MD code. - Let MD context switching run without worrying about spls or locks. - Instead of having the idle loop implemented with special contexts in MD code, implement one idle proc for each cpu. make the idle loop MI with MD hooks. - Change the proc lists from the old style vax queues to TAILQs. - Change the sleep queue from vax queues to TAILQs. This makes wakeup() go from O(n^2) to O(n) there will be some MD fallout, but it will be fixed shortly. There's also a few cleanups to be done after this. deraadt@, kettenis@ ok
2007-09-07Use M_ZERO in a few more places to shave bytes from the kernel.Artur Grabowski
eyeballed and ok dlg@
2007-09-01replace the machine dependant bytes-to-clicks macro by the MI ptoa()Martin Reindl
version for i386 more architectures and ctob() replacement is being worked on prodded by and ok miod
2007-08-09be more consistent in memcpy usage; no md5 change in .o; ok deraadt@Constantine A. Murenin
2007-06-01decouple the allocated number of vnodes from the "desiredvnodes" variableBob Beck
which is used to size a zillion other things that increasing excessively has been shown to cause problems - so that we may incrementally look at increasing those other things without making the kernel unusable. This diff effectivly increases the number of vnodes back to the number of buffers, as in the earlier dynamic buffer cache commits, without increasing anything else (namecache, softdeps, etc. etc.) ok pedro@ tedu@ art@ thib@
2007-05-29Add a name argument to the RWLOCK_INITIALIZER macro.Thordur I. Bjornsson
Pick reasonble names for the locks involved.. ok tedu@, art@
2007-05-16The world of __HAVEs and __HAVE_NOTs is reducing. All architecturesArtur Grabowski
have cpu_info now, so kill the option. eyeballed by jsg@ and grange@
2007-04-18When vslocking memory for the sysctl make sure that we aren't tryingArtur Grabowski
to wire more memory than we are allowed to. miod@ ok
2007-04-12move p_limit and p_cred into struct processTed Unangst
leave macros behind for now to keep the commit small ok art beck miod pedro
2007-03-22split userland & kernel struct sensor/sensordev so that the additionTheo de Raadt
of new fields in the future is less disruptive. This is done similar to how struct proc is handled for ps(1). ok jmc (man page changes) tested fkr simon, and more suggestions from millert
2007-02-20for sensors do not leak kernel pointers when copying out to userland;Theo de Raadt
spotted by art, ok dlg art
2007-01-12Switch some lockmgr locks to rwlocks.Artur Grabowski
In this commit: - gdt lock on amd64 - sysctl lock - malloc sysctl lock - disk sysctl lock - swap syscall lock miod@, pedro@ ok (and "looks good" others@)
2006-12-23kernel code implimemting the new two-level sensor api; written byTheo de Raadt
Constantine A. Murenin
2006-12-12Complete gwk's previous patch to stop setperf methods from returningDimitry Andric
errors to userland: make all cpu_setperf functions return void. Tested by many, ok gwk@
2006-12-08A more permanent solution to setperf methods returning error values andGordon Willem Klok
the higher level sysctl code passing them to userland. Distinct diff from the one I passed around internally with less crazy semantics. Also nuke some trailing spaces in a few places. "just go ahead" deraadt@
2006-11-29Kernel stack can be swapped. This means that stuff that's on the stackMiod Vallat
should never be referenced outside the context of the process to which this stack belongs unless we do the PHOLD/PRELE dance. Loads of code doesn't follow the rules here. Instead of trying to track down all offenders and fix this hairy situation, it makes much more sense to not swap kernel stacks. From art@, tested by many some time ago.
2006-05-28back out my last commit. art pointed out that sysctl cannot sleep whenDavid Gwynne
copying out to userland, so my fix was useless bloat that didnt really do anything. the problem instead appears to be a use after free in a driver rather than bad interactions with sysctl.
2006-05-20It is possible for a sensor to be detached and freed while it is beingDavid Gwynne
copied out to userland. If this happens we get a use after free and things blow up. Prevent this by making a local copy of the sensor that cannot be freed elsewhere in the kernel and copying that out instead. found by mbalmer@ ok deraadt@ krw@
2006-05-08Add smbios support for i386 and amd64, fix ipmi to use this new functionallity,Gordon Willem Klok
hook up some sysctls to add system vendor/product/version and UUID reporting. "get it in" deraadt@
2006-03-15add sysctl_int_lower(). This can read, but can only write to a kernelTheo de Raadt
variable if the result is a lowering of the value; tested matthieu
2006-01-28get rid of the sensors globals. theyre were only used by sysctl forDavid Gwynne
locating and finding the correct sensor to spit out. instead provide a a sensor_get function that wraps up the access to the vars. theyre now safe inside kern_sensors.c. theres also a touch of whitespace tweaking ok grange@
2006-01-19Replace SENSOR_ADD() macro with a pair of functionsAlexander Yurchenko
sensor_add()/sensor_del() so that sensors can be attached and detached dynamicaly. ok kettenis@ deraadt@ dlg@
2005-11-28ansi/deregister.Jonathan Gray
'go for it' deraadt@
2005-11-21rename the sensor globals to names that are not obvious to avoidDavid Gwynne
collisions with local variable names someone might make. this has bitten me twice now and caused me to lose about 4 hours scratching my head when nsensors just magically corrupts and gets bigger. at least my ram isnt screwed. ok marco@
2005-11-19Remove unnecessary lockmgr() archaism that was costing too much in termsPedro Martelletto
of panics and bugfixes. Access curproc directly, do not expect a process pointer as an argument. Should fix many "process context required" bugs. Incentive and okay millert@, okay marc@. Various testing, thanks.
2005-11-10split the sensors stuff out into a source file of its own.David Gwynne
tested on GENERIC and RAMDISK_CD to see if the small_kernel stuff stays happy
2005-11-04Add an extra flags argument to uvm_io(), to specify whether we want to fixMiod Vallat
the protection of the memory mapping we're doing I/O on, or if we want to leave them as they are. This should only be necessary for breakpoint insertion in code, so we'll only use it for ptrace requests. Initially from art@ after discussion with kettenis@ millert@ and I, tested by many.