summaryrefslogtreecommitdiff
path: root/sys/kern/kern_sysctl.c
AgeCommit message (Collapse)Author
2011-09-18Do not use the `hh' modifier in printf format strings, as the kernel printfMiod Vallat
implementation does not support it and handles it as `h'. ok jsing@
2011-09-18Make sysctl__string() handle the truncated output case via twoPhilip Guenthe
copyout()s instead of altering the in-use variable, and to also return the full length via oldlenp in that case as documented. ok jsing@ (problem pointed out by matthew@)
2011-07-05Recommit the reverted sigacts change now that the NFS use-after-freePhilip Guenthe
problem has been tracked down. This fixes the sharing of the signal handling state: shared bits go in sigacts, per-rthread bits goes in struct proc. ok deraadt@
2011-06-27Make KERN_FILE and KERN_FILE2 behavior consistent: when the caller doesn'tPhilip Guenthe
have the necessary rights, return f_offset=-1 and f_seek=0. ok tedu@, matthew@
2011-06-24machdep.kbdreset enables a shutdown by Ctrl-Alt-Del on amd64 andChristian Weisgerber
i386. Stop abusing it on other archs for controling a shutdown by pressing the soft power button: * Add a MI sysctl hw.allowpowerdown; if set to 1 (the default) it allows a power button shutdown. * Make acpi(4)/acpibtn(4) honor hw.allowpowerdown. * Switch the various power button intercepts on landisk, sgi, sparc64 and zaurus over to hw.allowpowerdown. * Garbage collect the machdep.kbdreset sysctl on all archs other than amd64 and i386. ok miod@
2011-06-09Don't copy the first octet of the source IPv6 address where the destinationStuart Henderson
address should be, fixes broken fstat output for v6 socket connections. Problem noticed by dhill@, ok todd@, "i have no idea what that diff is touching, but it sure looks ok" halex@
2011-04-18Revert the sigacts diff: NFS can apparently retain pointers to processesPhilip Guenthe
until they're zombies and then send them signals (for intr mounts). Until that is untangled, the sigacts change is unsafe. sthen@ was the victim for this one
2011-04-15Correct the sharing of the signal handling state: stuff that shouldPhilip Guenthe
be shared (p_sigignore, p_sigcatch, P_NOCLDSTOP, P_NOCLDWAIT) moves to struct sigacts, wihle stuff that should be per rthread (ps_oldmask, SAS_OLDMASK, ps_sigstk) moves to struct proc. Treat the coredumping state bits (ps_sig, ps_code, ps_type, ps_sigval) as per-rthread until our locking around coredumping is better. Oh, and remove the old SunOS-compat ps_usertramp member. "I like the sound of this" tedu@
2011-04-04sysctl kern.pool_debug=0 will disable POOL_DEBUG on the fly (still defaultsTheo de Raadt
to on, if POOL_DEBUG is compiled in, so that boot-time pool corruption can be found. When the sysctl is turned off, performance is almost as as good as compiling with POOL_DEBUG compiled out. Not all pool page headers can be purged of the magic checks. performance tests by henning ok ariane kettenis mikeb
2011-04-02Constrain the buffer cache to use only the dma reachable region of memory.Bob Beck
With this change bufcachepercent will be the percentage of dma reachable memory that the buffer cache will attempt to use. ok deraadt@ thib@ oga@
2011-03-12Replace the old, broken KERN_PROC ABI and its matching functionsPhilip Guenthe
in libkvm with the stable-ABI versions that are currently named KERN_PROC2, kvm_get{proc,argv,envv}2(). The latter names and symbols will continue to be supported for a few releases. Committing now that they ports people have had a couple releases to update pkgs that usd the old functions
2011-02-16allow users to enable access to the /dev/crypto, but keep it turned offMike Belopuhov
by default, adjust comments in sysctl.conf; ok markus, tedu, djm, miod
2010-12-14disable access to the crypto(4) device from userland; ok deraadtMike Belopuhov
2010-11-19Make KERN_CPTIME return an avarage number of ticks across all CPUsMike Belopuhov
tedu agreed with an idea, tested by Luis Useche and me; ok deraadt
2010-11-02export the network livelock counter. part of a diff i committed theDavid Gwynne
userland side of. pointed out by claudio@ after i embarassed myself saying "yes, its there!"
2010-09-23Include the disklabel UID in hw.disknames.Joel Sing
ok deraadt@ krw@
2010-08-19Introduce an MI kern.consdev sysctl that will replace the MDMark Kettenis
machdep.console_device that's only implemented on a few architectures. ok deraadt@, miod@
2010-07-26Correct the links between threads, processes, pgrps, and sessions,Philip Guenthe
so that the process-level stuff is to/from struct process and not struct proc. This fixes a bunch of problem cases in rthreads. Based on earlier work by blambert and myself, but mostly written at c2k10. Tested by many: deraadt, sthen, krw, ray, and in snapshots
2010-07-19Rollback the allproclk and fileheadlk addition. When grabbing anPhilip Guenthe
rwlock, the thread will release biglock if it sleeps, means that atomicity from before the rw_enter() to after it is not guaranteed. The change didn't address those, so pulling it until it does. "go for it" tedu@
2010-07-10A process on the zombie list can have a NULL p_pgrp if it sleeps whenPhilip Guenthe
grabbing allproclk in proc_zap(); skip such processes in sysctl(KERN_PROC*) and handle the NULL pointer in ddb's ps. ok tedu@
2010-07-02Since fill_eproc() is no longer called from coredump(), it can be droppedPhilip Guenthe
from small kernels "yes" deraadt@
2010-06-30Add getsockopt SOL_SOCKET SO_PEERCRED support. This behaves similar toTheo de Raadt
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
2010-06-29Fail instead of lying if a process asks sysctl()'s KERN_PROC2 orPhilip Guenthe
KERN_FILE2 (or their libkvm wrappers) for more information than the running implementation knows how to provide. ok millert@ deraadt@
2010-06-29Eliminate RTHREADS kernel option in favor of a sysctl. The actual statusTed Unangst
(not done) hasn't changed, but now it's less work to test things. ok art deraadt
2010-06-19Skip exiting procesess in sysctl_file2(). As processes in exit1()Thordur I. Bjornsson
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@
2010-05-02Use intermediate vaddr_t cast when casting a pointer to off_t. PreventsMark Kettenis
gcc4 from complaining about casting a pointer to an integer type of different size. ok guenther@, jsg@
2010-04-20Get rid of MAXSENSORDEVICES. Gaps in sensordev lists are now handledTheo de Raadt
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
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@