summaryrefslogtreecommitdiff
path: root/lib/libkvm/kvm_proc.c
AgeCommit message (Collapse)Author
2022-04-19lib: remove CONSTCOND commentrillig
Since 2021-01-31, lint doesn't need it anymore for the common pattern of 'do ... while (0)'.
2022-01-10read the ps arguments from the correct place.christos
2022-01-10Get rid of usrstack/USRSTACK. Document that the old version of getargv ischristos
broken because of ASLR.
2021-07-19Match the declaration in <sys/kauth.h>christos
2019-12-11Redo previous more conventionally. Requested by kre@.ad
2019-12-10Mask out always zero bits off pg->phys_addr.ad
2016-04-04some ports need <sys/wait.h>christos
2016-04-04catch up with p_xstat split.christos
2014-02-19Remove the #include <sys/user.h> from all of libkvm.dsl
sys/user.h is a stub that just #includes sys/pcb.h. There are no 'struct pcb' anywhere in here, so I'm extremely doubtful any of the builds will fail. OTOH it might be relying on a header that pcb.h includes. In any case i386 and amd64 build.
2012-06-05Measure kinfo_proc2::p_vm_vsize in pages, as it was always documented.martin
This value seems to never have been used anywhere. This makes it consistent with it's cousin p_vm_msize (which is in pages as well and has several uses).
2010-11-12Fix build.uebayasi
2010-09-26Define KREAD() inside kvm_private.h, for reusability.jym
2010-09-20Change kvm_pa2off() and kvm_kvatop() prototypes (private to kvm(3)):jym
-int _kvm_kvatop(kvm_t *, u_long, u_long *); -off_t _kvm_pa2off(kvm_t *, u_long); +int _kvm_kvatop(kvm_t *, vaddr_t, paddr_t *); +off_t _kvm_pa2off(kvm_t *, paddr_t); Basically, use vaddr_t for VA and paddr_t for PA. In addition, for variables representing addresses, use paddr_t or vaddr_t, depending on the context. For most arches, vaddr_t and paddr_t are equivalent to unsigned long. However, the change was needed for exotic situations, like i386 PAE, were unsigned long is not suitable for PA which are 64 bits long. As this required a complete change of the function prototypes, all arches had to be adapted accordingly. Core files from before this commit should still work with the new code; I did not see any direct dependency between core's structure and kvatop/pa2off. The change was compile tested for all arches, as it impacts all of them. See also: http://mail-index.netbsd.org/current-users/2010/09/07/msg014249.html
2010-09-19Ansify and KNF all functions within kvm(3). No objection on current-users@.jym
Used as ground for u_long => vaddr_t/paddr_t replacements in kvm(3) private functions. Compile tested for all arches. See also: http://mail-index.netbsd.org/current-users/2010/09/07/msg014249.html
2009-10-21Remove uarea swap-out functionality:rmind
- Addresses the issue described in PR/38828. - Some simplification in threading and sleepq subsystems. - Eliminates pmap_collect() and, as a side note, allows pmap optimisations. - Eliminates XS_CTL_DATA_ONSTACK in scsipi code. - Avoids few scans on LWP list and thus potentially long holds of proc_lock. - Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k. - Removes __SWAP_BROKEN cases. Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on acorn26 (thanks to <bjh21>). Discussed on <tech-kern>, reviewed by <ad>.
2009-05-16kvm_getprocs actually works with KVM_NO_FILES.yamt
2009-03-29- add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the totalmrg
address space available to processes. this limit exists in most other modern unix variants, and like most of them, our defaults are unlimited. remove the old mmap / rlimit.datasize hack. - adds the VMCMD_STACK flag to all the stack-creation vmcmd callers. it is currently unused, but was added a few years ago. - add a pair of new process size values to kinfo_proc2{}. one is the total size of the process memory map, and the other is the total size adjusted for unused stack space (since most processes have a lot of this...) - patch sh, and csh to notice RLIMIT_AS. (in some cases, the alias RLIMIT_VMEM was already present and used if availble.) - patch ps, top and systat to notice the new k_vm_vsize member of kinfo_proc2{}. - update irix, svr4, svr4_32, linux and osf1 emulations to support this information. (freebsd could be done, but that it's best left as part of the full-update of compat/freebsd.) this addresses PR 7897. it also gives correct memory usage values, which have never been entirely correct (since mmap), and have been very incorrect since jemalloc() was enabled. tested on i386 and sparc64, build tested on several other platforms. thanks to many folks for feedback and testing but most espcially chuq and yamt for critical suggestions that lead to this patch not having a special ugliness i wasn't happy with anyway :-)
2008-12-28tdev is unsignedchristos
2008-12-28cast dev_t's to int32_t because XXX: sysctl can't change size. This shouldchristos
be not a problem since tty's live in the low part of the dev range.
2008-11-29check error case for kvm_getlwps or SIGSEGV occurs due to dereferecing a ↵cegger
NULL pointer. return NULL if there are no threads or proceed further through all loops. Fixes PR 40004. Ok rmind@
2008-04-28Remove clause 3 and 4 from TNF licensesmartin
2008-02-05PR/37962: Andrew Doran: libkvm is busted due to kauth_cred redefinitionelad
Sync structure with kernel version.
2008-01-15Handle reading from raw disk devices.ad
2007-12-22sync with kernel.yamt
2007-11-06Catch up with scheduling changes in the kernel.ad
2007-07-09'true' is a C99 keyword.ad
2007-07-07treat ESRCH as a soft error. From Anon Ymouschristos
2007-07-06- Fix kvm_getlwps not to spit errors if we lose the race:christos
- if the process does not exist anymore, return NULL - if the process has created more lwps retry XXX[1]: We should fix sysctl_kern_lwp() to return the number of lwps it needs in oldlenp when ENOMEM. The we can avoid calling sysctl twice (by starting let's say with always 1 lwp, or 10). XXX[2]: We should fix kvm_getlwps to never spit errors. - Silence new lint warnings
2007-05-17fix for yamt-idlelwpchristos
2007-05-01Set kp2p->p_ru = 0 in the kproc2 structure.dsl
It was only ever non-zero for zombies, and now doesn't exist. The 'pstats' field has been valid for zombies for a while (it isn't in the uarea any more). Fixes part of build breakage.
2007-02-24Revert the kauth_impl.h change. Elad is going to maintain this. Asked by core@christos
2007-02-18Update only user code that uses the types of the e_[pu]cred membersdsl
of struct kinfo_proc.
2007-02-09Sync with kernel changes introduced by merging the newlock2 branch.ad
2007-02-06PR/35506: Chuck Silvers: ps doesn't work on crash dumps, libkvm doesn'telad
know about kauth Implemented _kvm_convertcred() to handle copying kauth_cred_t to userspace and converting it to the appropriate 'struct eproc' members ('pcred' and 'ucred' respectively). Okay mlelstv@.
2007-01-28fill in p_stat for crashdumps like the kernel does for the sysctl.chs
2006-12-31kvm_getproc2: retry on ENOMEM.yamt
it happens when the number of processes are changed in the mean time.
2006-05-11#include a necessary header directly, rather than via user.h.yamt
2006-02-161. Eliminate some unnecessary to kvm_{m,re}alloc.christos
2. Don't malloc/free procbase/procbase2/lwpbase continuously. Keep track of the size, and only do it if necessary. 3. Write a macro to malloc/realloc and set the size of members so that it is done correctly. Previous open coded version in kvm_file.c always set the length, which is incorrect. 4. Remove bogus check against INT_MAX. 5. use NULL to initialize pointers instead of 0.
2005-07-30as swap is now optional, ENXIO on /dev/drum is normal.yamt
2005-05-11Fix fallout from vm_anon changesjmc
2004-05-12Fix typos.toshii
2004-02-19Use new PTRTOUINT64() macro instead of local PTRTOINT64() macro.atatat
2003-11-17zero out nl, from Todd Miller. thanks!christos
2003-09-29available, not avaliable. From miod@openbsd.wiz
2003-08-07Move UCB-licensed code from 4-clause to 3-clause licence.agc
Patches provided by Joel Baker in PR 22280, verified by myself.
2003-03-28remove scanning of deadproc, since zombproc should contain all the processeschristos
in deadproc according to the comment in kern_proc.c. deadproc is not a struct proclist anymore, so it would require more work to scan anyway, and this is unnecessary.
2003-03-20fix LP64 and other warningsross
2003-03-19Alternative pid/proc allocater, removes all searches associated with piddsl
lookup and allocation, and any dependency on NPROC or MAXUSERS. NO_PID changed to -1 (and renamed NO_PGID) to remove artificial limit on PID_MAX. As discussed on tech-kern.
2003-03-01Add p_svuid and p_svgid to kinfo_proc2. Populate them in the kernelatatat
and in libkvm. Then teach ps how to show them to you. Also, teach ps how to show the names for all the uids, the rest of the group numbers, and the "group access list".
2003-02-26Use _kvm_freeprocs() rather than free() so that kvm_close() won'tenami
free already free'ed region.