summaryrefslogtreecommitdiff
path: root/usr.sbin/procmap
AgeCommit message (Collapse)Author
2017-06-19port the RBT code to userland by making it part of libc.David Gwynne
src/lib/libc/gen/tree.c is a copy of src/sys/kern/subr_tree.c, but with annotations for symbol visibility. changes to one should be reflected in the other. the malloc debug code that uses RB code is ported to RBT. because libc provides the RBT code, procmap doesn't have to reach into the kernel and build subr_tree.c itself now. mild enthusiasm from many ok guenther@
2016-09-25Make a move towards ending 4 decades of kernel snooping.Theo de Raadt
Add sysctl kern.allowkmem (default 0) which controls the ability to open /dev/mem or /dev/kmem at securelevel > 0. Over 15 years we converted 99% of utilities in the tree to operate on sysctl-nodes (either by themselves or via code hiding in the guts of -lkvm). pstat -d and -v & procmap are affected and continued use of them will require kern.allowkmem=1 in /etc/sysctl.conf. acpidump (and it's buddy sendbug) are affected, but we'll work out a solution soon. There will be some impact in ports. ok kettenis guenther
2016-09-16procmap fumbles with uvm_map_addr structures, which are now in RBTsDavid Gwynne
it also does proper traversal of the tree (ie, it does FOREACH) which in turn uses MIN and NEXT operations to iterate over the whole tree. theyre complicated and need code. so for now this pulls in subr_tree.c from the kernel and builds it as part of procmap. that allows for traversal of the RBT using the same code that the kernel uses. it is a bit ugly though because procmap updates the pointers between items in the tree so they point at local copies instead of kernel addresses. its made worse because RBT code has pointers between rb_entry structs, not between the nodes. im putting this in now to unbreak the tree. it can be polished after coffee/naps.
2016-05-26Re-introduce vnode-to-filename mappingStefan Kempf
The name cache walking code got adapted to the new name cache layout. Along with the previous commit, procmap is now able to map a vnode to a filename as long as it is in the name cache. "nice stuff" deraadt@
2016-05-25Must extract uvm_vnode from uvm_object first before reading the vnodeStefan Kempf
Otherwise procmap interprets the uvm_vnode contents as a vnode, yielding bogus values. This should cure the "procmap: invalid address (ffffffffffffffff) == -1 vs. 656 @ ffffffffffffffff" error messages that appear sporadically. ok deraadt@
2016-04-16Remove am_maxslot from amap.Stefan Kempf
am_maxslot represents the total number of slots an amap can be extended to. Since we do not extend amaps, this field as well as rounding the number of slots to the next malloc bucket is not useful. This also removes the corresponding output from procmap(1). ok kettenis@
2015-03-13remove the first comma from constructs like ", and," and ", or,": you can useJason McIntyre
"and" and "or" to join sentence clauses, and you can use commas, but both hinders reading;
2015-01-19Also print the fspace member of map entries when PRINT_VM_MAP_ENTRY isMark Kettenis
requested. ok deraadt@
2015-01-16Replace <sys/param.h> with <limits.h> and other less dirty headers whereTheo de Raadt
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
2014-11-16Replace a plethora of historical protection options with justTheo de Raadt
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
2014-09-08Additional cleanup for procfs removalDoug Hogan
ok guenther@
2014-09-08Delete procfs; it's always had races and is now unused: no one noticed forPhilip Guenther
months that I broke it before the 5.5 release. confirmed as not being required by ports by sthen@, ajacoutot@, dcoppa@
2014-07-08decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.hTheo de Raadt
don't need to be married. ok guenther miod beck jsing kettenis
2014-07-08There really isn't a strict "heap" anymore, so just call everything likeTheo de Raadt
that an anon. Useful change since BRKSIZ will soon leave the namespace. ok kettenis
2014-05-20Use errc/warnc to simplify code.Philip Guenther
Also, in 'ftp', always put the error message last, after the hostname/ipaddr. ok jsing@ krw@ millert@
2014-02-13remove tendrils of namei dumping codeTed Unangst
2014-02-13use strtonumTed Unangst
2014-01-21obvious .Pa fixes; found with mandocdb(8)Ingo Schwarze
2013-08-12get ready for big ino_t; ok gunther@Otto Moerbeek
2013-07-16use .Mt for email addresses; from Jan Stary <hans at stare dot cz>; ok jmc@Ingo Schwarze
2013-06-25Since the "better kmem pointer hiding" commit, procmap does not workDavid Coppa
anymore for regular users. So remove the setgid kmem for the time being (until tedu@ fixes it). ok tedu@
2013-05-14Don't bother printing vm_swrss of a process, the current uvm accountingMiod Vallat
logic never sets this value.
2013-04-24pretty-print bigger ino_t variablesTheo de Raadt
2013-04-21revert 1.45. it depended on a kernel change we will not be making, andTed Unangst
the old code was cleaner
2013-03-26for the sake of argument, let's pretend this #if 0 code isn't wantedTed Unangst
2013-03-23rework the main loop so we can drop kmem privs a little later,Ted Unangst
prepping for a coming kernel change. we need to call sysctl for all the procs to get their vmspace pointer, then we drop, then we go grovelling. ok deraadt
2013-03-20revert, that restriction is already enforced the right wayTed Unangst
2013-03-20Only root can look at the kernel address space.Theo de Raadt
2013-01-16document a safe cast, which should be (unsigned int) instead of simplyTheo de Raadt
(unsigned)
2012-03-09Userspace counterpart of new vmmap.Ariane van der Steldt
Allows memory walks to function.
2011-09-03make -column lists pretty again;Jason McIntyre
specifically, rewrite them to permit some markup in the column headers, and use "Ta" instead of literal tabs; mandoc does not currently match groff 100%, but a mandoc fix may be some time off, and we've gone enough releases with poorly formatting column lists. in some cases i have rewritten the lists as -tag, where -column made little sense.
2011-06-06Userland counterpart of the vmmap backout; cranks major version of libkvm.Ariane van der Steldt
2011-05-24Reimplement uvm/uvm_map.Ariane van der Steldt
vmmap is designed to perform address space randomized allocations, without letting fragmentation of the address space go through the roof. Some highlights: - kernel address space randomization - proper implementation of guardpages - roughly 10% system time reduction during kernel build Tested by alot of people on tech@ and developers. Theo's machines are still happy.
2011-04-23BRKSIZ is the right constant now, so I don't get lots of teeny tiny heapsTed Unangst
mixed up in my address space.
2011-04-10Switch back from KERN_PROC2/kinfo_proc2 to KERN_PROC/kinfo_proc nowPhilip Guenthe
that we've got name we want for the API we want "ZAP!" deraadt@
2011-04-06Avoid using NULL in non-pointer contexts: use 0 for integer values and '\0'Miod Vallat
for chars.
2011-04-05Remove portalfs.Thordur I. Bjornsson
While it is a terribly cool idea, it's just awful and since noone has stepped up to the plate to keep it up with the current vop state, retire it to the attic. ok krw@, deraadt@, guenther@, miod@. comments from jmc@
2010-09-03add an EXIT STATUS section for /usr/sbin;Jason McIntyre
2009-08-12Update nlist array and uncomment a few things to pave the way for upcomingMiod Vallat
new name cache information gathering code.
2009-08-12Namecache revamp.Bob Beck
This eliminates the large single namecache hash table, and implements the name cache as a global lru of entires, and a redblack tree in each vnode. It makes cache_purge actually purge the namecache entries associated with a vnode when a vnode is recycled (very important for later on actually being able to resize the vnode pool) This commit does #if 0 out a bunch of procmap code that was already broken before this change, but needs to be redone completely. Tested by many, including in thib's nfs test setup. ok oga@,art@,thib@,miod@
2009-06-04No longer consider kernel pointers invalid if pointing under the kernelMiod Vallat
load address (hello, PMAP_DIRECT architectures). Makes procmap walk the kernel name cache correctly. ok art@
2009-01-19replace standardized text concerning the exit values of applicationsIgor Sobrado
with the right mdoc macros.
2008-09-18add -A to SYNOPSIS;Jason McIntyre
2008-09-18document -A and include in usageOtto Moerbeek
2008-09-18Add a flag to print amap usage.Artur Grabowski
otto@ ok
2008-06-26First pass at removing clauses 3 and 4 from NetBSD licenses.Ray Lai
Not sure what's more surprising: how long it took for NetBSD to catch up to the rest of the BSDs (including UCB), or the amount of code that NetBSD has claimed for itself without attributing to the actual authors. OK deraadt@
2008-06-09Define a new flag, UVM_FLAG_HOLE, for uvm_map to create a vm_map_entry ofMiod Vallat
a new etype, UVM_ET_HOLE, meaning it has no backend. UVM_ET_HOLE entries (which should be created as UVM_PROT_NONE and with UVM_FLAG_NOMERGE and UVM_FLAG_HOLE) are skipped in uvm_unmap_remove(), so that pmap_{k,}remove() is not called on the entry. This is intended to save time, and behave better, on pmaps with MMU holes at process exit time. ok art@, kettenis@ provided feedback as well.
2007-11-28this is openbsd, therefore the native display mode is called openbsdTed Unangst
2007-10-02Use kinfo_proc2 instead of kinfo_proc.Mark Kettenis
ok art@
2007-09-02use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsgTheo de Raadt