summaryrefslogtreecommitdiffstats
path: root/lib/libkvm/kvm_proc.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* make fixed-sized fixed-value mib[] arrays be constderaadt2020-10-121-4/+2
| | | | ok guenther tb millert
* When system calls indicate an error they return -1, not some arbitraryderaadt2019-06-281-2/+2
| | | | | | value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
* A few fixes for kvm_getargv(3)/kvm_getenv(3):zhuk2018-05-031-61/+80
| | | | | | | | | | | 1. Most notable: this splits argv buffer into argv-specific one and environ-specific one. This makes ps -eww totally happy. 2. realloc() usage in kvm_argv() is now ENOMEM-prone. 3. The "int off" changed to "ptrdiff_t off", as it should be. input & okay deraadt@, millert@
* Split PID from TID, giving processes a PID unrelated to the TID of theirguenther2016-11-071-3/+3
| | | | | | initial thread ok jsing@ kettenis@
* handle fallout of moving the address maps to RBT code.dlg2016-09-161-4/+8
| | | | | | because userland doesnt have subr_tree, and the tree traversal in this file is simple, this inlines the logic that the functions in the kernel do.
* Make amaps use less kernel memory (2nd try)stefan2016-05-261-11/+53
| | | | | | | | | | | | | | | | | | | | | The original diff would crash at least i386 and powerpc, as spotted by guenther@ The reason was an incorrect use of sizeof in amap_lookups(). Confirmation that powerpc works by mpi@ and mglocker@ "throw it in" deraadt@ Original commit message: This is achieved by grouping amap slots into chunks that are allocated on-demand by pool(9). Endless "fltamapcopy" loops because of kmem shortage should be solved now. The kmem savings are also important to later enable vmm(4) to use larged shared memory mappings for guest VM RAM. This adapts libkvm also because the amap structure layout has changed. Testing and fix of libkvm glitch in initial diff by tb@ Feedback and "time to get this in" kettenis@
* Revert previous: breaks i386 and powerpc, probably all non-PMAP_DIRECT archsguenther2016-05-221-53/+11
|
* Make amaps use less kernel memorystefan2016-05-221-11/+53
| | | | | | | | | | | | This is achieved by grouping amap slots into chunks that are allocated on-demand by pool(9). Endless "fltamapcopy" loops because of kmem shortage should be solved now. The kmem savings are also important to later enable vmm(4) to use larged shared memory mappings for guest VM RAM. This adapts libkvm also because the amap structure layout has changed. Testing and fix of libkvm glitch in initial diff by tb@ Feedback and "time to get this in" kettenis@
* convert bcopy to memcpy. ok dlg millerttedu2016-05-111-2/+2
|
* Don't leak the old data if _kvm_reallocarray() failsguenther2014-10-221-3/+5
| | | | ok millert@ doug@
* Apply reallocarray() idiom.deraadt2014-10-151-10/+10
| | | | ok guenther
* Track whether a process is a zombie or not yet fully built via flagsguenther2014-07-041-6/+13
| | | | | | | | | | | PS_{ZOMBIE,EMBRYO} on the process instead of peeking into the process's thread data. This eliminates the need for the thread-level SDEAD state. Change kvm_getprocs() (both the sysctl() and kvm backends) to report the "most active" scheduler state for the process's threads. tweaks kettenis@ feedback and ok matthew@
* reduce use of <sys/user.h>deraadt2013-11-011-2/+2
| | | | ok guenther millert
* No longer need the "miniproc" glue, as we only have kinfo_proc now.guenther2013-01-141-40/+13
| | | | ok deraadt@ pirofti@ kettenis@
* Need to read in the vmspace to dig out the root of the rb-treeguenther2012-04-141-2/+5
|
* Userspace counterpart of new vmmap.ariane2012-03-091-13/+14
| | | | Allows memory walks to function.
* Add rtable id and thread id to struct kinfo_proc (and fix process id)guenther2012-01-071-13/+1
| | | | | | | | | | | and add an 'rtableid' keyword to ps. Add rtable id, thread id, and socket splice info to struct kinfo_file2 and make fstat display socket splice information. Remove old KVM_PROC2 and kinfo_proc2 interfaces; bump libkvm major Socket splice info and corrections from bluhm@ "Lovely" deraadt@
* Userland counterpart of the vmmap backout; cranks major version of libkvm.ariane2011-06-061-14/+13
|
* Reimplement uvm/uvm_map.ariane2011-05-241-13/+14
| | | | | | | | | | | | | 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.
* Replace the old, broken KERN_PROC ABI and its matching functionsguenther2011-03-121-310/+13
| | | | | | | | | 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
* Correct the links between threads, processes, pgrps, and sessions,guenther2010-07-261-6/+7
| | | | | | | | | 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
* Reimplement kvm_getproc2()'s support for reading crash dumps andguenther2010-01-101-199/+1
| | | | | | | | | | | | | | /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.
* rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andderaadt2009-10-271-9/+1
| | | | | | | unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
* Move KREAD define to kvm_private.hmillert2009-06-201-5/+2
|
* All operation on live kernels uses sysctl interface, there is no reason tomiod2009-01-211-3/+4
| | | | | | access the swap area. Change kvm_open() to no longer require a swap area, and to not consider failure to open() it as fatal. Post-mortem analysis would need an image of the swap area at the time of the crash, anyway.
* First pass at removing clauses 3 and 4 from NetBSD licenses.ray2008-06-261-9/+2
| | | | | | | | | 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@
* 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
* Bring back Mickey's UVM anon change. Testing by thib@, beck@ andpedro2007-06-181-3/+3
| | | | ckuethe@ for a while. Okay beck@, "it is good timing" deraadt@.
* hide struct process from userland, allow kvm_proc to see it.espie2007-04-141-2/+3
| | | | okay miod@
* move p_limit and p_cred into struct processtedu2007-04-121-4/+9
| | | | | leave macros behind for now to keep the commit small ok art beck miod pedro
* Sync with struct proc change.miod2006-11-291-3/+3
|
* Back out the anon change. Apparently it was tested by a few, but most ofderaadt2006-07-131-3/+3
| | | | | us did not see it or get a chance to test it before it was commited. It broke cvs, in the ami driver, making it not succeed at seeing it's devices.
* from netbsd: make anons dynamically allocated from pool.mickey2006-06-211-3/+3
| | | | | | this results in lesse kva waste due to static preallocation of those for every phys page and also every swap page. tested by beck krw miod
* careful cleanup following advice from lint. be very very very carefulderaadt2006-03-311-10/+10
| | | | with sprinkling in size_t!
* Use queue macros instead of directly accessing fields. ok millert@otto2005-10-121-3/+3
|
* Back out part of last commit; we want to realloc + loop for argv too.millert2004-06-241-3/+3
|
* Allocate 8 pages for process argv, not one. This should really be ARG_MAXmillert2004-06-241-5/+5
| | | | but sysctl_proc_args() needs changes to support that.
* knf; ok millertderaadt2004-06-151-162/+100
|
* Zero p_schedflags in struct struct kinfo_proc2 for the non-sysctl case.millert2004-06-141-5/+3
|
* temporary tree building workaround until millert shows upderaadt2004-06-131-2/+4
|
* Sync PTRTOINT64 w/ kernel version and remove some unused vars.millert2004-01-071-5/+3
|
* Implement kvm_getproc2(), kvm_getargv2() and kvm_getenvv2() that usemillert2004-01-071-38/+333
| | | | | the KERN_PROC2 sysctl. Based on changes from NetBSD but uses our own kvm_arg_sysctl().
* Zero nlist array before using; fixes a bug in the error conditionmillert2003-11-171-3/+4
| | | | when the corefile is not a valid executable. otto@ OK
* Remove some double semicolons (hmm, do two semis equal a maxi?).millert2003-08-061-3/+3
| | | | I've skipped the GNU stuff for now. From Patrick Latifi.
* Remove the advertising clause in the UCB license which Berkeleymillert2003-06-021-7/+3
| | | | rescinded 22 July 1999. Proofed by myself and Theo.
* Redo the logic in kvm_arg_sysctl for resizing the buffer.art2002-06-201-24/+22
| | | | | - actually use the value we've just reallocated. - Don't return success just because the error wasn't ENOMEM (doh!).
* If possible get arg and env information with sysctl.art2002-06-081-2/+54
|
* Manual cleanup of remaining userland __P use (excluding packages maintained outside the tree)millert2002-02-171-10/+8
|
* Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.millert2002-02-161-6/+6
|
* Reorder new includes. art@ says ok.hugh2001-12-131-3/+3
|