summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_sysctl.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* A process on the zombie list can have a NULL p_pgrp if it sleeps whenguenther2010-07-101-1/+6
| | | | | | | grabbing allproclk in proc_zap(); skip such processes in sysctl(KERN_PROC*) and handle the NULL pointer in ddb's ps. ok tedu@
* Since fill_eproc() is no longer called from coredump(), it can be droppedguenther2010-07-021-5/+1
| | | | | from small kernels "yes" deraadt@
* Add getsockopt SOL_SOCKET SO_PEERCRED support. This behaves similar toderaadt2010-06-301-1/+2
| | | | | | | getpeereid(2), but also supplies the remote pid. This is supplied in a 'struct sockpeercred' (unlike Linux -- they showed how little they know about real unix by calling theirs 'struct ucred'). ok guenther ajacoutot
* Fail instead of lying if a process asks sysctl()'s KERN_PROC2 orguenther2010-06-291-3/+4
| | | | | | | KERN_FILE2 (or their libkvm wrappers) for more information than the running implementation knows how to provide. ok millert@ deraadt@
* Eliminate RTHREADS kernel option in favor of a sysctl. The actual statustedu2010-06-291-1/+6
| | | | | (not done) hasn't changed, but now it's less work to test things. ok art deraadt
* Skip exiting procesess in sysctl_file2(). As processes in exit1()thib2010-06-191-7/+7
| | | | | | | | | do a pdfree() way before they remove themself from the allproc list. This prevents a null deref found by todd@. Joint work with mikeb OK millert@, tedu@
* Use intermediate vaddr_t cast when casting a pointer to off_t. Preventskettenis2010-05-021-2/+2
| | | | | | | gcc4 from complaining about casting a pointer to an integer type of different size. ok guenther@, jsg@
* Get rid of MAXSENSORDEVICES. Gaps in sensordev lists are now handledderaadt2010-04-201-7/+7
| | | | | | | by returning ENXIO instead of ENOENT, to essentially indicate hotplug sensor that has gone away. Accessing beyond the end of the sensordev list still returns ENOENT, so that you can see there are no further devices. ok kettenis oga
* Add a rwlock around the filehead and allproc lists, mainly to protecttedu2010-03-241-5/+26
| | | | | list walkers in sysctl that can block. As a reward, no more vslock. With some feedback from art, guenther, phessler. ok guenther.
* Reimplement kvm_getproc2()'s support for reading crash dumps andguenther2010-01-101-129/+9
| | | | | | | | | | | | | | /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.
* Rototill system V message queues.blambert2009-08-091-19/+2
| | | | | | | | | | 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.
* Dynamic buffer cache support - a re-commit of what was backed outbeck2009-08-021-4/+13
| | | | | | | | after c2k9 allows buffer cache to be extended and grow/shrink dynamically tested by many, ok oga@, "why not just commit it" deraadt@
* Handle the case where so_pcb is NULL.millert2009-07-211-1/+3
|
* Hook up "text" (executable) output and implement for fuser too.millert2009-07-191-1/+3
| | | | Man page bits adapted from FreeBSD. OK miod@
* No you cannot remove a sysctl mib once you add it. It becomes ABI. Thatderaadt2009-06-151-1/+10
| | | | | is how sysctl finds them, so it can *never* be renumbered again, and must stay
* Back out all the buffer cache changes I committed during c2k9. This reverts threebeck2009-06-151-19/+1
| | | | | | | | | | 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
* some vnodes have a NULL mountpoint, so strlcpy of the f_mntonname if not advisedderaadt2009-06-081-3/+5
|
* Add KERN_FILE2 sysctl analogous to KERN_PROC2 but for file structures,millert2009-06-071-3/+296
| | | | | along with vnode type-specific info to make it more useful for fstat(1). OK deraadt@
* Dynamic buffer cache sizing.beck2009-06-051-2/+3
| | | | | | | | | | | | | | | | | | | | | | | 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@
* add kern.bufcachepercent sysctl to allow adjusting the buffer cachebeck2009-06-031-1/+18
| | | | | size on a running system. ok art@, oga@
* Count number of cpus found (potentially not attached) and store thatderaadt2009-04-191-1/+3
| | | | in sysctl hw.ncpufound; ok miod kettenis
* Pass the new pointer to sysctl_clockrate(), so that trying to change themiod2009-01-211-2/+2
| | | | | value of kern.clockrate with sysctl(3) correctly sets errno on failure. PR #6040, ok tedu@
* Do not assume that a pointer to another process will live over a set ofderaadt2008-10-311-11/+12
| | | | | | 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
* accidental commit ... backoutderaadt2008-10-311-12/+11
|
* kern_sysctl.cderaadt2008-10-311-11/+12
|
* pass NULL rather than 0 for interrupt time usage to calcru()kevlo2008-10-091-2/+2
| | | | ok art@
* Do not display file offsets and a few other pieces of information, exceptderaadt2008-10-071-5/+16
| | | | | | 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
* rename arc4random_bytes => arc4random_buf to match libc's nicer name;djm2008-06-091-2/+2
| | | | ok deraadt@
* Introduce HW_PHYSMEM64 and HW_USERMEM64 sysctls, which don't overflow onkettenis2008-02-091-1/+7
| | | | | | | 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@
* protect the disk statistics with a mutex.dlg2007-12-231-1/+5
| | | | ok tedu@ kettenis@
* Make context switching much more MI:art2007-10-101-4/+2
| | | | | | | | | | | | | | | | | | | | - 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
* Use M_ZERO in a few more places to shave bytes from the kernel.art2007-09-071-7/+4
| | | | eyeballed and ok dlg@
* replace the machine dependant bytes-to-clicks macro by the MI ptoa()martin2007-09-011-3/+3
| | | | | | | | version for i386 more architectures and ctob() replacement is being worked on prodded by and ok miod
* be more consistent in memcpy usage; no md5 change in .o; ok deraadt@cnst2007-08-091-2/+2
|
* decouple the allocated number of vnodes from the "desiredvnodes" variablebeck2007-06-011-2/+2
| | | | | | | | | | | | 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@
* Add a name argument to the RWLOCK_INITIALIZER macro.thib2007-05-291-3/+3
| | | | | | Pick reasonble names for the locks involved.. ok tedu@, art@
* The world of __HAVEs and __HAVE_NOTs is reducing. All architecturesart2007-05-161-12/+3
| | | | | | have cpu_info now, so kill the option. eyeballed by jsg@ and grange@
* When vslocking memory for the sysctl make sure that we aren't tryingart2007-04-181-1/+5
| | | | | | to wire more memory than we are allowed to. miod@ ok
* move p_limit and p_cred into struct processtedu2007-04-121-2/+3
| | | | | leave macros behind for now to keep the commit small ok art beck miod pedro
* split userland & kernel struct sensor/sensordev so that the additionderaadt2007-03-221-20/+30
| | | | | | 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
* for sensors do not leak kernel pointers when copying out to userland;deraadt2007-02-201-8/+24
| | | | spotted by art, ok dlg art
* Switch some lockmgr locks to rwlocks.art2007-01-121-22/+8
| | | | | | | | | | | 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@)
* kernel code implimemting the new two-level sensor api; written byderaadt2006-12-231-5/+19
| | | | Constantine A. Murenin
* Complete gwk's previous patch to stop setperf methods from returningdim2006-12-121-2/+2
| | | | | | errors to userland: make all cpu_setperf functions return void. Tested by many, ok gwk@
* A more permanent solution to setperf methods returning error values andgwk2006-12-081-9/+7
| | | | | | | 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@
* Kernel stack can be swapped. This means that stuff that's on the stackmiod2006-11-291-7/+3
| | | | | | | | | | 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.
* back out my last commit. art pointed out that sysctl cannot sleep whendlg2006-05-281-10/+7
| | | | | | 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.
* It is possible for a sensor to be detached and freed while it is beingdlg2006-05-201-7/+10
| | | | | | | | | 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@
* Add smbios support for i386 and amd64, fix ipmi to use this new functionallity,gwk2006-05-081-1/+30
| | | | | | hook up some sysctls to add system vendor/product/version and UUID reporting. "get it in" deraadt@
* add sysctl_int_lower(). This can read, but can only write to a kernelderaadt2006-03-151-1/+21
| | | | variable if the result is a lowering of the value; tested matthieu